Archived
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.
24 lines
1.0 KiB
C
24 lines
1.0 KiB
C
/* r3d_launch.h -- the two lines a libr3d unit needs to launch a kernel.
|
|
*
|
|
* R3D_KLAUNCH is the triple-chevron form, which the engine services on its own queues because the
|
|
* stream it hands a launch is the one hipLaunchKernel accepts (docs/PLUGIN.md §5). It is written as
|
|
* a macro so a test can define it and drive the same sources through a host SIMT emulator; a build
|
|
* does not, and gets the chevron.
|
|
*
|
|
* R3D_DYN_LDS declares a kernel's dynamic LDS, sized by the launch: `extern __shared__` in a build.
|
|
* RDNA3 gives a workgroup the same 64 KiB RDNA4 does, so a tile sized for libr4d fits here too.
|
|
*
|
|
* R3D_KNAME names a kernel in a context where commas would split a macro argument, the way
|
|
* HIP_KERNEL_NAME does for hipLaunchKernelGGL.
|
|
*/
|
|
#ifndef R3D_LAUNCH_H
|
|
#define R3D_LAUNCH_H
|
|
#define R3D_KNAME(...) __VA_ARGS__
|
|
#ifndef R3D_KLAUNCH
|
|
#define R3D_KLAUNCH(kernel, grid, block, stream, ...) kernel<<<grid, block, 0, stream>>>(__VA_ARGS__)
|
|
#endif
|
|
#ifndef R3D_DYN_LDS
|
|
#define R3D_DYN_LDS(type, name) extern __shared__ type name[]
|
|
#endif
|
|
#endif
|