libr4d: logit_softcap spreads a row over blocks

One 256-thread block a row: at Gemma 4's tp 4 a row is a 65536-wide vocabulary shard and a step has
a decode's few rows, so a handful of blocks walked 256 elements a thread of tanhf each. --profile-ops
on 4x R9700: 82.7 us a decode step and 85.6 us for the prefill's single row, for 256 KiB of f32 a row
-- four times the drafter's row_topk over a row as wide (18.6 us).

Both legs now put a row on up to 64 blocks, eight elements a thread (32 blocks at 65536). Elementwise,
so no bit moves; libr4d's selftest and rad-kbench's libref comparison hold it as before.

Not yet run on the cards.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
AshlynandClaude Opus 5.5 committed 2026-10-12 14:40:04 -05:00
1 parent a378b41abb
commit 76dd0019ac
2 files changed
+19 -6

No files matched your search

+2 -2
View File
@@ -3829,7 +3829,7 @@ static const RadKernelInfo kKernels[] = {
r4d_shape_unary },
{ "logit_softcap_bf16", "logit_softcap", "elem",
"cap * tanh(x / cap), the final-logit softcap, grid-strided over the whole extent",
"cap * tanh(x / cap), the final-logit softcap, a row spread over up to 64 blocks",
"any extent; contiguous in and out",
"bf16 in and out, fp32 arithmetic",
RAD_DOMAIN_DEVICE, R4D_PRIO_ONLY,
@@ -3838,7 +3838,7 @@ static const RadKernelInfo kKernels[] = {
r4d_shape_unary },
{ "logit_softcap_f32", "logit_softcap", "elem",
"cap * tanh(x / cap), the final-logit softcap, grid-strided over the whole extent",
"cap * tanh(x / cap), the final-logit softcap, a row spread over up to 64 blocks",
"any extent; contiguous in and out",
"f32 in and out — the 1.3.0 sampling chain carries the logits as f32 from the gemm",
RAD_DOMAIN_DEVICE, R4D_PRIO_ONLY,