Repository navigation
render: reset only listed per-axis store cells; skip the feeder raster and Hi-Z chain when nothing reads them (#4956) - #5064
Merged
Conversation
A rotating frame now resets the three per-axis stores only at the cells the previous frame's compaction listed (c_per_axis_cell_clear, GLSL and Metal twins; Metal also resets the distance's image-atomic scratch). A fresh or unparked set still clears whole. The store row on the 8^3 rotating fixture falls from 0.65 to 0.16 ms, and the dense 64^3 scene improves too. Under finite face casting the voxel raster no longer widens its cull bounds by the sun sweep, so no feeder is classified or rasterized, and RESOLVE_PER_AXIS_SCREEN_DEPTH skips when the bake does not read canvas depth. COMPUTE_DISTANCE_HIZ builds only while the occlusion cull is on, and IRPrefab::OcclusionCull::LagSource treats the frame after a cull-off frame as stale. feeder-margin-verify runs on --legacy-depth-shadows, the only path that still rasterizes feeders. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
6 tasks done
jakildev
commented
Nov 12, 2026
jakildev
left a comment
Owner
Author
There was a problem hiding this comment.
Review — render: reset only listed per-axis store cells; skip the feeder raster and Hi-Z chain when nothing reads them (#4956)
Verdict: approve
The implementation matches the planned three-part optimization. The sparse reset consumes the previous frame's finalized occupied-cell list before that list is rebuilt, preserves the whole-clear path for fresh and unparked stores, and resets Metal's R32I atomic scratch alongside the texture. The feeder and Hi-Z gates are conservative: the former retains the canvas-depth path for legacy/particle coverage, while the latter suppresses culling for the first frame after any build gap or view discontinuity.
Acceptance (issue #4956)
| Criterion | Grade | Basis |
|---|---|---|
| Phase 0 readings | met | The issue thread records the six-pair 0.651 ms small-fixture baseline above the 0.3 ms bail and same-session master controls for all five render targets. |
| Sparse clear exactness | met | Evidence covers startup, steady, and cardinal-crossing frames; deterministic frames are byte-identical and the pre-existing nondeterministic frames have identical modal hashes across five runs per arm. |
| Render/yaw/occlusion/feeder validation | met | The five target rows match the same-session master control, the nine-yaw and default-shot sets are identical, and both positive-fire validators report PASS. |
| Store cost and dense guard | met | Six interleaved pairs show a 76% reduction with a positive 0.380 ms lower bound; the five-pair dense arm improves by 53%. |
| Feeder gate | met | Default 0-degree feeder count falls from 110,916 to 0, legacy depth retains 110,916, and both required 45-degree counters fall by 11.1%. |
| Hi-Z gate and re-enable staleness | met | The real system dispatch reads buildsDistanceHiZ; the new tests exercise both gate states and the post-gap stale frame. |
| Backend twins and registries | met | GLSL/Metal twins, shader name, Metal threadgroup/scratch registrations, and the header-check audit are all present and green. |
Verification
fleet-build --detach --target IrredenEngineTest: terminal success (fleet-jobs: 20261112T084953Z-build-d74c5b succeeded exit=0).fleet-run IrredenEngineTest --gtest_filter='*OcclusionLag*:*PerAxisCellClear*:*SunShadowFeeder*': 10/10 passed, including the real Metal texture-and-scratch clear.git diff --check origin/master...HEAD: clean.fleet-pr-overlap --base claude/4956-sparse-store-clear-feeder-hiz-gates:VERDICT: clean.- The red
perf-gateis inherited infrastructure: this head and the current master runs both fail while linkingIRPerfGridagainst the Ubuntu 26.04 runner'slibjack.so(__cxa_call_terminate@CXXABI_1.3.15), before measurement. Header, format, shader-parity, Python, comment, instruction, whitespace, and closes checks are green; the still-running checks are unread rather than green.
No blocking findings or amend-worthy nits.
🤖 Reviewed by Codex (GPT-5, opus-class final pass)
Opus recheck not required (reviewed at opus class).
This was referenced Nov 12, 2026
This was referenced Nov 16, 2026
jakildev
added a commit
that referenced
this pull request
Nov 16, 2026
The stack below this branch (#5064, #5070) has merged, so the branch is rebased onto master and every reading is retaken against it: the interleaved timing series (now series-3, replacing series-1 and series-2, which measured the old stack base), the 45-degree stage profiles, the census and rejection counts, the base/head capture identity, and the late-pose GUI fixtures (criteria 10-13). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This was referenced Nov 16, 2026
jakildev
added a commit
that referenced
this pull request
Nov 17, 2026
…aw (#4954) (#5084) * render: reject hidden overflow-lane faces before sort, relight and draw The per-axis overflow lane held every exposed face that lost its cardinal store cell, and the sort, the relight, the fog pass and the scatter draw all sized their work from it. On the million control at 45 degrees that is 2.36 million records, of which about 1,500 own a framebuffer pixel. Stage 1 now draws the faces that won their store cells into the main framebuffer's depth, reduces that depth to a block-maximum pyramid, and tests each overflow candidate's whole projected footprint against it before appending. A face is rejected only when no pixel centre falls in its footprint, or every occluder over it is nearer by more than one tie band, so the image is unchanged. The append is its own compiled variant of the stage-1 body; the store kernel no longer carries it. The test and the draw must project a face at the same place, so the scatter placement is computed by one function. Stage 1 derives it ahead of the composite; a frame that rejected is drawn with that value. When a system writes the camera between the two, or a glitch subject can blank a store cell, the append keeps every candidate. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com> * docs: record the overflow-lane rejection counts and timings Adds the measurement document for the overflow-lane rejection: how many lane faces own a pixel, what the append rejects, two series of interleaved base/head timing pairs with their reports and manifests, the per-stage split at 45 degrees, and the capture comparison. Adds the matching row to the optimize skill's big-wins reference. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com> * render: opt the late-pose GUI fixtures out of overflow rejection The GUI-test cyclers that IRShapeDebug splices ahead of the composite write each shot's pose between VOXEL_TO_TRIXEL_STAGE_1 and TRIXEL_TO_FRAMEBUFFER, outside the camera ordering contract. --gui-test, --continuous-zoom-gui-test and --rotation-pick-test gui now keep the full overflow lane for the whole run, so the frame a pose lands on draws as the base does. - setOverflowRejectionEnabled returns whether it took effect; the demo asserts it, because the setter changes nothing before the voxel system exists. - Stage 1 logs the first rotating frame's rejection verdict once per run. - GuiTestConfig::capturePoseWriteFrame_ (IRShapeDebug --capture-pose-write-frame) adds a capture of each pose-write frame. - IRShapeDebug --late-camera-write-test writes the yaw in that slot on scheduled frames and checks the latch, a refill inside the stand-down and a second latch after it expires. - The camera row of the render ordering table now puts camera controls before VOXEL_PICKING / VOXEL_TO_TRIXEL_STAGE_1; the design doc states the contract, the fixture opt-outs and the recovery boundary. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * docs: retake the overflow-lane rejection evidence on master 345dbbf The stack below this branch (#5064, #5070) has merged, so the branch is rebased onto master and every reading is retaken against it: the interleaved timing series (now series-3, replacing series-1 and series-2, which measured the old stack base), the 45-degree stage profiles, the census and rejection counts, the base/head capture identity, and the late-pose GUI fixtures (criteria 10-13). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * docs: grade the perf-HUD pose-write frame with its graph masked The --gui-test perf_hud_closed pose-write frame differs between any two runs, base against base included, only inside the HUD's frame-time graph, which plots wall-clock timings. Record the graph's opaque rectangle and the masked max-delta-0 comparison that passes on two independent base/head run pairs (#4954 criterion 10). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> --------- Co-authored-by: Claude Fable 5.2 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Three pieces of per-frame GPU work in the voxel raster now run only when something uses their result. Each part was measured separately.
c_per_axis_cell_clear, is dispatched indirectly over the occupied-cell list. It has GLSL and Metal twins. On Metal it also resets the distance's image-atomic scratch.C_PerAxisTrixelCanvases::storeCellsListed_decides which reset runs.compactPerAxisCellssets it. Allocation andunpark()drop it, so a fresh or unparked set still clears whole.IRPrefab::SunShadow::voxelRasterFeederParams). No feeder is classified or rasterized, andRESOLVE_PER_AXIS_SCREEN_DEPTHskips its scatter whenever the bake does not cast from canvas depth.COMPUTE_DISTANCE_HIZbuilds the chain only on frames with the occlusion cull on (IRPrefab::OcclusionCull::buildsDistanceHiZ). A new pure helper,IRPrefab::OcclusionCull::LagSource, holds every staleness trigger. It adds one new trigger: the frame after a cull-off frame is stale.scripts/feeder-margin-verify.pynow runs with--legacy-depth-shadows. That is the only path that still rasterizes feeders.per-axis-trixel-canvas-rotation.md,voxel-feeder-split.md,voxel-occlusion-culling.md,prefab-render-surface.mdandengine/render/CLAUDE.md. TheCLAUDE.mdedit changes no line count.Test plan
fleet-run IrredenEngineTest --gtest_filter='*PerAxis*:*OcclusionLag*:*SunShadowFeeder*:MetalGpuComputeDispatchTest.*': 91 passed.OcclusionLagSource.*suite has 4 tests.PerAxisCellClearResetsListedCellsAndTheirScratch. It fails when the scratchatomic_storeis deleted from the kernel (mutation check, then restored).IRPerfGrid. Command:--wave-freeze --yaw 0 --yaw-step 0.05235987756, so frame 31 lands on the 90° cardinal.QUIET=guardedon all 22 runs (criterion 4).render-verifyon five targets, the nine-yaw set and the 28 defaultIRShapeDebugshots, each against a master control run in the same session (criterion 3).python3 scripts/light-verify.py --if-changed:[light-verify] all checks PASScmake -DPROJECT_ROOT=$PWD -P cmake/run_header_checks_standalone.cmake: exit 0 (Metal scratch-consumer check: 56 kernels, 12 declare the scratch).Acceptance evidence
voxelPerAxisStoremean 0.651 ms (0.536 to 0.829), above the 0.3 ms bail. All five render-verify sets unchanged vs master.--capture-frame Nbase vs head,render-compare.py --per-pixel-tol 0 --threshold-max-delta 0fec2125782, f3360149faea, f1037ab56f5ad). Each arm has one outlier run (base 1 at f2, f3 and f10; head 1 at f3).render-verify.py --target …×5; nine-yawIRCanvasStress --sweep-yaw 0 6.2831853 9;occlusion-fire-verify.py;feeder-margin-verify.pyPASS: per-voxel marginal reduction 11034.7 >= 1.0. feeder-margin:PASS — the shipped classify margin is adequate, ring non-empty, run on--legacy-depth-shadows(see departures).repeat_profile.pyinterleaved ABBA, Release,QUIET=guardedFeeder0 at 0° with shadows on, > 0 with--legacy-depth-shadows; 45°VisibleandAxisEntriesbelow baseconfigs/perf/million.lua), ReleaseVisible909,358 → 808,564,AxisEntries2,728,074 → 2,425,692 (both −11.1%).IrredenEngineTest --gtest_filter='*OcclusionLag*'ChainIsBuiltOnlyWhileTheCullIsOnandFrameAfterAReEnableIsStalepass.COMPUTE_DISTANCE_HIZ::beginTickreadsbuildsDistanceHiZ, and stage 1 readsLagSource::advance.shader_names.hpp, Metal registries, header checksrun_header_checks_standalone.cmakec_per_axis_cell_clear.glslandmetal/c_per_axis_cell_clear.metal,kFileCompPerAxisCellClear,threadgroupSizeForFunctionName(16,16,1),functionUsesImageAtomicScratch. Header checks: exit 0 (Metal scratch-consumer check: 56 kernels, 12 declare the scratch).Plan departures
feeder-margin-verify.pyto pass unchanged. Under the gate, the default path has no feeder ring, and the script's own vacuity guard failed it ("vacuous adequacy arm"). It now passes--legacy-depth-shadows, the configuration where the classify margin still matters, and it passes there with the ring non-empty.per_axis_canvas.hppor the component. It is one component field set by the compaction. No lifecycle code changed beyondunpark().Notes for reviewer
Metal scratch coverage (the plan's main gotcha). The occupied-cell list is built from the distance texture, which stage 2 writes. Stage 1 writes the scratch.
selectVoxelFace.per-axis-trixel-canvas-rotation.md§ "Store reset over the occupied-cell list". The new Metal test exercises the scratch half directly.Master's frame-2/3/10 nondeterminism. It is pre-existing and appears on base alone. It looks like IRLuaPerfGrid render-verify intermittently fails one shot at max delta 39 #5047's flake (max_delta 38 to 39), so I compared outcome sets rather than single shots.
Combined A/B. The perf numbers include all three parts. The store row isolates part 1. The frame-time gains (8³: 8.93 → 8.63 ms; 64³: 13.39 → 12.38 ms) mix all three.
Open-PR overlap.
fleet-pr-overlapreturnedVERDICT: overlap, and every shared path trial-merges clean. Please check the doc and instruction-file rows for semantic disagreement.per-axis-trixel-canvas-rotation.md.engine/render/CLAUDE.md.shader_names.hppandmetal_pipeline.cpp.system_voxel_to_trixel.hppandgpu_compute_dispatch_test.cpp.test/CMakeLists.txt.gpu_compute_dispatch_test.cpp.Screenshots
Base vs head at rotated yaws. Every pair is byte-identical; the change has no visual effect.
IRPerfGrid frame 3 — first sparse reset of a run (yaw 6°)
IRPerfGrid frame 33 — first sparse reset after a cardinal unpark (yaw 96°)
IRCanvasStress nine-yaw pose 2 (yaw 45°)
Closes #4956
🤖 Generated with Claude Code