Commit Graph
2 Commits
Author SHA1 Message Date
Asim Siddiqui 890715fd96 libr3d: the wave-matrix record -- the six 16x16x16 variants, the MAC-core measurement, the i8-x4 gap
RDNA3's ISA lists exactly six wave-matrix instructions (f16, bf16, int8 and
int4 in; f32, f16, bf16 and i32 accumulating) and the toolchain emits them on
every gfx11 target; they run over multiple cycles driving the DOT pipeline
internally, and the MAC-core measurement on the 16-CU gfx1102 part confirms
it: f32-acc f16 19.11, f32-acc bf16 19.24, f16-acc f16 19.44, i32-acc i8
19.29 against the paired dot2 path's 18.86 TFLOP/s -- the same pipe within
three percent, matching the full-kernel 1.99-vs-1.97 already in r3d_common.h.
The i32-acc i4 tile is the exception at 25.68 TFLOP/s, 35% above, but it takes
i4 in both operands and the grids served here pair i8 activations against i4
and i2 weights: there is no mixed-precision integer WMMA on RDNA3, so that
pipe is unreachable from the w4a8 and w2a8 rows.

Commentary only -- the rationale passages in the README, CMakeLists.txt,
r3d_rows.cpp, r3d_plugin.h and r3d_selftest.cpp now state the measured
record; no kernel, lane map or numeric path changes, and the rebuilt library
is byte-identical (selftest 78 rows, 0 failed, 0 skipped).
2026-10-28 13:51:45 +01:00
Asim Siddiqui 6cb9826975 libr3d: the gfx11 (RDNA3) kernel library
A complete row set for the gfx11 family (1100/1101/1102/1103/1150/1151 plus gfx11-generic),
mirroring libr4d's structure: the quantised GEMM rows (m16, tiled, gated, the bf16 logits
gemm), the paged and ragged attention for decode and prefill, the KV store, the sampler
spine and the spec rows, with the recorded-fixture, board, selftest and comparison-driver
gates for each.

The gates are the record. Every row is measured against libref on the shape matrix: the
recorded fixture at 1153 cases with worst rel_l2 1.362e-03, the board's five modes with
bit-identical decision lines, the selftest at 74 rows, and the 233-case served-shape pairing
at 0 divergent against the tree libref. End-to-end on a 2B fp8 checkpoint served on the
card, coherent through prefix-cache adoption.

Two platform laws each shape the design. A kernel that calls device printf takes the
implicit hidden_hostcall_buffer argument and is undispatchable by the AQL backend, so the
trace records are plain stores behind a budget. And a plugin-owned __device__ global is not
a channel into the engine's dispatch path: in a dlopened plugin the runtime's symbol stub
is not the address the kernel's module writes, so the served trace channel is a hipMalloc'd
record slot passed as a kernel argument, with the device-global ring kept for the board.

kv_store bounds its slots at the pool's own plane (n_blocks x block_size), the span the
cache operand declares, not at the step's own span: a request that adopts a cached prefix
writes its new tokens at the allocator's global block indices, which sit past any bound
built from the step's token count, and a slot lost there is KV that attention then reads
stale. A corrupt slot map is dropped at the same bound.
2026-10-28 13:51:45 +01:00