Interplane page as plain text, for reading tools and agents. English is the reference text: translate it with your own tool. Text in backticks and in ``` blocks (commands, fingerprints, file names) and link targets in <...> are exact: copy them, never translate them. Page: /drakestapleton/CUDApp/blob/main/tests/amd-exec/oracle.py # 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 Sign in to star 0 stars 0 watching About Files History Releases Proposed changes Issues For developers branch `main` Branches Tags History `CUDApp / tests / amd-exec / oracle.py` 237 lines · 9806 bytes Raw Blame History 1 #!/usr/bin/env python3 2 # SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception 3 """Test only. Python binary64 addition + struct binary32 rounding is the independent oracle. 4 Binary32 operands add exactly in binary64 when their exponents are close enough to 5 matter to binary32 rounding. At wider separation the small operand cannot change 6 round-to-nearest binary32. Overflow is signed infinity. NaNs are canonicalized to 7 0x7fc00000 (executor policy, not a claim about hardware NaN payload propagation). 8 No production code, LLVM disassembly, or .isa parsing implements the reference. 9 """ 10 import math 11 import pathlib 12 import random 13 import struct 14 import subprocess 15 import sys 16 17 COUNTS = (0, 1, 63, 64, 65, 200) 18 # Raw encodings: subnormal boundaries, both zeros, infinities, qNaN/sNaN, 19 # cancellation, overflow, half-ULP ties (even/odd), large exponent gaps. 20 PAIRS = ( 21 (0x00000001, 0x00000001), (0x007fffff, 0x00000001), 22 (0x00800000, 0x807fffff), (0x80000001, 0x80000001), 23 (0x00000000, 0x80000000), (0x80000000, 0x80000000), 24 (0x00000000, 0x00000000), (0x7f800000, 0x3f800000), 25 (0xff800000, 0xbf800000), (0x7f800000, 0xff800000), 26 (0x7fc12345, 0x3f800000), (0x7f812345, 0xffc12345), 27 (0x7f7fffff, 0x7f7fffff), (0xff7fffff, 0xff7fffff), 28 (0x3f800000, 0xbf800000), (0x3f800000, 0x33800000), 29 (0x3f800001, 0x33800000), (0xbf800001, 0xb3800000), 30 (0x7f7fffff, 0x00000001), (0x00800001, 0x80000001), 31 (0x3f800000, 0x80000001), (0x80800000, 0x007fffff), 32 (0x00000001, 0x80000001), (0x7f800000, 0x7f800000), 33 ) 34 35 36 def addref(a, b): 37 x, = struct.unpack('> 16 == 0xbf88) 127 literal_index = next(i + 1 for i, word in enumerate(words) 128 if word >> 25 == 0x13 and word & 511 == 255) 129 words[branch_index] = 0xbf880000 | ((literal_index - branch_index - 1) & 65535) 130 bad_branch = struct.pack('<' + 'I' * len(words), *words) 131 # Valid but unsupported S_CBRANCH_VCCZ (CDNA3 p140). Reject even after endpgm. 132 for label, code, rc in ( 133 ('outside-subset', struct.pack('