review: apply the Unlimited-OCR code-review findings

The 2a1ca01..f308216 range's 45 review findings (12 performance, 33 quality)
are applied: ABI 23 for the RadBatch append, the fused q|k|v projection, the
batched patch-embed GEMM and pitched layout copies, the sam_attn w-dot hoist
with an alignment-gated vector row path and NaN poisoning for malformed
segments, the fused quick_gelu act, and the R-SWA/scheduler/drafting gates.

Quality items: stale comments corrected, env reads hoisted, the ngram_window
negative refusal, the parts-form chat template instruction, the whitelist
fallback warning, and the segmented R-SWA refusal of the fixed/runtime window
mix.

The 3.2 MB generated resample header becomes a 9.6 MB little-endian blob
(tests/data/golden/uocr_resample_golden.bin) read by a small loader;
resample_golden.py emits and round-trip-verifies it.

One perf-med item (AVX2 bicubic passes/LUT patch staging in the processor) is
left as the follow-up the review itself recommends; the code says why.

Verified: ninja -C build-review -k 0; host ctest 89/89; GPU r4d_selftest
0 failures, kbench/kbench_moe and the card tests pass.
This commit is contained in:
Juup committed 2026-10-20 07:06:18 +00:00
1 parent 1f661bf2e0
commit 859efc7208
35 files changed
+799 -399093

No files matched your search

+4 -2
View File
@@ -1,4 +1,4 @@
/* abi_layout_table.h -- every abi/ struct's size and field offsets at RAD_ABI_VERSION 24 and
/* abi_layout_table.h -- every abi/ struct's size and field offsets at RAD_ABI_VERSION 25 and
* RAD_FORMAT_VER 2, as { type, field, offset, size } rows ("" is the struct itself). A snapshot
* of the headers on x86-64 Linux, which abi_layout_test.cpp holds the layout to; regenerate it
* from the test's printout only together with a version bump. */
@@ -24,7 +24,7 @@
{ "RadArgs", "instance", 48, 8 },
{ "RadArgs", "rank", 56, 4 },
{ "RadArgs", "world_size", 60, 4 },
{ "RadBatch", "", 0, 336 },
{ "RadBatch", "", 0, 352 },
{ "RadBatch", "phase", 0, 4 },
{ "RadBatch", "step", 4, 4 },
{ "RadBatch", "n_tok", 8, 8 },
@@ -72,6 +72,8 @@
{ "RadBatch", "gen_b", 312, 8 },
{ "RadBatch", "agen_b", 320, 8 },
{ "RadBatch", "vgen_b", 328, 8 },
{ "RadBatch", "enc_seg_h", 336, 8 },
{ "RadBatch", "enc_seg_w", 344, 8 },
{ "RadBufDecl", "", 0, 80 },
{ "RadBufDecl", "dtype", 0, 4 },
{ "RadBufDecl", "rank", 4, 4 },