Skip to content

Ring tile sweep result: N* = 2; what the kernel times say about patch 0005 - #211

Merged
SamMausberg merged 4 commits into
mainfrom
drafter/ring-tile-sweep-results
Oct 2, 2026
Merged

SamMausberg merged 4 commits into
mainfrom
drafter/ring-tile-sweep-results

Conversation

@SamMausberg

@SamMausberg SamMausberg commented Oct 2, 2026 •

Copy link
Copy Markdown
Owner

The kernel sweep that #180 and #185 set up has run. It times the fold's ring-writing GDN verify at value tiles 4, 8, 16 and 32 for blocks 16 and 8 and batches 1-64, to find the batch above which patch 0005's narrow tiles stop paying (#167's trade-off). This PR adds the result, a derived estimate of what the kernel times mean for served throughput, and the threshold check Codex asked for on #185.

The run

run_ring_tile_sweep.sh, one exclusive hold, 2026-10-02 14:48-14:50 UTC; repository d9d2e02 and engine engine/drafter 9292abd874 (bd66ce343e + 0001-0005), both with no modified files; foreign CPU load 0.155 cores on average (largest one-second sample 0.87). Files in evidence/drafter/ring_tile_sweep/; sweep.json, provenance.txt and cpu_load.json are the hold's own outputs, copied unchanged.

Validity, checked before reading N*:

  • The run used the declared configuration: blocks 16 and 8, the 13 declared batches, tiles 4, 8, 16 and 32, 24 layers, 50 replays per measurement, 4 repeats (sweep.json: the grid in rows, shape.layers, iters, repeats), with one row per tile and one stock row at each of the 26 points. ring_tile_cycle_estimate.py checks this mechanically and applies the declared rule to the rows again; it reproduces the recorded threshold.
  • Every tile's verify output and ring contents were bitwise equal to tile 32's at every point (random inputs, one layer).
  • From code reading (sweep.json does not record warps): forcing a tile keeps the selection's warp count, 1 for both tiles at 9292abd874, so tile 32 is the ring verify's launch under 0001-0004 and tile 4 its launch under 0005.
  • The median repeat range is 0.6% of its median; the largest is 6.5%.

Result (measured)

By the declared rule, N* = 2 on both blocks. Tile 4 takes 0.54-0.70 of tile 32's time at one and two sequences, in every repeat, and is slower from three sequences on (1.09 at N = 3, 3-40% slower over N = 3-64, at least 19% from N = 16). Under rule 5 that is neither 0 nor 8 or more, so the kernel timing agrees with #167's served A/B, and the declared reading allows a restricted patch: tile 4 for the ring-writing verify at N ≤ 2, tile 32 above. It has not been built.

Tile 16, outside the declared reading, is the fastest tile at most batches from 4 up (6-16% below tile 32 from N = 12). It passed this sweep's bitwise gate but no parity or served exactness check, so the declared rule leaves it out.

What it says about the fold's tile choice (derived)

cycle_estimate.json multiplies the per-layer difference by 24 layers at N = c and sets it against the wall time per cycle of #133's fold runs (W = c x tau / y). The measured column is the patch-0005 session's fold y over #133's, which is unpaired; stock's ratio between the same two sessions (0.994-1.007) is the drift.

block c per cycle, tile 4 vs 32 predicted fold y, tile 4 / 32 measured, 0005 / #133
16 1 -319 µs 1.050 1.047
16 2 -235 µs 1.032 1.025
16 4 +62 µs 0.993 1.013
16 8 +435 µs 0.966 0.963
16 16 / 32 +672 / +1,103 µs 0.965 / 0.966 not timed
8 1 -160 µs 1.026 1.030
8 2 -118 µs 1.018 1.013
8 4 +29 µs 0.996 1.002
8 8 +201 µs 0.980 0.979
8 16 / 32 +294 / +460 µs 0.978 / 0.978 not timed

The estimate assumes every cycle runs at batch c and that the microbenchmark's time per layer is the verify's time inside the model; the README states both.

Code

  • ring_tile_rule.py (new, no torch): the declared configuration and threshold rule, moved out of gdn_ring_tile_sweep.py, which now applies them to its own report. The threshold is withheld (n_star null, with differences naming each parameter) from any run whose blocks, batches, tiles, layer count, iterations or repeats differ from the declared ones. This handles Codex 4162912791 on Drafter: ring tile sweep pre-registration (declared threshold rule, rotated tile order, failed runs to sweep.failed.json; #167 README rounding) #185 (repeats other than 4 still produced n_star), which was deferred to this PR. The rule itself is unchanged; the README's declared-reading section gains a paragraph listing the full configuration and saying what changed.
  • ring_tile_cycle_estimate.py (new, CPU): the sweep check and the derived estimate above. It refuses a sweep off the declared configuration or with a missing or repeated grid point, with a bitwise failure or with a threshold the rule does not reproduce, and a session point with invalid runs, before writing anything.
  • The threshold tests now load the torch-free module, so they run in the CPU venv; new tests cover each declared parameter, the rows-derived configuration and the estimate's arithmetic and refusals.
  • The sweep's stated duration is corrected (about 2 minutes, not 13).

The #167 README cells that main rounded twice (block 16 c = 1 stock/fold 870/887; block 16 c = 2 ratio 1.011) were already corrected on main by #185, so nothing changes there.

Checks

  • pytest tests/test_drafter_tools.py at b332520: 24 passed, 1 skipped in the CPU venv; 25 passed in the SGLang venv.
  • pre-commit run --files on every changed file: clean.
  • ring_tile_cycle_estimate.py on the committed evidence reproduces cycle_estimate.json (generated at d6d7932, the latest code commit, with no modified files).
  • Not run: the sweep script itself after the refactor (it needs the GPU). --help and the tiles check run in the SGLang venv; the report path that calls the rule is covered only by reading.

Review rounds

  • Codex 4167047313 (validate every point of the grid, not only the global sets): valid, fixed in d6d7932. grid_problems() requires exactly one ring row per tile and one stock row at every (block, batch) point; threshold_for_config() and the estimate's sweep check add its findings. The committed sweep passes unchanged; a new test removes tile 16 at one point and repeats a stock row.
  • Reviewer 1, optional items, both taken in b332520: "account for / explains" is now "consistent with", since the 0.7-point agreement equals the stock drift between the sessions; the warp-count statement is labelled as code reading.

…erved-cycle estimate

The declared rule and configuration move to ring_tile_rule.py (no torch), which the
sweep applies to its own report. The threshold is now withheld (n_star null, with
`differences` naming each parameter) from any run whose blocks, batches, tiles, layer
count, iterations or repeats differ from the declared ones, not only from other grids
(Codex 4162912791 on #185: repeats other than 4).

ring_tile_cycle_estimate.py (derived, CPU) checks a sweep report against the declared
configuration and threshold, then turns its kernel times into the change in the fold's
served cycle and throughput by tile, block and concurrency, against the served sessions
with tile 32 (#133) and tile 4 (patch 0005). The threshold tests now run without torch.
…for patch 0005

evidence/drafter/ring_tile_sweep/: the hold's sweep.json, provenance.txt and cpu_load.json
(2026-10-02 14:48-14:50 UTC, repository d9d2e02 and engine 9292abd874, both clean; foreign
CPU 0.155 cores), and cycle_estimate.json from ring_tile_cycle_estimate.py at 7ddbbb0.

The run used the declared configuration and passed the bitwise gate at every point. Tile 4
beats tile 32 at one and two sequences on both blocks and loses from three, so N* = 2.
Scaled to the served cycle, the kernel times reproduce the fold's shift between #133 and
the patch-0005 session at c = 1, 2 and 8 within 0.7 points; block 16 at c = 4 is 2 points
off. README: the result section, the declared configuration in full, and a pointer from
the 0005 section.
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 2, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-02T15:18:52.653358Z b332520 Manual request
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@SamMausberg

Copy link
Copy Markdown
Owner Author

@codex review

@SamMausberg

Copy link
Copy Markdown
Owner Author

Verdict: APPROVE (head 77fc77f; provisional on Codex, which is running on this head)

No blocking items. Two optional wording items are at the end.

Validity

  • Raw outputs. sweep.json, provenance.txt and cpu_load.json are byte-identical to the hold's outputs in ~/vp-data/drafter/ring-tile-sweep/, written 14:50 UTC.
  • Pins. Repository d9d2e02 and engine 9292abd874, both with 0 modified files. The hold worktree ~/vp-wt/drafter-run3 is still at d9d2e02 and clean.
  • Pre-registration order. The rule was declared at d9d2e02 (04:36 UTC) and merged with Drafter: ring tile sweep pre-registration (declared threshold rule, rotated tile order, failed runs to sweep.failed.json; #167 README rounding) #185 at 04:43, ten hours before the 14:48 run.
  • Declared configuration. sweep.json has blocks 8 and 16, the 13 declared batches, ring tiles 4, 8, 16 and 32, shape.layers 24, iters 50, repeats 4, and four repeats in every one of the 130 rows. These match the script's defaults at d9d2e02 (tiles [4, 8, 16, 32], layers 24, iters 50, repeats 4), as the README's added paragraph says.
  • Bitwise gate. All 104 ring rows have bitwise_vs_bv32 true. The 26 stock rows carry no comparison, and bitwise_failures is empty.
  • Load and repeats. Foreign CPU averaged 0.155 cores (largest sample 0.87). The GPU held 5 MiB at the start. The median repeat range is 0.61% of the median and the largest is 6.51% (stock verify, block 16, N = 1), as stated.

The result, recomputed from sweep.json

  • Tile 4 against tile 32 (ring path):
    • at N = 1 and 2: 0.542 and 0.672 on block 16, 0.568 and 0.697 on block 8, with tile 4 ahead in every repeat (its slowest repeat beats tile 32's fastest);
    • at N = 3: 1.094 and 1.086;
    • over N = 3-64: 1.033-1.404;
    • from N = 16: at least 1.193.
  • The rule. Applying it to the rows gives N*_16 = N*_8 = 2. The declared_threshold body in ring_tile_rule.py is identical to d9d2e02's, character for character, so moving it changed nothing.
  • Tile 16. It is the fastest tile at every N ≥ 4 except block 8 at N = 8. At N = 8 it is within 0.4% of tile 32, and from N = 12 it takes 0.839-0.936 of tile 32's time.
  • Stock verify against tile 32: 1.87-2.03 at N = 8 and from N = 16, and 1.51-1.52 at N = 12.

The README tables match the rows.

The derived estimate

  • Regeneration. ring_tile_cycle_estimate.py on the committed inputs reproduces cycle_estimate.json, apart from the recorded commit (7ddbbb0 committed, 77fc77f in my run; experiments/ and tests/ are identical between the two).
  • Hand checks.
    • Block 16 at c = 1: 24 × (15.7 - 29.0) µs = -319 µs, and 6.72 / (6.72 - 0.319) = 1.050.
    • Agreement: every prediction at c = 1, 2 and 8 is within 0.7 points of its measurement, and the stock drift is 0.994-1.007.
    • The block-16 c = 4 gap: 2.0 points, about 0.18 ms of a 9.27 ms cycle.
    • The predicted cost at c = 16-32: 1.094 × 0.965 = 1.056 and 1.120 × 0.966 = 1.082.
    • The restricted rule: 0.968 × 1.050 = 1.016 and 0.983 × 1.032 = 1.014.
    • Tile 16 is worth 0.6-1.6% at c = 16-32.
  • Labels. The estimate is labelled derived. The measured column is labelled unpaired, with the drift beside it. Both assumptions (batch c in every cycle, and the microbenchmark's time per layer standing for the in-model time) are stated, and the restricted rule and tile 16 are marked not measured and outside the declared reading.

Codex 4162912791 (from #185)

Handled. threshold_for_config withholds n_star and lists every differences entry whenever the blocks, batches, tiles, layers, iterations or repeats differ from DECLARED. report_config reads the grid from the rows, and a row with a different repeat count makes repeats a list that never matches. The sweep script now calls it on its own report. The new tests cover each parameter and the rows-derived configuration, and the estimator refuses a sweep that is off the declared configuration, has a bitwise failure, or has a threshold the rule does not reproduce.

Checks

tests/test_drafter_tools.py: 23 passed, 1 skipped (CPU venv). Pre-commit on all 11 changed files is clean, including mypy and shellcheck. The author and committer are Samuel Mausberg, with no attribution lines, and the hostname grep on the delta is clean.

Optional

  1. "The kernel times account for 0005's served effect at c = 1, 2 and 8" and "the ring-writing verify's kernel time explains it": the agreement window (0.7 points) is the size of the stock drift between the unpaired sessions (up to 0.7%), so "is consistent with" says what is shown. The block-16 c = 4 miss is the reminder.
  2. Validity: "Forcing a tile keeps the selection's warp count (1 for both tiles at the pin)" is not recorded in sweep.json. Say it comes from the code (gdn_ring_tile_sweep.py and the selection at the pin), or record the warp count in a future run.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 77fc77f4f1

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment on lines +33 to +35
'blocks': sorted({r['T'] for r in rows}),
'batches': sorted({r['N'] for r in rows}),
'tiles': sorted({r['BV'] for r in rows if r['path'] == 'ring'}),

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Validate every point in the declared tile grid

report_config() compares only the global sets of blocks, batches, and tiles, so it does not establish that every (T, N) contains every declared tile exactly once. For example, deleting the BV=16 row at (16, 1) still makes check_sweep() return no problems because BV=16 exists elsewhere and the threshold only reads BV=4/32; the generated kernel table and served estimate then silently omit tile 16 at that point while claiming the declared configuration was checked. Validate the complete Cartesian grid (and row uniqueness, including the stock row) before accepting the report.

Useful? React with 👍 / 👎.

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Valid; fixed in d6d7932. For this sweep it changes nothing (the committed sweep.json has exactly one ring row per tile and one stock row at each of the 26 points), but the check claimed more than it verified. ring_tile_rule.grid_problems() now requires every (block, batch) pair the rows name to have exactly one ring row per tile and exactly one stock row, and reports repeated rows. threshold_for_config() adds those findings to differences (so n_star is null), and check_sweep() in the estimate refuses the report. A new test removes tile 16 at (16, 1) and repeats a stock row; both are caught while the global sets still match. cycle_estimate.json regenerated at d6d7932 with unchanged content.

…ck row at every point

The global sets of blocks, batches and tiles cannot show a tile missing at a single point:
deleting tile 16's row at (16, 1) left check_sweep() clean (Codex on #211). grid_problems()
now requires every (block, batch) pair of the rows to have exactly one ring row per tile
and exactly one stock row; threshold_for_config() and the estimate's sweep check both add
its findings to the differences. The committed sweep passes it unchanged.
…arp count from code reading

The prediction agrees with the measured fold shift within 0.7 points, which is also the stock
drift between the two unpaired sessions, so the README says the kernel times are consistent
with 0005's served effect rather than that they account for it (reviewer). The warp-count
statement is labelled as code reading, since sweep.json does not record warps. The validity
list states the per-point grid check; cycle_estimate.json regenerated at d6d7932 (content
unchanged apart from the recorded commit).
@SamMausberg

Copy link
Copy Markdown
Owner Author

@codex review

@SamMausberg

Copy link
Copy Markdown
Owner Author

Verdict: APPROVE (head b332520; provisional on Codex, which is running on this head)

This is a delta review of 77fc77f..b332520: two commits, one for Codex P2 4167047313 and one for my two optional wording items.

  • d6d7932, the grid check. grid_problems() counts rows by (block, batch, path, tile). It flags any repeated row, any (block, batch) point the rows name that lacks a ring row for one of the tiles the rows name, and any point without exactly one stock row. threshold_for_config() and the estimate's check_sweep() add these findings to the differences, so n_star is withheld and the estimate refuses. That closes the gap Codex described: a tile missing at one point while the global sets still match. The committed sweep.json passes, as I counted at 77fc77f: 26 points, each with one ring row per tile and one stock row. The new test removes tile 16 at (16, 1) and repeats a stock row. The reply (4167074632) answers the thread.
  • b332520, wording. "Consistent with" now replaces "account for / explains", and the README says the 0.7-point agreement is as close as the 0.7% stock drift allows. The warp-count statement is labelled as code reading (_select_recurrent_launch_config at 9292abd874; sweep.json records no warps). The validity bullet states the per-point grid check.
  • Regeneration. ring_tile_cycle_estimate.py at b332520 reproduces cycle_estimate.json, apart from the recorded commit (d6d7932, the code commit; experiments/ and tests/ are unchanged after it).
  • Checks. tests/test_drafter_tools.py: 24 passed, 1 skipped (CPU venv). Pre-commit on the six changed files is clean. The author and committer are Samuel Mausberg, with no attribution lines.

Everything I checked at 77fc77f still holds. This approval becomes final once Codex is clean on b332520.

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Breezy!

Reviewed commit: b3325204be

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@SamMausberg
SamMausberg merged commit a5c82d4 into main Oct 2, 2026
SamMausberg added a commit that referenced this pull request Oct 2, 2026
drafting.tex, app:verify-state: the kernel microbenchmark locates the
crossover of the fold's narrow tiles at two sequences (tile 4 takes
0.54-0.70 of tile 32's time at one and two, 1.03-1.40 times from three to
64; declared rule, N* = 2). The served-cycle estimate is derived; it is
consistent with the unpaired sessions within stock's drift (0.7 points),
misses block 16 at c = 4, and puts the patch's cost at c = 16-32 at
3.4-3.5% (block 16) and 2.2% (block 8). The restricted rule (narrow
tiles up to two sequences) is not built. Also the per-layer times at one
sequence and evitem drafter-ring-tiles. The optional levers-table clause
is left out: with it the table is 14 pt taller than the page.
SamMausberg added a commit that referenced this pull request Oct 2, 2026
Notes and appendices: fold #211 and #213, and state every unmeasured result as such
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant