interplane.Get Omega
Read in your language

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

branch main Branches Tags History

CUDApp / tests / amd / formats.py

34 lines · 1452 bytes Raw Blame History
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."""
4import pathlib
5import subprocess
6import sys
7
8producer, source, expected, output = sys.argv[1:]
9text = pathlib.Path(source).read_text()
10out = pathlib.Path(output)
11reference = pathlib.Path(expected).read_bytes()
12# The SOPP branch-reference format remains ID4 by schema; all other IDs are names, not indexes.
13rows = []
14for 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)
20variants = {
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}
25for 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)')