Skip to content

t27f token_floor: a per-frame row index, so each raster row visits only the splats that touch it (Closes #10391) - #10402

Merged
gHashTag merged 1 commit into
masterfrom
claude/tf-raster-row-buckets
Oct 18, 2026
Merged

gHashTag merged 1 commit into
masterfrom
claude/tf-raster-row-buckets

Conversation

@gHashTag

Copy link
Copy Markdown
Owner

Closes #10391

What changes

specs/t27f/token_floor.t27 builds a row index once per frame, right after the splat pass. It is a counting sort into a fixed [524288]u16 buffer that lists, for each of the 1920 rows, the splats that can touch that row, in splat order. The raster then walks only its own row's list instead of all ~42k splats.

  • The raster keeps its exact check, now a pure function touches_row. The index only skips rows that a splat cannot light. Within a row the splats stay in their original order, so the alpha-over of a ball and every float sum see the same operands in the same order, and the frames come out byte-identical.
  • New pure helpers: splat_top, splat_bot, row_lo, row_hi, span_max, index_bound. They give a conservative row range per splat, with one row of margin on each side, clipped to the frame.
  • Two new tests:
    • Index completeness. For 2 mirror modes × 4 splat kinds (dot, glow, ball, vline) × 300 centres a third of a pixel apart × all 1920 rows: every row that touches_row accepts is in row_lo..row_hi, and no splat gets more than span_max rows. The test also covers edge cases: a splat above the frame, the last row, mirror images and the ends of a vline.
    • Buffer bound. index_bound() <= INDEX_CAP, so the largest index any frame can build fits the buffer. MAX_SPLATS <= 65536, so a u16 names every splat.
  • The header comment is updated with the new timing.

Measurements

Railway lab, -O ReleaseSafe -lc, same machine and build flags for both sides:

run master this PR frames sha256
one process, run 1 51.0 s 33.0 s 7e0c6662…391e07 (both)
one process, run 2 54.8 s 35.5 s 7e0c6662…391e07 (both)
48 shards (TF_SHARD/TF_SHARDS), concatenated 3.88 s 2.82 s 7e0c6662…391e07 (both)

The expected sha 7e0c6662ddbf84a0a424c0aa119420eb34f90b0decec6e0c05753b2d37391e07 holds in all six runs. The Zig generated from the committed spec is byte-identical to the build that was timed.

The rest of the per-frame time is now mostly the per-pixel exposure and back light, which run for every pixel whether or not any splat lit it.

Verification

  • t27c test-report specs/t27f/token_floor.t27 on the lab: 26 tests, 26 pass, 0 vacuous.
  • Resealed with t27c seal --save. seal --verify reports that all hashes match (spec 073d8dfb…, tests 26/26, vacuous 0).
  • The change touches only the spec and its seal. No generated or foreign-language file is part of it, and nothing was built or run on the Mac.

🤖 Generated with Claude Code

…ly the splats that touch it (Closes #10391)

After the splat pass, a counting sort lists under each row the splats that
can touch it, in splat order. The raster walks that list and keeps its own
check (touches_row), so the index only skips rows a splat cannot light and
the bytes are those of the full scan. Two new tests: the index lists every
row the check accepts (1200 centres, five splat kinds, mirrors), and the
u16 buffer fits the largest index any frame can build.

Lab, -O ReleaseSafe -lc: one process 51.0/54.8 s -> 33.0/35.5 s; 48 shards
3.88 s -> 2.82 s; frames sha256 7e0c6662... unchanged in all six runs.
test-report 26/26, 0 vacuous. Resealed.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@github-actions

Copy link
Copy Markdown
Contributor

PR Dashboard

Generated at: 2026-10-18 11:05:09 UTC

Summary

Status Count
Total Open PRs 50
PRs with Failing Checks 50
PRs with All Checks Green 0
READY 0
FAILING 50
PENDING 0
NO CHECKS YET 0

Seal Status

  • ⚠️ STALE -- sha256(compiler.rs)=fad12492937a != manifest seal=87e5cbd3ad94.
    The committed NMSE numbers were certified against an older compiler.rs.
    Run scripts/reseal-check.sh locally for the two-step reseal command (advisory; not a merge gate).

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.

t27f token_floor: a per-frame row index so each raster row visits only the splats that touch it

1 participant