Archived
dsa_score: row_part -- score one run of a step's query rows, and rebase cu for the selection after it
With `row_part` p, `score` holds R rows and row i is query row p * R + i; `q`, `q_scale` and `gate` stay the whole step's, so a run is the unsplit op's rows bit for bit. A row past the last sequence scores -inf, so every rank's run can be the same length whatever the step's. The optional output `cu_part` receives cu - p * R, under which qsa_select runs over the run's own rows (pos offset by p * R) and finds each row's sequence unchanged; qsa_select itself is untouched. This is what an indexer split over tensor-parallel ranks by query rows needs from the op: the scoring is the only per-row work in GLM-5.3's indexer that grows with the context. libr4d offsets the query operands and compares row0 + r against cu; libref and libavx index the same way. Without `row_part` nothing changes. Tests: the selftest scores each case's rows in equal runs and holds every run to the unsplit rows' bytes and cu_part to the rebased bounds; ref_test checks a run, a run past the step and a short query plane; r4d_emu_dsa (r4d_dsa.hip now runs on the emulator) splits decode rows beside a prefill chunk at 2, 4 and 8 ranks, selects with the rebased bounds and joins the runs as the all_gather does, byte for byte against the unsplit scorer and selection, ties and signed gates included. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
This commit is contained in:
1 parent
5e8bae8ae6
commit
afe5318259
13 files changed
+451
-47
No files matched your search
@@ -170,9 +170,9 @@ static const RadParamSpec pMlaProject[] = { P_INT("M"), P_INT("heads"), P_INT("h
|
||||
P_INT("latent_dim"), P_STR("mode"), P_STR("dtype") };
|
||||
static const RadOperandSpec oMlaAttn[] = { OPD("q"), OPD("kv"), OPD("bt"), OPD("length"), OUT("out") };
|
||||
static const RadParamSpec pDsaScore[] = { P_INT("M"), P_INT("n"), P_INT("heads"),
|
||||
P_INT("blocks"), P_INT("seqs"), P_STR("dtype") };
|
||||
P_INT("blocks"), P_INT("seqs"), P_STR("dtype"), P_INTO("row_part") };
|
||||
static const RadOperandSpec oDsaScore[] = { OPD("q"), OPD("q_scale"), OPD("gate"), OPD("k"),
|
||||
OPD_O("k_scale"), OPD("bt"), OPD("cu"), OPD("nc"), OUT("score") };
|
||||
OPD_O("k_scale"), OPD("bt"), OPD("cu"), OPD("nc"), OUT("score"), OUT_O("cu_part") };
|
||||
static const RadOperandSpec oDsaPool[] = { OPD("kg"), WGT("ape"), OUT("q"), OUT("scale"),
|
||||
OPD_O("page"), INOUT_O("cache") };
|
||||
static const RadParamSpec pRouterSigmoid[] = { P_INT("M"), P_INT("n_expert"), P_INT("top_k"),
|
||||
|
||||
Reference in new issue
Block a user