CUDApp
CUDA++: AIEN’s GPU machine-code toolchain, runtime and driver client for NVIDIA GPUs without the CUDA toolkit. Hardware coverage and driver replacement limits are explicit.
Brought by drakestapleton
CUDApp / tests / amd / formats.py
| 1 | #!/usr/bin/env python3 |
| 2 | # SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception |
| 3 | """Test-only growable format registry checks; no producer implementation here.""" |
| 4 | import pathlib |
| 5 | import subprocess |
| 6 | import sys |
| 7 | |
| 8 | producer, source, expected, output = sys.argv[1:] |
| 9 | text = pathlib.Path(source).read_text() |
| 10 | out = pathlib.Path(output) |
| 11 | reference = pathlib.Path(expected).read_bytes() |
| 12 | # The SOPP branch-reference format remains ID4 by schema; all other IDs are names, not indexes. |
| 13 | rows = [] |
| 14 | for line in text.splitlines(): |
| 15 | cells = line.split() |
| 16 | if cells and cells[0] in ('F', 'B', 'D', 'I') and cells[1] != '4': |
| 17 | cells[1] = str(int(cells[1])+1000000) |
| 18 | line = ' '.join(cells) |
| 19 | rows.append(line) |
| 20 | variants = { |
| 21 | 'sparse-format-ids': '\n'.join(rows)+'\n', |
| 22 | 'growing-format-count': text + ''.join(f'F {i} 1\nB {i} 0 0 32 0\n' for i in range(11, 35)), |
| 23 | 'undefined-format': text + 'I 1000002\n', |
| 24 | } |
| 25 | for name, body in variants.items(): |
| 26 | table = out/(name+'.isa') |
| 27 | table.write_text(body) |
| 28 | result = subprocess.run([producer, str(table)], capture_output=True, timeout=60) |
| 29 | if name == 'undefined-format': |
| 30 | assert result.returncode == 4 and not result.stdout, result |
| 31 | print('CONTROL undefined-format CAUGHT exit=4 no object') |
| 32 | else: |
| 33 | assert result.returncode == 0 and not result.stderr and result.stdout == reference, (name, result) |
| 34 | print(f'PASS {name} byte-identical FP8 object (no capacity ceiling)') |