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-exec / fp8block.md
| 1 | # Checkpoint block-scaled FP8 GEMV |
| 2 | |
| 3 | `backend/amd/gfx942/fp8gemv_b128.isa` is a declarative kernel table consumed by |
| 4 | seeded Omega `hsaco.om`, following the existing `fp8gemv2` convention. LLVM |
| 5 | assembly is an independent encoding oracle; it is not a production input. |
| 6 | Existing kernels and objects are unchanged. |
| 7 | |
| 8 | The kernel implements the checkpoint's OCP E4M3 encoding, not native gfx942 |
| 9 | FNUZ. It converts the unsigned magnitude through the hardware instruction, |
| 10 | rescales the bias, restores the sign (including negative zero), and explicitly |
| 11 | handles OCP NaNs. The test builds a separate rational decode table from the OCP |
| 12 | sign/exponent/fraction definition and exercises every byte encoding. |
| 13 | |
| 14 | A wave owns an output row. Each lane consumes two columns of a block, reduces |
| 15 | within that block using an XOR tree, then accumulates its BF16-scaled block sum. |
| 16 | The row and column block indexes select the checkpoint scale grid in row-major |
| 17 | order. Masked loads protect both halves of the last partial block. All global |
| 18 | addresses include high words and carry propagation. A zero-column row produces |
| 19 | zero without reading inputs; an overdispatched row performs no buffer access. |
| 20 | |
| 21 | ## Reproduce |
| 22 | |
| 23 | Run from the repository root under an externally held free queen CPU-pool lock, |
| 24 | with `nice` and CPU affinity. Set `OMEGA_OMC` to the absolute pinned compiler, |
| 25 | `AMD_WEIGHTS` to the local checkpoint directory with its manifest, and |
| 26 | `AMD_DOC_OUT` to a new private output parent. The harness snapshots its inputs. |
| 27 | Use `python3` on the caller's PATH; missing dependencies are NOT_RUN. |
| 28 | |
| 29 | ```sh |
| 30 | python3 tests/amd-exec/fp8block.py \ |
| 31 | --omc "$OMEGA_OMC" \ |
| 32 | --weights "$AMD_WEIGHTS" \ |
| 33 | --out "$AMD_DOC_OUT/fp8block" |
| 34 | ``` |
| 35 | |
| 36 | The harness refuses an unpinned compiler before making an output directory. |
| 37 | It records every executed command and exit, deterministic producer/executor |
| 38 | builds, object hashes, LLVM section comparisons, checkpoint shard and sampled |
| 39 | row hashes, exact-oracle cases, and access bounds. Checkpoint shards are hashed |
| 40 | against the supplied local manifest and rows are read individually; no model |
| 41 | is held in memory. |
| 42 | |
| 43 | Real-shape cases preserve full dimensions, physical strides, and allocation |
| 44 | sizes, but execute sampled rows including both sides of a row-block boundary |
| 45 | and the last row. They are not exhaustive executions of every output row. |
| 46 | Small cases exhaustively exercise their outputs, including all FP8 encodings, |
| 47 | empty dimensions, column-half boundaries, and partial blocks. The entire memory |
| 48 | image is compared, including untouched rows and padding. |
| 49 | |
| 50 | The exact Fraction oracle specifies this kernel's reduction order. It does not |
| 51 | claim bit-for-bit agreement with the Rust reference's serial dot-product order, |
| 52 | nor does this kernel-level gate prove model logits or generated tokens. |
| 53 | |
| 54 | Numerical mutants deliberately use per-row scales, transpose the scale-grid |
| 55 | indexes, or drop the partial block. Each must execute successfully and produce |
| 56 | a wrong answer. Instrumented Omega executors measure the last byte read and |
| 57 | written in each buffer, refusing cross-buffer accesses. Independent shortened |
| 58 | buffer controls must refuse the measured last access. `report.json` is the |
| 59 | source of truth for measurements and results; `commands.json` records actual |
| 60 | process exits. No device dispatch or performance claim is made. |
| 61 | |
| 62 | ## Notebook bundle |
| 63 | |
| 64 | After the source and acceptance evidence have been committed, generate the |
| 65 | bundle from that exact evidence; do not maintain copied ABI lists by hand: |
| 66 | |
| 67 | ```sh |
| 68 | python3 tests/amd-exec/fp8block_bundle.py "$AMD_DOC_OUT/fp8block" "$AMD_DOC_OUT/fp8block-bundle" |
| 69 | ``` |
| 70 | |
| 71 | This derives `list.json`, `list.md`, and `SHA256SUMS` from the tested table and |
| 72 | report, includes the correct object and deliberately wrong controls, and copies |
| 73 | the compiler/oracle source snapshots and command records. The executable ABI |
| 74 | is in the table's `K` and `A` records; generated lists are the notebook-facing |
| 75 | view. Hardware qualification and performance remain separate gates. |