libr4d: lora_shrink and lora_expand, scalar f32 v1

r4d_lora_bf16.hip: shrink is one block a row (a base row's block leaves at once), one wave a
column of R, each lane's k in order and a fixed xor butterfly, so a row's bytes depend on nothing
but the row. Expand is one thread an output over M strips of 256 columns, j ascending, sum then
scale then one rounding to y's dtype: libref's order, so the emulator holds it to libref bit for
bit. A base row of y is neither read nor written. Strides of a, a_scale, t, y and the pools come
from the tensors; the grid is M (and N) only.

Rows lora_shrink_scalar / lora_expand_scalar with libref's schemas field for field, constrained
with C_IN on the tensor dtype names, so an activation the decode does not read never resolves.
Not concurrent: the core orders them behind their GEMM. r4d_selftest gets a device case (not run
here: this host's GPU is off limits for this work).
This commit is contained in:
baKon committed 2026-10-16 20:52:09 -05:00
1 parent 94ae86f6fd
commit 979b54e091
6 files changed
+669 -2

No files matched your search

+2
View File
@@ -149,6 +149,8 @@ set(R4D_UNITS
# expert_scale, each one kernel for a chain of small ones.
"r4d_norm_join_bf16|"
"r4d_expert_scale_bf16|"
# Runtime LoRA's two halves (lora_shrink, lora_expand), per-row adapter slot; scalar f32 v1.
"r4d_lora_bf16|"
"r4d_dflash_conv_t2_g16_bf16|"
"r4d_dflash_select_bf16|"
# Routed MoE: router, scatter, the grouped block-scaled fp8 GEMM and gather, in one unit because