docs, comments, tests: a consistency pass after the kernel move and the 404

Stale text that outlived the fixes around it: the deleted unit's filename in
libr4d's gated-residual comments, hc_project missing from that unit's header,
"THE SPEED PROJECTION" heading the page's control-vector code, ABI 22 comments
beside a table that says 23, a projection_test header crediting rad-kbench with a
case it does not have, a comment stating the wrong scale arithmetic, a duplicated
<cstring>, and GUIDE's "off in all cases" (the admin switch flips it). libavx's
README transcript is refreshed from a real run (807 checked, at every level).

And the test the alias order needed: a body carrying both `control_vector` and
`experimental_speed_projection`, with the field's own name winning.
This commit is contained in:
C_Tamas authored and StillDeadcode committed 2026-10-21 09:26:17 +02:00
1 parent d09d733b07
commit cd1f2f59cc
7 files changed
+28 -15

No files matched your search

+1 -1
View File
@@ -3061,7 +3061,7 @@ async function identify() {
} catch (err) { /* the header simply keeps its placeholder */ }
}
/* THE SPEED PROJECTION, asked when the Model view opens. It is not a polled value: it changes only
/* THE CONTROL VECTOR, asked when the Model view opens. It is not a polled value: it changes only
* when this page (or an admin call) flips it, and a control that silently reverted under the
* reader would be worse than one that is a second old. A deployment without a control vector
* answers 404 and the panel stays hidden. */
+1 -1
View File
@@ -1456,7 +1456,7 @@ the `control_vector` request field with nothing else to configure; every quantis
shares it, because the file names the architecture and the width, not the quant. The operation's
parameters come from the package's own JSON (`layer_range`, `scale`, `mode`), so there is no flag for
them either: a file that does not fit this container is reported and skipped, never served. The
default for *requests* stays off in all cases.
default for *requests* is off at startup.
- **Only a compatible container accepts it.** The file must be a GGUF `controlvector` whose
`controlvector.model_hint` (when present) is this model's architecture (`qwen4exp`), whose
+4 -4
View File
@@ -123,11 +123,11 @@ engine would load. It checks, in order: schema agreement (a copy of the loader's
before any arithmetic, because the loader refuses the whole plugin on one disagreement), coverage,
the numbers, and every ISA level. Each level prints:
522 checked, 522 passed, 0 failed, 0 declined, 0 skipped, 0 missing. worst rel_l2 = 3.556e-04
807 checked, 807 passed, 0 failed, 0 declined, 0 skipped, 0 missing. worst rel_l2 = 3.556e-04
worst case: rmsnorm M=3 n=645 eps=1e-05 dtype=bf16 wadd=1
522 rerun on 4 threads, byte for byte
hand-built: 198 checked, 0 failed
zero rows: 116 ops checked, 0 failed
807 rerun on 4 threads, byte for byte
hand-built: 429 checked, 0 failed
zero rows: 155 ops checked, 0 failed
against `rad-kbench`'s tolerance table, ids (i32, u32, i64 outputs) exactly; the worst case differs
per level. Every conversion is also checked exhaustively: all 256 or 65536 bit patterns of each
+2 -1
View File
@@ -1,4 +1,5 @@
// r4d_hc_bf16.hip -- the gated residual (hyper-connections): hc_enter, hc_read and hc_write.
// r4d_hc_bf16.hip -- the gated residual (hyper-connections): hc_enter, hc_read,
// hc_write and hc_project.
//
// Qwen4-Exp carries a residual stream `hc` times the model width, with no pre-norm and no residual
// add: every block reads a data-dependent mix of the hc sub-streams and writes its output back into
+3 -3
View File
@@ -477,9 +477,6 @@ static const RadOperandSpec oGdnConvRecurrentUpdate[] = {
{ "o_scale", RAD_OPD_OUT, 1 },
};
/* The gated residual. `hc_enter` and `hc_write` share a parameter list; `hc_read` adds the two
* switches its operand list depends on: `inject` 0 is the final mixer and `group` 0 a read whose
* consumer wants bf16. Both default on, as every trunk connection uses both. */
/* The control vector's projection (r4d_hc_bf16.hip, with the other gated-residual kernels): a bf16
* stream, one unit f32 direction for every stream, an int32 switch per row. */
static const RadParamSpec pHcProject[] = { P_INT("M"), P_INT("n"), P_INT("hc"), P_F64("scale"),
@@ -490,6 +487,9 @@ static const RadOperandSpec oHcProject[] = {
static const RadConstraint cHcProject[] = {
C_GE("M", 1), C_GE("n", 1), C_GE("hc", 2), C_LE("hc", 8), C_IN("dtype", "bf16"),
};
/* The gated residual. `hc_enter` and `hc_write` share a parameter list; `hc_read` adds the two
* switches its operand list depends on: `inject` 0 is the final mixer and `group` 0 a read whose
* consumer wants bf16. Both default on, as every trunk connection uses both. */
static const RadParamSpec pHcPlain[] = {
P_INT("M"), P_INT("n"), P_INT("hc"), P_STR("dtype"),
};
+5 -5
View File
@@ -14,8 +14,9 @@
* documents: h -= scale * (h . v) v per hyper-connection stream, and an untouched row where
* the mask is 0.
*
* The kernel parity check (libavx against libref, and libr4d on a card) is rad-kbench's
* `hc_project` case (libavx/avx_cases.cpp); this file pins the meaning.
* The kernel parity check (libavx against libref) is libavx/avx_cases.cpp, fed to rad-avx-check;
* libr4d's device kernel has no in-tree parity case yet (the rad-kbench fixture is still missing).
* This file pins the meaning.
*/
#include "rad_test.h"
@@ -27,7 +28,6 @@
#include <cmath>
#include <cstring>
#include <dlfcn.h>
#include <cstring>
#include <string>
#include <vector>
@@ -132,8 +132,8 @@ TEST(the_derivation_refuses_a_buffer_too_small) {
TEST(the_reference_projection_removes_the_direction_per_stream) {
/* Directly the operation the package's README states, on a synthetic stream: after one
* application every stream's component along v is scale * |d| times what it was, and with a
* unit direction at the stored scale 1 the projection is exactly h -= (h.v) v. */
* application every stream's component along v is (1 - scale) times what it was, and with a
* unit direction at the stored scale 1 it is exactly zero, i.e. h -= (h.v) v. */
const int64_t n = 8, hc = 2, rows = 2;
std::vector<float> h((size_t) (rows * hc * n));
std::vector<float> v((size_t) n);
+12
View File
@@ -4570,6 +4570,18 @@ TEST(the_control_vector_field_overrides_the_default_or_is_refused) {
CHECK_EQ(r2.status, 200);
CHECK(f.sched.last_sp.use_control_vector);
/* Both spellings in one body: the field's own name wins over Strata's alias, whichever
* order the parser happens to read them in. */
HttpResponse r3 = f.post("/v1/chat/completions",
R"({"messages":[{"role":"user","content":"hi"}],
"max_tokens":4,
"experimental_speed_projection":true,
"control_vector":false})");
if (r3.streaming()) drain(r3);
f.sched.join_all();
CHECK_EQ(r3.status, 200);
CHECK(!f.sched.last_sp.use_control_vector);
const HttpResponse g = f.get("/admin/control-vector");
CHECK_EQ(g.status, 200);
CHECK(g.body.find("\"default\":true") != std::string::npos);