Archived
libr4d: tiled runtime-LoRA rows over row tiles, preferred over the scalar rows
The v1 rows grid by row: shrink is one block a row walking K serially, and expand one block a (row, 256 columns) that re-reads all of B[s] for every row, so a prefill chunk reads it M times and a chunk of base rows still launches M * ceil(N/256) blocks that read a slot and leave. lora_shrink_wmma (bf16 a) and lora_shrink_wmma_q (fp8 / i8 codes whose scale group is whole 32-wide steps) run WMMA bf16 over 16-row x 16-j tiles: K in 32-wide steps over 4 waves, the waves summed in fixed order in LDS, and a K split fixed by K and R alone (sh_plan) whose partials live in the op's scratch and are summed in split order by the last block to arrive; the arrival counters are a small block keyed on (device, t). Codes are exact in bf16 and each step's partial is scaled by its group's f32 scale; f16 / f32 activations and other groups stay on the scalar kernel. lora_expand_tiled stages B[s]'s [128 columns, 32 j] slab in LDS as f32 for a 32-row tile and keeps v1's per-output sequence (j ascending, no FMA), so its bytes are libref's. Both grid by row tiles; a tile of base rows leaves on one ballot before any barrier or operand load, a mixed tile runs one pass per distinct slot, and a small grid spreads a tile's passes over blockIdx.z. No choice depends on M but which block runs a pass. The scalar rows stay, by name and as the f16 / f32 shrink, below R4D_PRIO_LORA_TILED.
This commit is contained in:
1 parent
b427e2774c
commit
ec1e830c43
6 files changed
+690
-36
No files matched your search
+4
-1
@@ -654,7 +654,10 @@ tensor's. The pools are ordinary inputs and not weights: the engine owns them as
|
||||
and copies an adapter into a slot between steps, so a recorded pass replays the same pointers and
|
||||
reads whatever adapters the slots hold. A row's result does not depend on `M` or on any other row
|
||||
(no split of a reduction that moves with the batch), which is what lets a request's bytes be the
|
||||
same alone and in a mixed batch. Implementations: libref, libavx, libr4d (scalar f32 rows).
|
||||
same alone and in a mixed batch. Implementations: libref, libavx, libr4d (scalar f32 rows, and
|
||||
tiled rows over row tiles that outrank them: a WMMA shrink whose summation order is fixed by `K`
|
||||
and `R`, and an expand that stages `lora_b[s]` in LDS for a tile of rows and computes libref's
|
||||
bytes).
|
||||
|
||||
## Attention
|
||||
|
||||
|
||||
Reference in new issue
Block a user