round 38 track a: qsa caches and mtp prefill #
shipped #
patch: /tmp/astra_r38_qsa/astra_r38_qsa.patch (not applied to vendor).
metal/src/engine/window.cpp: absentSTRATA_METAL_MTP_PREFILL_TAIL, prefill now usesSTRATA_METAL_MTP_WINclamped to [64, 2050], default 256. explicit prefill overrides still have only the existing lower bound of 64. initialization stays function-local/static. kept inside the assigned prefill boundary rather than introducing a shared helper outside ownership.metal/tests/qsa_parity.cpp: adds nt=3 to the existing--abdecode suite, retaining 1/2/4/8 and prompt 1984/2048.- no shader change retained. both proposed caches were bitwise exact but failed the performance gate.
qsa_scoreis already fully unrolled; multi-token reuse was not implemented or claimed measured.
experiment #
apple m5, isolated /tmp/astra_r38_qsa/strata, baseline shaders frozen under ref/. no server requests, no model loads, no full-model benchmark. gpu runs serialized. each test invocation finished below 15 seconds (slowest 14.432 seconds); cold compile limit 20 seconds was available. source fingerprints: sha256.json.
built with:
cmake -S /tmp/astra_r38_qsa/strata/metal -B /tmp/astra_r38_qsa/strata/build-metal -G Ninja
cmake --build /tmp/astra_r38_qsa/strata/build-metal --target qsa_parity qsa_prompt_parity -j 4
baseline self-comparison: baseline.log, full-buffer memcmp pass; top-k ratio 1.0050 at p=3000, nt=3.
candidates (snapshots retained):
contiguous.metal: eight keys per thread for nb<=8192, contiguous block assignment shared across four radix and two emit passes. fallback preserved.strided.metal: eight coalesced/strided radix keys for nb<=8192 plus eight emit keys reused between the emit passes. fallback preserved.
paired qsa_parity --ab /tmp/astra_r38_qsa/ref P ran for P=3000,10180,30000; each includes nt=1,2,3,4,8 and prep-only prompt nt=1984,2048. all full-output-buffer memcmp comparisons passed for both variants.
median paired top-k candidate/reference ratios (nt=1 / 3 / 4):
| candidate | p=3000 | p=10180 | p=30000 |
|---|---|---|---|
| contiguous | 1.0413 / 1.0301 / 0.9616 | 1.0421 / 1.0464 / 1.0355 | 0.9902 / 0.9950 / 0.9948 |
| strided + emit | 1.0772 / 1.0766 / 1.0757 | 1.1299 / 1.0872 / 1.1191 | 1.0639 / 1.0510 / 1.0639 |
reject both: contiguous regresses at 10180; strided regresses at both 10180 and 30000. no confirmation run needed to ship a rejected variant. timings elsewhere varied with device state, so tiny gains are not evidence of a win. no claim that fewer source-level loads imply faster execution. detailed stage timings: contiguous-ab-{P}.log, strided-ab-{P}.log.
final verification #
all commands exited 0:
qsa_parity P, P=3000,10180,30000: standard cpu-reference tolerances pass (final-parity-{P}.log).qsa_prompt_parity: all standard tolerance checks pass; qcurh and qsa_flash fusion memcmp pass (final-prompt-parity.log). standard fp16-vs-fp32 attention checks are tolerance checks, not bitwise equality.qsa_parity --ab /tmp/astra_r38_qsa/ref P: all full-buffer memcmp checks pass, including nt=1,3,4, for all three contexts (final-ab-{P}.log). final shaders are identical to baseline; timings here are self-comparison noise, not a performance claim.qsa_prompt_parity --ab T P /tmp/astra_r38_qsa/ref/qsa_prompt.metal /tmp/astra_r38_qsa/ref/qsa.metal 3: nine combinations, T=1,3,4 and P=3000,10180,30000, all memcmp pass (final-prompt-ab-{P}-{T}.log). this suite covers prompt prep/score, not qsa_topk2.- exact extracted prefill initializer compiled with
c++ -std=c++17; nine separate-process env checks pass: unset=256, win512=512, win1024=1024, win1=64, win9999=2050, invalid win=64, win1024+tail512=512, tail1=64, tail4096=4096. source/log:tail_policy.cpp,tail-policy.log. this is a policy-expression test, not model integration. git -C vendor/strata apply --check /tmp/astra_r38_qsa/astra_r38_qsa.patch: exit 0.
final review: reviewed the complete two-file diff with view_diff using a scratch baseline repo. no tracked vendor files edited. host engine/model integration not built or exercised; isolated cmake built only the two standalone parity targets. all evidence paths not otherwise qualified are under /tmp/astra_r38_qsa/.