arch/common: GLM KDA issues both low-rank down-projections before either up-projection -- one ordered point fewer a layer

A KDA layer projects its input seven times: qkv, beta, the two rank-128 down-projections into
the forget and gate paths, their two up-projections, and the output. The block issued forget's
down- and up-projection, then gate's: a recorded pass orders the input's four readers, then
forget_b, then gate_a reading the input again, three ordered points where two would do. Both
down-projections now issue before either up-projection, in declare as in step, because the
buffer plan takes lifetimes from the declaration order and forget_low and gate_low must not
share bytes while both are live. The same GEMMs over the same operands, so the bytes are the
same; the pinned step hashes move with the order (world 1 0x906897570034f5f5 /
0x68ffc03d2b640d51, world 8 0x9f39f6f7a04dc4d3 / 0x3818eedb4ac10d1b), and the block's test holds
the four readers first.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
This commit is contained in:
NunzeandClaude Opus 5.5 committed 2026-10-21 15:26:57 +02:00
1 parent f909576d09
commit b86b25e406
2 files changed
+16 -6

No files matched your search

+7 -2
View File
@@ -1234,6 +1234,11 @@ TEST(glm_kda_projects_local_heads_and_reduces_only_after_the_output_projection)
CHECK_EQ(std::count(ops.begin(), ops.end(), "gemm_nt"), 7);
CHECK_EQ(std::count(ops.begin(), ops.end(), "silu"), 0);
REQUIRE_EQ(ctx.issues.size(), (size_t)11);
// The input's four readers first, then both up-projections.
CHECK_EQ(ctx.issues[2].op, block.forget_a.op);
CHECK_EQ(ctx.issues[3].op, block.gate_a.op);
CHECK_EQ(ctx.issues[4].op, block.forget_b.op);
CHECK_EQ(ctx.issues[5].op, block.gate_b.op);
CHECK_EQ(ctx.issues[9].op, block.output.op);
CHECK_EQ(ctx.issues[10].op, block.op_ar);
CHECK_EQ(ctx.issues[10].opd[0].handle, w.out);
@@ -1351,8 +1356,8 @@ TEST(glm53_is_the_pinned_graph_and_steps) {
int world;
uint64_t graph, steps;
};
const Case cases[] = { { 1, 0xed3fc26c486ea1b5ull, 0x33e5f136f0dbba15ull },
{ 8, 0x712f01858dbe1047ull, 0xf9e357b1333c638full } };
const Case cases[] = { { 1, 0x906897570034f5f5ull, 0x68ffc03d2b640d51ull },
{ 8, 0x9f39f6f7a04dc4d3ull, 0x3818eedb4ac10d1bull } };
for (const Case& cs : cases) {
RadBuilder b;
b.kv_block = 4;