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/models/mxfp4-check.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 / models / mxfp4-check.py` 82 lines · 3983 bytes Raw Blame History 1 #!/usr/bin/env python3 2 # SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception 3 """Verification-only oracle; never part of the runtime or installed engine.""" 4 import argparse 5 import hashlib 6 import math 7 from pathlib import Path 8 import struct 9 import subprocess 10 import tempfile 11 12 PIN = "`189ada82e00bb440cb41351bd252cc68c54a1b1050051cc42a1df700081c3b54`" 13 # OpenAI gpt_oss/torch/weights.py FP4_VALUES. ldexp models its torch.ldexp; 14 # struct packs IEEE binary32 once, independently of the candidate bit operations. 15 VALUES = (0.0, 0.5, 1.0, 1.5, 2.0, 3.0, 4.0, 6.0, 16 -0.0, -0.5, -1.0, -1.5, -2.0, -3.0, -4.0, -6.0) 17 ROOT = Path(__file__).resolve().parents[2] 18 19 20 def build(compiler, source, target): 21 result = subprocess.run([compiler], input=source, capture_output=True, timeout=60) 22 if result.returncode: 23 raise RuntimeError(result.stderr.decode()) 24 target.write_bytes(result.stdout) 25 target.chmod(0o700) 26 return str(target) 27 28 29 def oracle(packed, lane, scale): 30 value = math.ldexp(VALUES[(packed >> (lane * 4)) & 15], scale - 127) 31 try: 32 return struct.pack('