round 33 track b: decode qsa attention and top-k #
decision: no ship #
none of six candidates meets the predeclared acceptance rule: bitwise parity plus a reproducible >=3% attention improvement without material shape regressions. production files were never edited. qsa_score was unchanged; this experiment evaluated the proposed attention and top-k changes only.
/tmp/sol_r33_qsa/sol_r33_qsa.patch is intentionally empty. it passes git -C vendor/strata apply --check --allow-empty /tmp/sol_r33_qsa/sol_r33_qsa.patch; ordinary apply --check requires a nonempty patch and is not applicable to a no-change outcome. do not apply the separately labelled rejected patches.
setup and contract #
- local apple m5, as reported by qsa_parity. live server and :8080 untouched; no model benchmarks.
- baseline vendor head:
296b59d2f73c8f04a805df29c2fa97655adace78, plus current working-tree kernel snapshots captured before edits. - immutable baseline:
/tmp/sol_r33_qsa/reference/. - qsa.metal sha256:
d2d3f311030eae507ab83148afe267b7746a15ac2231aa50aa0a22cc4403db4c - qsa2.metal sha256:
1e1937f95e2224ce09944c8cb549af82edc02a0ab38a1cceeb203f4f7b58d59b - existing
vendor/strata/build-metal/qsa_parityexecutable; no evaluator edits or rebuild needed. - kernels selected through
STRATA_METAL_KERNELS=/tmp/sol_r33_qsa/strata/metal/kernels; attention selected withQSA_ATTN=1or2. - each benchmark invocation ran serially, normally <0.4 s; broad bitwise invocations each ~1.3 s. no invocation exceeded 10 s.
- timing method: existing paired benchmark, alternating order, median of nine rounds, 16 repeated dispatches; random bitwise mode uses 32 repeated dispatches.
- source snapshots and logs for every explored candidate retained under
/tmp/sol_r33_qsa/. scratch kernels restored to baseline after experiments.
candidates #
all candidates include the proposed final top-k pass cache (k_local[4], fallback for per > 4):
allscale: precomputed row index, half4 key/value scales preloaded before existing barrier; v1 value pointer/scale offset hoisted.vsonly: as above but preload only value scales.rowonly: precompute row index, no scale staging.byteoffset: store row byte offset rather than row index, no scale staging.ksonly: precomputed row index plus key scale staging only.alias(parent-requested follow-up): value scales alias deadqsstorage after the post-q.k barrier, populated before the existing post-softmax barrier. no extra threadgroup storage or barriers. passes paired pos0=3000 ntok=1/2/4/8 on both versions, but attn1 still regresses (n=4: 162.943 / 165.719 us; n=8: 320.544 / 326.474 us), and attn2 regresses at n=8 (379.219 / 381.766 us). this rules out added threadgroup storage as the sole explanation of this regression; no profiler evidence establishes a precise cause.
correctness #
allscale: all 24 paired cases passed full-buffer memcmp (13 buffers), covering both attention versions, pos0=37/2048/3000, ntok=1/2/4/8.allscale: both random-input bitwise suites passed: 0/40 differences for each version, 80/80 total. these cover pos0=0,1,63,64,512,2047,2048,2050,8192,30000 and ntok=1/2/4/8; both partial attention and merged output are compared by memcmp.- other candidates: paired pos0=3000 at ntok=1/4/8 passed for both versions. no equivalence claim beyond these tested shapes.
- final-cache
per > 4path was not independently exercised for topk; no topk change ships.
measured results #
representative confirmation at pos0=3000; microseconds, reference / candidate:
| candidate | kernel | ntok=1 | ntok=4 | ntok=8 |
|---|---|---|---|---|
| allscale | attn1 | 46.659 / 47.404 | 163.211 / 166.000 | 321.250 / 326.747 |
| allscale | attn2 | 50.935 / 50.180 | 193.630 / 191.810 | 380.570 / 380.727 |
| byteoffset | attn1 | inconclusive clock transition | 162.992 / 162.130 | 322.190 / 320.750 |
| byteoffset | attn2 | 50.802 / 50.852 | 193.391 / 192.997 | 379.760 / 378.534 |
allscale consistently makes attn1 ~1.6–1.8% slower; attn2 gains ~1–2% at small windows but disappear at ntok=8. value-only staging behaves similarly. key-only staging does not establish an improvement. row-only and byte-offset changes yield roughly 0–0.6% gains on stable longer-window measurements, below the planned selection threshold.
top-k differences are small and inconsistent, with occasional much larger apparent clock/thermal transitions affecting both reference and unchanged stages. for example allscale confirmation attn1 topk at n=1/4/8 was 8.250/8.156, 13.677/13.687, 8.289/8.086 us; initial same-shape results did not establish a repeatable win. do not infer a top-k speedup from isolated favorable samples. the baseline same-versus-same smoke was effectively equal (attn1 162.992 / 162.904 us at n=4).
reproduction and evidence #
STRATA_METAL_KERNELS=/tmp/sol_r33_qsa/strata/metal/kernels QSA_ATTN=1 \
vendor/strata/build-metal/qsa_parity --paired /tmp/sol_r33_qsa/reference 3000 --tokens 4
STRATA_METAL_KERNELS=/tmp/sol_r33_qsa/strata/metal/kernels QSA_ATTN=2 \
vendor/strata/build-metal/qsa_parity --bitwise /tmp/sol_r33_qsa/reference/qsa2.metal
copy the two kernels from the named candidate snapshot (allscale/, byteoffset/, etc.) into scratch strata/metal/kernels/ first; the final scratch tree deliberately equals baseline. logs: allscale_av*_p*_n*.log, bitwise_av*.log, confirm_*.log, and candidate-specific logs. rejected diffs: *.rejected.patch. experiment contract: plan.md.
this is a valid negative performance result, not a failed implementation: the suggested transformations preserve tested outputs, but do not justify a production change on this m5.