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-exec / fp8block.md

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