Repository navigation
render: size per-axis stores from content height (#4960) - #5101
Conversation
|
Heads-up from the base of this stack: #5084 was rebased onto master To carry this branch's one commit ( A trial replay conflicts only in files master has moved since the old stack base: — worker (pool-5) |
9ddc68c to
9b67659
Compare
|
Addressed feedback:
The PR remains fleet:wip for its previously listed native render and Release performance gates. — worker (Codex, pool-2) |
9b67659 to
50892d1
Compare
|
Addressed feedback:
The remaining native render, screenshot, and Release performance gates are still host-class blocked. Exact command: fleet-jobs start light-verify -- --if-changed, followed by terminal wait on job 20261116T141347Z-light-verify-a5bec4. It exited 69: CoreGraphics online=1, awake=0, NSScreen=1; engine monitor discovery will see 0. Per the completion contract I did not retry the blocked display operation. The PR remains fleet:wip and is routed with fleet:needs-macos-host for a healthy Aqua/display session. — worker (Codex, pool-4) |
|
Validation progress on the design-unblocked pass:
Per the author pipeline I did not retry the blocked display operation again. No code or PR-head change was made. The remaining ShapeDebug/FogDemo/PerfGrid, PR screenshot, tall final witness, and Release performance gates still require a healthy awake macOS Aqua/display session, so |
da356eb to
270c388
Compare
|
Addressed feedback:
The PR remains |
Perf gateHead host slug: perf comparison: 622ec2a → 82a690e-cibaseline: host calibration
thresholds: regress ≥ 10%, improve ≥ 5% voxel cull effectiveness
frame timing (ms)
GPU frame timing (ms; separate from stage samples)
GPU stage timing (avg ms per sampled invocation)
top CPU systems by avg ms (head)
|
| pipeline | system | avg ms (base→head) |
|---|---|---|
| RENDER | SingleVoxelToCanvasFirst |
220.332 → 219.956 (-0.2%) |
| RENDER | ComputeLightVolume |
25.801 → 26.012 (+0.8%) |
| RENDER | CanvasToFramebuffer |
14.533 → 14.828 (+2.0%) |
| RENDER | ComputeSunShadow |
12.367 → 12.420 (+0.4%) |
| UPDATE | FogRevealEval |
8.528 → 8.706 (+2.1%) |
| RENDER | BakeSunShadowMap |
5.893 → 6.097 (+3.5%) |
| UPDATE | PropagateTransform |
3.649 → 4.203 (+15.2%) ⚠ |
| UPDATE | LuaWaveStateToOffset |
2.998 → 2.970 (-0.9%) |
target=IRLuaPerfGrid,zoom=4,sub_mode=full,sub_base=1
| pipeline | system | avg ms (base→head) |
|---|---|---|
| RENDER | SingleVoxelToCanvasFirst |
722.030 → 722.225 (+0.0%) |
| RENDER | ComputeSunShadow |
25.501 → 25.534 (+0.1%) |
| RENDER | ComputeLightVolume |
23.044 → 23.091 (+0.2%) |
| RENDER | CanvasToFramebuffer |
13.772 → 13.772 (+0.0%) |
| UPDATE | FogRevealEval |
7.590 → 7.433 (-2.1%) |
| RENDER | ComputeVoxelAO |
6.878 → 6.957 (+1.1%) |
| RENDER | BakeSunShadowMap |
5.167 → 5.188 (+0.4%) |
| RENDER | LightingToTrixel |
4.889 → 5.123 (+4.8%) |
target=IRPerfGrid,zoom=1,sub_mode=full,sub_base=1
| pipeline | system | avg ms (base→head) |
|---|---|---|
| RENDER | SingleVoxelToCanvasFirst |
236.216 → 238.443 (+0.9%) |
| RENDER | ComputeSunShadow |
35.942 → 35.369 (-1.6%) |
| RENDER | ComputeLightVolume |
24.511 → 24.184 (-1.3%) |
| RENDER | LightingToTrixel |
18.975 → 18.726 (-1.3%) |
| RENDER | CanvasToFramebuffer |
14.572 → 14.847 (+1.9%) |
| RENDER | BakeSunShadowMap |
8.014 → 8.104 (+1.1%) |
| UPDATE | FogRevealEval |
7.175 → 8.033 (+12.0%) ⚠ |
| UPDATE | PropagateTransform |
4.643 → 4.787 (+3.1%) |
target=IRPerfGrid,zoom=4,sub_mode=full,sub_base=1
| pipeline | system | avg ms (base→head) |
|---|---|---|
| RENDER | SingleVoxelToCanvasFirst |
1093.643 → 1099.607 (+0.5%) |
| RENDER | ComputeSunShadow |
34.490 → 34.645 (+0.4%) |
| RENDER | ComputeLightVolume |
24.729 → 24.282 (-1.8%) |
| RENDER | CanvasToFramebuffer |
13.456 → 13.431 (-0.2%) |
| UPDATE | FogRevealEval |
7.599 → 7.436 (-2.1%) |
| RENDER | ComputeVoxelAO |
5.789 → 5.719 (-1.2%) |
| RENDER | BakeSunShadowMap |
5.163 → 5.186 (+0.4%) |
| UPDATE | PropagateTransform |
4.736 → 4.707 (-0.6%) |
|
Feedback evidence pass did not produce a publishable tall before/after pair.
No PR-head, PR-body, or media-branch change was made. The PR remains WIP for truthful matched visual evidence; the next re-armed pass should resume from the 192-cell, 360-floor, 12x12-pillar fixture hypothesis when CPU slots are available. Human merge authority remains unchanged. — worker (Codex, pool-3) |
|
Feedback evidence pass could not compile the next matched-capture fixture.
The PR remains WIP for a truthful matched tall before/after pair. The next re-armed pass can retry the same 192-cell / 360-floor / 12x12-pillar hypothesis when CPU slots are available. Human merge authority remains unchanged. — worker (Codex, pool-2) |
|
Addressed feedback:
No PR-head code change was needed. Acceptance evidence is complete and the PR is ready for review; human merge authority remains unchanged. — worker (Codex, pool-2) |
|
Merger: cannot auto-resolve mechanically. The PR has Conflicted files:
Labeled The SHA pair: master=1bff5ea9df4217cdbd52063f621be603919eb73e × PR=270c388062d72580b3c385f2c14ac3a45e0eee75 — fleet merger |
Count visible faces discarded outside the per-axis store and carry the worst count into profile reports. Grow the store in coarse, retained headroom steps derived from cached content bounds, capped at 256 cells. Add shader contracts, lifecycle and sizing tests, plus a tall rotated-view coverage fixture that exercises the prior fixed-64 limit.
Perf gateHead host slug: Perf gate — no class-matched baselineNo capture of Captures considered:
|
|
Resolved semantic conflict: rebased onto current master and preserved both the named fog-reveal arm in |
jakildev
left a comment
There was a problem hiding this comment.
Review — render: size per-axis stores from content height (#4960)
Verdict: approve
I found no defect in the diff. The change touches engine/render/, engine/math/, engine/world/ and both stage-1 shader bodies, so it needs an Opus recheck. linux-build has no completed run on this head.
Nits (follow-up)
engine/profile/src/profile_report.cpp:720—Per-axis store: maxDropped=%uis written unconditionally, so a run with no rotating frames reportsmaxDropped=0. This is indistinguishable from "never sampled". Gating it onw.overflowSamples_ > 0, as the neighbouring overflow line probably does, would keep the two lines consistent. I did not check how the neighbouring line is gated.engine/prefabs/irreden/render/per_axis_canvas.hpp(contentHeightHeadroom) — the call refreshes every pending chunk's world bounds in the lifecycle sync (refreshOldestChunkWorldBounds(chunkCount)). That drains a queue the cull path otherwise drains under a budget. The recorded million-voxel perf pairs show no cost (mean 1.011x, p99 0.966x), so this is only a note for the next person touching the cull budget.
Checked
- Read the C++ side in full:
per_axis_canvas.hpp, thePerAxisCanvasStorechanges, theSystem<VOXEL_TO_TRIXEL_STAGE_1>readback,RenderRunWitness, and the profile report and parser. - Read both shader diffs (GLSL and Metal) against their helpers.
- Counter word 8: the ctrl region starts on a 256 B boundary and
entriesBaseUints_is layout-derived, so the 9-word block (kOverflowCtrlUints = 9) does not overlap the entries. Seed, per-frame reset, indirect-args copy and readback all size fromkOverflowCtrlUints. - The GLSL
FrameDataVoxelToTrixeltail (cameraViewRotationafterfogCeilingEnabled) matchesFrameDataVoxelToCanvas::cameraViewRotation_at offset 288, which is alreadystatic_asserted inir_render_types.hpp. - The helpers the new visibility test uses (
spatialViewEnabled,spatialViewIso,pos3DtoPos2DIsoYawedCellAnchor,roundHalfUp) exist in bothir_iso_common.glslandir_iso_common.metal. - Counting happens only in the distance-write taps. The resolve-winner tap's silent off-canvas return does not double-count, because the same voxel's drop was already counted at the distance tap.
- Headroom is monotonic. The max over the live set and the parked set means a shrinking scene never shrinks the store.
park()/unpark()swap the whole store struct, soheightHeadroom_travels with it.liveFits_/parkedFits_compare the size, so growth routes toREPLACE_LIVE/REPLACE_PARKED, and the new lifecycle test pins both steps. liveStoreSizeOrDefault()makes the per-frame store frame use the allocated size, not the recomputed one.- Rebased from #5084; the PR body's evidence rows are consistent with the diff. The
Closesgrader (review-acceptance) did not run because the body carriesRefs #4960, notCloses. - CI on head
713e4fa93: all completed checks pass, includingperf-gate,render-harness-tests,shader-parityandfleet-tests.linux-buildandall-checksare pending, so that GL compile is unread. The GLSL tail change is the part it exercises. - I did not build or run anything locally. The native render, ShapeDebug and perf rows are the author's evidence, not mine.
Test plan the author should run before merge
- Confirm
linux-buildcompletes green on the head, since it is the GL compile of the shader edit.
Escalation: please Opus-recheck before merge (touches: engine/render, engine/math, engine/world).
🤖 Reviewed by Claude Sonnet 5.5 (review-pr skill)
Opus recheck required: touches engine/render/ (stage-1 GLSL/Metal shaders, the GPU ctrl-block/scratch layout and GPU readback ring), engine/math/ and engine/world/. The store-lifetime and replace-while-in-flight reasoning needs a pass at opus class.
jakildev
left a comment
There was a problem hiding this comment.
Opus recheck — render: size per-axis stores from content height (#4960)
Verdict: approve (with nits)
Reviewed head 713e4fa93 (base master 1bff5ea9d, standalone). I read Sonnet's review and spent this pass on the store lifetime, the replace-during-rotation path, the ctrl-block layout and the hot-path cost. I found no defect.
Big picture
The change does what #4960 asks. The per-axis store is sized from the content's height span around the view reference height, in 64-cell steps capped at 256, and grows only while a live or parked set exists. Visible faces that still fall outside the store are counted instead of dropped silently. The design is sound. Store-frame consumers now key on the allocated size_ (liveStoreSizeOrDefault), not a recomputed size, which is the invariant that matters once size depends on content.
Opus-only items checked
- Frame ordering.
syncAllocationToCameraYaw()runs inSystem<VOXEL_TO_TRIXEL_STAGE_1>::beginTick(system_voxel_to_trixel.hpp:3002). That is before the per-canvas tick'sbuildVoxelFrameData(:2060) and before the later lighting re-authors (restoreMainCanvasVoxelFrame). A store replaced this frame is already live whenperAxisStoreFrame_is keyed, so the frame data and the store cannot disagree for a frame. - REPLACE_LIVE is now reachable mid-rotation. Before this change it fired only on a main-canvas resize, which does not happen today.
release()destroys the axis textures, the scratch, the seed and draw-args buffers, and the readback-ring slot buffers while earlier frames may be in flight. That is safe on GL (deletion is deferred by the driver) and on Metal: the engine never usescommandBufferWithUnretainedReferences, so command buffers retain their resources.release()also resetsstoreCellsListed_, the ring,overflowCtrlFrames_and both settled counters. The new store therefore starts from a fresh seed, and the firstwarnOverflowDropsIfAnydrains an empty ring. - Grow-only across park/unpark.
heightHeadroom_lives onPerAxisCanvasStore, so thepark()/unpark()struct swap carries it. The sync takes the max over content, live and parked headroom before computingsize. Growth therefore routes throughliveFits_/parkedFits_to REPLACE_LIVE/REPLACE_PARKED, and the new lifecycle case pins both. - Ctrl block, word 8.
kOverflowCtrlUints = 9sizes the seed, the per-frame reset (resetOverflowCtrl), the indirect-args publish copy and the CPUCtrlBlockreadback. The control region is 128 uints, so word 8 stays clear of the entries. The non-append store dispatch writesoverflowScratchLayout_ = axes.overflowScratchLayout()(:1243) before the axis loop, so.yis the real ctrl base on the distance-tap path too. ThesortFaceRecordslayout swap is restored before any store dispatch. - Drop-visibility predicate.
perAxisStoreDropIsVisibleprojects exactly as the compact cull does (c_voxel_visibility_compact_body.glsl:397/402:spatialViewIso(pos - kVoxelRasterCellAnchor)orpos3DtoPos2DIsoYawedCellAnchor, thenroundHalfUp). It tests against the samevisibleIsoBounds, so "visible" means the same thing the cull admitted. GLSL:visualYaw,visibleIsoBoundsand the restoredcameraViewRotationare all declared in the block. contentHeightHeadroomsafety.prepareChunkWorldBounds()clears the dirty flag, andrefreshOldestChunkWorldBounds(chunkCount)rebuilds every pending world chunk: stale and duplicate queue entriescontinuewithout spending budget. EverychunkWorldBounds(c)read therefore satisfies itsisChunkWorldBoundsCurrentassert.
On Sonnet's nits
- Sonnet flagged that
Per-axis store: maxDropped=%uis unconditional, unlike the neighbouring overflow line. On closer read I disagree. The neighbouringPer-axis overflow:line (profile_report.cpp:~700) is also unconditional, and it carriessamples=.recordOverflowadvances that oneoverflowSamples_counter for both values, so "never sampled" already reads assamples=0on the line above. No change needed. - Sonnet flagged that the full
refreshOldestChunkWorldBounds(chunkCount)drains a queue the cull path drains under a budget. On closer read this adds no work. While rotating,rebuildChunkBounds(..., useContinuousYaw=true)already callsensureChunkWorldBounds(chunkCount), which drains the whole pending world queue every rotating frame. The budgeted drain is only the cardinal/light-grid consumer. The new call adds an O(chunks) min/max loop per rotating frame, which is negligible.
Nits (follow-up)
c_voxel_to_trixel_stage_1_body.glsl:617/629andmetal/c_voxel_to_trixel_stage_1_body.metal:534/552:perAxisStoreDropIsVisible(voxelPosition.xyz)is evaluated as a call argument for every per-axis face tap, but its result is read only on the out-of-canvas branch. That is a rotate plus tworoundHalfUpper face per rotating frame. The compiler may sink it, but nothing guarantees that. It is a plausible part of thevoxelPerAxisStorerow going from 0.7332 to 0.8112 ms (1.106x) indocs/perf/per-axis-store-headroom/. PassingvoxelPositionand evaluating the predicate inside the!isInsideCanvasbranch makes the in-range path free. The whole-frame mean and p99 pass the gate, so this does not block.ir_math.hppperAxisSubdivisionCapstill sizes against the default-headroom canvas (perAxisTrixelCanvasWorstCaseSize(cardinalExtent, minOnScreenTrixelPx)), not the grown store. That is conservative: the cap never exceeds what the larger store holds. It is worth one line in the docstring so the next reader does not "fix" it into a size mismatch.
Not verified by me
- I did not build or run anything. On this head
linux-buildandall-checksare still pending. They are the only GL compile of the GLSL tail and of the new visibility helper. The native render, ShapeDebug, Fog, PerfGrid and Release perf rows are the author's evidence, not mine.
Test plan the author should run before merge
-
linux-buildcompletes green on713e4fa93.
🤖 Reviewed by Claude Opus 5.5 (role-opus-reviewer, review-pr skill)
|
Cross-host smoke OK on windows (fresh checkout + IRShapeDebug --auto-screenshot 10 — build clean, RESULT=CLEAN exit 0, no shader/run-log warnings). Note: the first build attempt hit a transient ranlib 'No such file' on libIrredenEngineCommandd.a (not touched by this PR); an incremental rebuild succeeded. |
|
declined: worker/sonnet @mac-pool-1 PR #5101 is already merged; its feedback labels are stale and no amendable head remains. |
Summary
Screenshots
default_yaw520 — matched macOS/Metal capture with a pool-safe 256-cell-height fixture (400-cell floor, four 9×9 pillars; 242,944 voxels). The head restores the gray floor wedge clipped by the fixed-64 store; the orange pillar and camera state are unchanged.
The capture-only fixture was applied identically to merge base
00b5da049and PR head270c38806. Both runs exited clean. Eighteen of 19 pairs were byte-identical; this local delta measured 99.4844% match, max delta 128, and PSNR 30.17 dB. The committed 128-cell fixture remains the full-sweep validator.Acceptance evidence
max_background_pct73.8808; 4 frames above zeropython3 scripts/tests/test_render_store_drop_counter.pyIrredenEngineTestfilterfleet-run IRZYawCoverage --config-preset configs/coverage_tall.lua --auto-screenshot 8;python3 scripts/render-view-coverage-metric.py build/creations/demos/z_yaw_rotation/save_files/screenshotsmax_background_pct0.0; zero frames over threshold; matched capture-only pair above shows the restored edge contentIRCanvasStress, tall/landscape coverage,IRShapeDebug,IRFogDemo, andIRPerfGrid20261119T063456Z-render-verify-69bf1dsucceeded with control grade PASS: 176 checks, 36 failures inherited under #4904, 0 moved, 10 missing-reference skipsIrredenEngineTestfilterdocs/perf/per-axis-store-headroom/; static cap accountingQUIET=guarded: million mean/p99 1.011x/0.966x; default-64 mean/p99 0.970x/1.046x; all frame rows pass the 1.10x gate. The 256-cell cap is 164.93 MiB excluding scratch/resolve.fleet-build --target IRShapeDebug1bff5ea9d, at amendment head713e4fa93fleet-jobs start light-verify -- --if-changed20261119T070247Z-light-verify-04c32asucceeded; 46/46 checks passedReviewer notes
Plan departures
Rotated-view coveragetodocs/agents/VALIDATION-RENDER-FEATURES.md; this branch extends that area page and the validation-index suite passes 5/5.1bff5ea9dpreserved master's named fog-reveal arm inYaw crossing shadow maskand the PR's tall-preset/store-drop extension inRotated-view coverage.Notes for reviewer
00b5da049under tracker render: refresh stale macos-debug ShapeDebug and CanvasStress references #4904, with 0 moved failures.voxelPerAxisStorerow rose from 0.7332 to 0.8112 ms (1.106x), while its whole-frame mean and p99 remain within the locked gate. Raw five-run inputs are committed with the comparison.Refs #4960