# round 35 track b — experiment contract

owner: prompt.metal owns fused tile execution; hc_read owns dispatch selection. no shared interfaces or layouts change. all edits and builds stay in /tmp/sol_r35_prompt/strata.

question: do sg=2 hc-up shapes and single-descriptor row tails improve m5 latency without changing a single output bit?
baseline: current vendor/strata prompt.metal, archived under /tmp/sol_r35_prompt/baseline.
evaluator: comb_fold_parity, production mixed-unbound hc-up, short standalone invocations only. initial sweep selects shapes; interleaved confirmation must show a repeatable improvement before any dispatch change. row-tail comparisons use baseline-vs-candidate ab mode, including full tiles. any bit mismatch rejects the variant; noisy or regressed ranges keep the baseline. no full model runs, no :8080 access, no subagents. per invocation <10s, cold compile timeout 20s.

planned evidence: hc-up parity at 256,1983,2048; shape timings at 192,306,384,512,1024,1983,2048; epi sweep, aggregate 1024 and ab 289,306,512,1024,1983,2048. gpu tests serialized to avoid self-contention.

## decision and integration status

**candidate for parent's quiet-gpu confirmation**, not an unconditional performance sign-off. patch: `/tmp/sol_r35_prompt/sol_r35_prompt.patch`; `git -C vendor/strata apply --check` and scratch `git diff --check` both exit 0. no tracked vendor file was edited.

retain only hc-up register row trimming: one inline tile helper, original grid stride retained, tail descriptor TM=16 when <=16 rows remain, TM=32 for larger register tiles when <=32 rows remain. non-register fallback retains original descriptors. arithmetic and output guards stay unchanged. the extra shared-memory pointer is only used by the existing non-register path. no window.cpp changes: existing 32_128_4 wins every tested t range.

rejected sg=2 shapes remain **test-only** instantiations, avoiding unused production pipelines. evaluator now checks/times all 10 register shapes, both mixed bindings, using the correct sg*32 threads. its a/b hc-down selector is repaired to match production at t<=384 (old evaluator wrongly used 32_128_4 there). this repair is retained even though hc-down optimization is rejected.

hc-down/sw-up row trims are not in the patch: they passed parity, but repeated quiet production-tile gains were not established before GPU sharing resumed. full prototype is archived as `candidate-all-rows-final.metal`.

## sg=2 sweep (negative result)

all shapes pass 100% bitwise at t256 and every benchmark t, including 1983/2048. exploratory metric is minimum of 3 x 48 dispatches after warmup. values below are ms/48 with **mixed unbound**:

| t | baseline 32_128_4 | 32_128_2 | 64_128_2 | 32_64_2 | 64_64_2 | 16_64_2 |
|---:|---:|---:|---:|---:|---:|---:|
| 192 | 5.459 | 6.628 | 12.043 | 5.930 | 7.507 | 7.310 |
| 306 | 8.877 | 10.000 | 20.914 | 9.584 | 11.920 | 11.509 |
| 384 | 10.698 | 12.103 | 25.028 | 11.746 | 14.062 | 14.411 |
| 512 | 14.124 | 15.819 | 33.152 | 15.557 | 18.292 | 19.058 |
| 1024 | 27.476 | 30.596 | 66.110 | 30.807 | 35.487 | 38.060 |
| 1983 | 52.899 | 59.167 | 127.859 | 59.914 | 69.661 | 75.671 |
| 2048 | 57.123 | 62.854 | 131.707 | 62.581 | 74.387 | 80.271 |

all other sg4 register tiles also lose to 32_128_4; complete tables are in `sg2-sweep-T.log`. no confirmation runs spent on losing candidates.

## row-tail evidence

initial clean paired a/b (`rows-ab-T.log`), 12 alternating samples x 8 dispatches, same inputs and swapped output buffer placement:

| t | hc-up candidate/baseline ratio |
|---:|---:|
|289|0.9761 [0.9739,0.9780]|
|306|1.0010|
|512|0.9970|
|1024|0.9914|
|1983|1.0006|
|2048|1.0017|

independent t289 confirmations `rows-prod0-ab-289.log`, `rows-prod1-ab-289.log`: ratios **0.9747**, **0.9725**, medians 0.1804/0.1850 and 0.1822/0.1874 ms. these support ~2.5% hc-up savings at a one-row tail; t306 has 18 rows and does not take the branch, so no expected win there. t297 first confirmation 0.9677, later results contaminated. full-tile results near neutral, not a claimed win.

the initial full prototype had identical hc-up register execution to the final patch; final patch removes unrelated down/sw trims and disables fallback-path row trimming. all evidence snapshots retained. parent's requested exclusive final source confirmation remains necessary.

noise: `rows-prod1-*`, `rows-prod2-*` and final logs show changed shared GPU conditions: t306 hc-up ~0.19ms -> ~1ms, ratios with very wide intervals. parent confirmed tracks a/c were concurrently running gpu sweeps and explicitly took ownership of exclusive confirmation. do not interpret these as performance evidence. no attempts to control or access the live server.

## correctness and execution record

final evaluator compiled using:

```text
clang++ -std=c++20 -O2 -I/tmp/sol_r35_prompt/strata/metal/src -I/tmp/sol_r35_prompt/strata/third_party/ggml /tmp/sol_r35_prompt/strata/metal/tests/comb_fold_parity.cpp vendor/strata/build-metal/libmtl_rt.a -framework Metal -framework Foundation -o /tmp/sol_r35_prompt/comb_fold_parity
```

all executions set `STRATA_METAL_KERNELS=/tmp/sol_r35_prompt/strata/metal/kernels`, no math overrides. source remains untouched throughout each invocation. final logs:

- `final-main1024.log`: exit 0, 7.880s (all output comparisons PASS).
- `final-epi.log`: exit 0, 1.970s (all output comparisons PASS).
- `final-hcup256.log`: exit 0, 2.284s (all output comparisons PASS).
- `final-hcup1983.log`: exit 0, 0.371s (all output comparisons PASS).
- `final-hcup2048.log`: exit 0, 0.418s (all output comparisons PASS).
- `final-ab289.log`: exit 0, 1.462s (all output comparisons PASS).
- `final-ab306.log`: exit 0, 1.107s (all output comparisons PASS).
- `final-ab512.log`: exit 0, 2.588s (all output comparisons PASS).
- `final-ab1024.log`: exit 0, 9.289s (all output comparisons PASS).
- `final-ab1983.log`: exit -15, 10.027s (timeout under shared GPU load; incomplete, not a pass).
- `final-ab2048.log`: exit 0, 9.369s (all output comparisons PASS).

final 1024, 0 epi, hcup256/1983/2048 all PASS, as do final ab289/306/512/1024/2048. **final ab1983 timed out at the 10s deadline** before GEMM comparisons; prior same hc-up register candidate `rows-ab-1983.log` passed all comparisons in 3.10s. parent must finish this final-source check on the quiet GPU. this is not hidden as a pass. all earlier invocations completed under 8s; final loaded run ab1024 took 9.29s, ab2048 9.37s. no further GPU retries are running.

first baseline attempt used an incomplete baseline kernel directory and failed before comparisons; repaired baseline-hcup256-repaired.log passes. first row prototype compile failed because threadgroup memory must be declared in a kernel, not a non-qualified inline helper; moved allocation to wrapper and fixed one stale tg reference. `rows-epi-repaired.log` passes. original failed snapshots/logs preserved.

## reproducibility and review

- vendor head: `296b59d2f73c8f04a805df29c2fa97655adace78`; actual working-tree baseline archived and locally committed in scratch, not assumed identical to head.
- `/tmp/sol_r35_prompt/baseline/metal/kernels/prompt.metal` sha256 `97a3391e86fc1fa0ba5089263e4d5bdb15e6ef4b4c2b5c375f3da5e859013921`
- `/tmp/sol_r35_prompt/candidate-final.metal` sha256 `e91f0d0dc9679de031cf7aabdbc022e3cc7dcfdf514270fc39fcb3fe4aefc2a5`
- `/tmp/sol_r35_prompt/strata/metal/tests/comb_fold_parity.cpp` sha256 `41d817810837181155bac683728f7ff04abfe7e8166099831e5e47e85537038b`
- `/tmp/sol_r35_prompt/comb_fold_parity` sha256 `ce858fe0158b810b1196d8eb16d872241f72a22fde40bf652f04ae59f4211664`
- `/tmp/sol_r35_prompt/sol_r35_prompt.patch` sha256 `24ef87c89fb094ef045f445b01975bf77536439297547c3e62657cfc32d6cc35`

visual final review used view_diff over every final change and view_code over evaluator context; searched existing tile/row helpers before keeping extraction. no unrelated file/line changes; final patch contains only prompt.metal and comb_fold_parity.cpp. no subagents, no full-model run, no :8080 access. parent owns integration and exclusive performance acceptance.
