Archived
vocabulary: hc_project -- a control vector's direction, projected out of the wide stream
h[s] -= scale * (h[s] . v) * v for each of the hyper-connection streams s llama.cpp's --cvec-mode project semantics: the dot is per stream, because the patch applies it to the [n_embd, hc, tokens] view where mul_mat(v, cur) reduces over dim 0. v is one layer's unit direction (f32), scale is the norm its file stored, and 'on' is a per-row int32 switch: a zero row is skipped without a read or a write, so an unprojected request is byte-identical to a deployment with no vector loaded. libref is the oracle and the host fallback, libavx carries it at every ISA level, libr4d (one workgroup per (row, stream), LDS reduction) serves the card. docs/OPS.md gains the row and the operation's three facts.
This commit is contained in:
1 parent
64adee3ece
commit
459dd4f42d
14 files changed
+362
-11
No files matched your search
@@ -480,6 +480,16 @@ static const RadOperandSpec oGdnConvRecurrentUpdate[] = {
|
||||
/* 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 experimental speed projection (libr4d/r4d_hc_project.hip): a bf16 stream, one unit f32
|
||||
* direction per layer, an int32 switch per row. */
|
||||
static const RadParamSpec pHcProject[] = { P_INT("M"), P_INT("n"), P_INT("hc"), P_F64("scale"),
|
||||
P_STR("dtype") };
|
||||
static const RadOperandSpec oHcProject[] = {
|
||||
{ "h", RAD_OPD_INOUT, 0 }, { "v", RAD_OPD_IN, 0 }, { "on", RAD_OPD_IN, 0 },
|
||||
};
|
||||
static const RadConstraint cHcProject[] = {
|
||||
C_GE("M", 1), C_GE("n", 1), C_GE("hc", 2), C_LE("hc", 8), C_IN("dtype", "bf16"),
|
||||
};
|
||||
static const RadParamSpec pHcPlain[] = {
|
||||
P_INT("M"), P_INT("n"), P_INT("hc"), P_STR("dtype"),
|
||||
};
|
||||
@@ -2934,6 +2944,12 @@ static const RadOpSchema kSchemas[] = {
|
||||
"the read half of a gated residual: a grouped rmsnorm, a low-rank sigmoid gate, and "
|
||||
"the mean of the gated streams -- plus the per-branch write gains and, optionally, "
|
||||
"the block-scaled fp8 form of the block input and its Hadamard-rotated twin."),
|
||||
SCHEMA("hc_project", pHcProject, oHcProject,
|
||||
"the experimental speed projection (llama.cpp's `--cvec-mode project`): for each of the "
|
||||
"hc streams of a row whose `on` flag is 1, h[s] -= scale * (h[s] . v) * v, v that "
|
||||
"layer's unit direction and scale its stored norm. A row whose flag is 0 is neither read "
|
||||
"nor written, so an unprojected request is byte-identical to a deployment with no "
|
||||
"vector loaded."),
|
||||
SCHEMA("hc_write", pHcPlain, oHcWrite,
|
||||
"the write half: h[s] += inj[s] * y, into the UNNORMED stream."),
|
||||
SCHEMA("mtp_enter", pMtpEnter, oMtpEnter,
|
||||
@@ -6510,6 +6526,15 @@ R4D_WIN_PAIR(512, 1) R4D_WIN_PAIR(512, 2) R4D_WIN_PAIR(512, 4) R4D_WIN_PAIR(512,
|
||||
nullptr, nullptr, r4d_rad_hc_write, nullptr, nullptr, nullptr,
|
||||
r4d_shape_hc_write },
|
||||
|
||||
{ "hc_project_bf16", "hc_project", "norm",
|
||||
"speed projection: h[s] -= scale * (h[s] . v) * v where the row's flag is on",
|
||||
"any M, any n, hc 2..8",
|
||||
"bf16 stream, f32 direction, i32 switch",
|
||||
RAD_DOMAIN_DEVICE, R4D_PRIO_ONLY,
|
||||
ROW(cHcProject), NOTUNE,
|
||||
nullptr, nullptr, r4d_rad_hc_project, nullptr, nullptr, nullptr,
|
||||
r4d_shape_hc_project },
|
||||
|
||||
{ "mtp_enter_bf16", "mtp_enter", "norm",
|
||||
"MTP head entry: two norms, a per-sub-stream fc and one broadcast fc",
|
||||
"any M, n 128..5734, hc 2..4",
|
||||
|
||||
Reference in new issue
Block a user