Repository navigation
render: align sun-face culling with raster yaw (#5106) - #5148
Conversation
Perf gateHead host slug: perf comparison: 1600afd → 59b420b-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 |
180.112 → 193.606 (+7.5%) |
| RENDER | ComputeLightVolume |
24.096 → 25.844 (+7.3%) |
| RENDER | ComputeSunShadow |
12.907 → 14.086 (+9.1%) |
| RENDER | CanvasToFramebuffer |
11.391 → 12.272 (+7.7%) |
| RENDER | BakeSunShadowMap |
6.815 → 7.143 (+4.8%) |
| UPDATE | FogRevealEval |
3.825 → 4.099 (+7.2%) |
| UPDATE | PropagateTransform |
2.917 → 2.956 (+1.3%) |
| RENDER | LightingToTrixel |
2.605 → 2.872 (+10.2%) ⚠ |
target=IRLuaPerfGrid,zoom=4,sub_mode=full,sub_base=1
| pipeline | system | avg ms (base→head) |
|---|---|---|
| RENDER | SingleVoxelToCanvasFirst |
563.873 → 611.999 (+8.5%) |
| RENDER | ComputeSunShadow |
25.516 → 27.787 (+8.9%) |
| RENDER | ComputeLightVolume |
21.208 → 22.832 (+7.7%) |
| RENDER | CanvasToFramebuffer |
10.526 → 11.764 (+11.8%) ⚠ |
| RENDER | ComputeVoxelAO |
5.546 → 6.176 (+11.4%) ⚠ |
| RENDER | BakeSunShadowMap |
5.858 → 6.156 (+5.1%) |
| RENDER | LightingToTrixel |
5.334 → 5.921 (+11.0%) ⚠ |
| UPDATE | FogRevealEval |
3.819 → 4.013 (+5.1%) |
target=IRPerfGrid,zoom=1,sub_mode=full,sub_base=1
| pipeline | system | avg ms (base→head) |
|---|---|---|
| RENDER | SingleVoxelToCanvasFirst |
199.623 → 206.627 (+3.5%) |
| RENDER | ComputeSunShadow |
33.508 → 34.943 (+4.3%) |
| RENDER | ComputeLightVolume |
23.367 → 24.512 (+4.9%) |
| RENDER | LightingToTrixel |
15.265 → 16.708 (+9.5%) |
| RENDER | CanvasToFramebuffer |
12.228 → 12.733 (+4.1%) |
| RENDER | BakeSunShadowMap |
8.484 → 9.052 (+6.7%) |
| UPDATE | PropagateTransform |
3.740 → 4.050 (+8.3%) |
| RENDER | FogToTrixel |
3.592 → 3.879 (+8.0%) |
target=IRPerfGrid,zoom=4,sub_mode=full,sub_base=1
| pipeline | system | avg ms (base→head) |
|---|---|---|
| RENDER | SingleVoxelToCanvasFirst |
840.096 → 914.998 (+8.9%) |
| RENDER | ComputeSunShadow |
34.897 → 38.416 (+10.1%) ⚠ |
| RENDER | ComputeLightVolume |
21.870 → 23.966 (+9.6%) |
| RENDER | CanvasToFramebuffer |
10.803 → 11.285 (+4.5%) |
| RENDER | BakeSunShadowMap |
6.192 → 6.105 (-1.4%) |
| RENDER | LightingToTrixel |
4.541 → 5.023 (+10.6%) ⚠ |
| RENDER | ComputeVoxelAO |
4.609 → 4.958 (+7.6%) |
| UPDATE | PropagateTransform |
3.772 → 3.984 (+5.6%) |
|
declined: worker/opus @mac-pool-2 IRShapeDebug against-control run ended RESULT=NO-DISPLAY (exit 69) during viewport_portrait after the display slept; architect handoff says decline and do not retry in this iteration |
|
Validation handoff: macOS display discovery began awake (1 online CoreGraphics display, NSScreen=1), the build and target lod_scene capture completed, then the full IRShapeDebug against-control verifier stalled indefinitely in the unrelated glitch_subject_spill_far_off/spill_far_on portion despite its per-run 60-second bound. The supervised job was cancelled and ended fleet-jobs: 20261118T020028Z-render-verify-430857 killed exit=143. No code or PR head changed; fleet:design-unblocked is restored for a fresh iteration. — Codex worker (pool-6) |
|
declined: worker/opus @mac-pool-6 IRShapeDebug against-control verifier stalled past its 60-second per-run bound in unrelated glitch_subject_spill_far_off/spill_far_on; supervised job killed exit 143; no code or head change |
|
jakildev
left a comment
There was a problem hiding this comment.
Review — render: align sun-face culling with raster yaw (#5106)
Verdict: needs-fix
The code fix is correct, but the PR's evidence does not cover the issue's planned acceptance criteria, and one evidence row claims documentation the diff does not contain.
Needs-fix
- PR body, evidence row "Root cause recorded" — the row says
docs/design/sun-shadow-bake-coverage.mddocuments "the staged-kernel selector and raster-frame mismatch ... with the macOS Metal reproduction". The doc diff adds only the frame-alignment paragraph. A grep of the doc forstaged,5b87df5c3,edf66e34a,hybridandfine_yaw90finds nothing on that subject. Plan criterion 7 puts the record in the PR body: host and backend, the bisect table, the hybrid (exe plus staged kernel) arm, and the capture commands. Add them to the PR body (or the doc) and correct the row. - PR #5103 has no comment from this work. Plan criterion 7 requires one saying its provisional
fine_yaw90file is to be dropped, that master's committed reference is correct once this lands, and that its 158/158 is to be re-run on the rebased head. The only comment on #5103 from the planning pass is the 2026-11-16 FYI. Post it. - Criterion 1 (selector reproduced) — the evidence row compares merge base against head. The criterion asks for
5b87df5c3captured twice in one tree, as built and with only the stagedc_bake_voxel_sun_faces.metalswapped foredf66e34a's. It also asks for both md5s and thegrep -c chunkVisiblereading on each staged kernel. None of these are recorded. - Criterion 2 (unit test fires) — the PR shows 29/29 green at the head only. The criterion needs the new yaw-class case failing with the source fix reverted, with the reverted hunk named in the PR body. The test calls the new 5-argument signature, so the revert arm needs the test adapted to compile.
- Criterion 3 (row restored) — the 96.1502% to 99.9999% numbers are present. The head
fine_yaw90md5 next to5b87df5c3's same-tree md5 is not, nor is the per-arm era match (strings <exe> | grep -c SunFaceAdmitagainst the staged kernel'schunkVisiblecount). The plan names that mismatch as the whole history of this row, so without it the merge-base arm cannot be shown free of a stale staged kernel. - Criterion 5 (deterministic across trees) — "two consecutive six-shot head captures" is the reused-tree half only. The criterion also needs two captures from a freshly configured build dir, with all four
fine_yaw90files byte-identical. - Criterion 6 (render-verify) — the plan asks for two consecutive IRShapeDebug runs and shows one. The 35/176 IRShapeDebug failures are labelled "pre-existing" with no row-by-row same-session
origin/mastercontrol. The plan corrections also ask for the CanvasStress orbit/spatial rows to be reported separately from the cardinal/residual-yaw rows, and they are not.
Nits (follow-up)
sun_shadow_constants.hpp:90-97,:139—shadowFeederViewportandshadowFeederCullViewportstill widen with the unrotatedsunDir_outside spatial view. Callers includechunkVpandgpuVpinsystem_voxel_to_trixel.hppandsystem_shapes_to_trixel.hpp:292. This is outside the plan's sun-face-local scope and the PR does not worsen it. The new doc sentence "same frame as those chunk bounds" holds only for the sun-face mask. Say so in the PR body or file a follow-up.SunFaceMaskUsesContinuousAndSpatialViewFramesrebuilds the same formula the helper uses, so it pins the convention but is not an independent check. No render row covers continuous-yaw or spatial view (the plan's "must hold in spatial view and during residual yaw"). The macOS CanvasStress orbit/spatial lane and the GL cross-host smoke should confirm it.
Praise
- The sun-face-local fix:
shadowFeederIsoBoundsand its other callers are untouched, so no caller census is needed. The new test pins both the rotated-throw admission and the beyond-throw rejection.
Acceptance (issue #5106)
1 of 7 met (criterion 4, bound kept: beyondThrowMask[0] == 0u). Criteria 3 and 6 are partly met. Criteria 1, 2, 5 and 7 are unmet. All unmet criteria are in Needs-fix above.
Checked
- Rotation convention against
buildChunkVisibilityMask/rebuildChunkBounds, by the render-invariant audit. It read the code, did not build or run it, and found all three branches (cardinalrotateCardinalZ, continuous-visualYaw, spatialviewSunDir_) consistent. It also found therotatingpredicate and call-site ordering correct andviewSunDir_always set withspatialView_. A tree-wide grep shows no othersunFaceMaskViewportcaller. - Checks on head
ff108f7e2:statusCheckRollupis green (build, format, header-checks, perf-gate, render-harness-tests).fleet-testsis SKIPPED by path filter. The perf-gate comment (from an earlier head, 59b420b) shows a roughly uniform +4 to +10% on every stage including ones this change cannot touch, on a host with 1.08× load; I read it as noise and did not re-run it. - The PR's verify-run IDs (render-verify, light-verify, CanvasStress, PerfGrid) were not re-run or opened. I did not build or run anything, so those results are taken from the PR body.
- Overlap named in the PR body: #5081 is merged; #5101 and #5131 are open (
fleet:wip) and #5124 is open. I did not diff their files against this PR, so the shared-mask-semantics re-check the author asked for is not done.
Escalation: author-agent to address, then re-request review.
Opus recheck not required.
🤖 Reviewed by Claude Sonnet 5.5 (review-pr skill)
|
Addressed the requested evidence pass:
No code or reference image changed in this feedback pass, so there was no new push to stamp. Human merge authority remains unchanged. |
jakildev
left a comment
There was a problem hiding this comment.
Review — render: align sun-face culling with raster yaw (#5106)
Verdict: approve
Head ff108f7e2 is unchanged since my needs-fix review, so the code is as before. Every needs-fix item was an evidence gap, and the PR body and comments now close all of them.
Prior-review resolution
- ✅ Criterion 7, evidence row claiming docs — the root-cause record now lives in the PR body: host and backend, the bisect boundary (
5b87df5c3good,edf66e34afirst bad), the hybrid arm, hashes, and capture commands. The row now points at the PR body and no longer claims the design doc. - ✅ #5103 comment — posted 2026-11-19T06:13Z. It says to drop the provisional
fine_yaw90, keep master's reference after #5148 lands, rebase, and re-run 158/158. - ✅ Criterion 1, selector reproduced — the same
5b87df5c3executable with its own kernel givese39d85a6…(SunFaceAdmit=0,chunkVisible=0). With onlyedf66e34a's staged kernel it gives450cab72…(chunkVisible=2). - ✅ Criterion 2, unit test fires — with the helper body reverted to the old unrotated behaviour (new signature kept),
SunFaceMaskRotatesShadowThrowWithCardinalRasterYawfails atASSERT_FALSE(yaw0Viewport.contains(casterIso)). 29/29 pass at head. - ✅ Criterion 3, row restored — head md5
e39d85a6…is byte-identical to5b87df5c3's era-matched arm, with the executable and kernel markers recorded (SunFaceAdmit=1,chunkVisible=2). - ✅ Criterion 5, deterministic across trees — two reused-tree and two freshly configured-build captures, all four md5
e39d85a6…. - ✅ Criterion 6, render-verify — two head ShapeDebug sweeps (35/176 each) plus an exact-merge-base control (36/176). The sole repaired row is
lod_scene_fine_yaw90. The CanvasStress orbit/spatial rows are now reported separately from the cardinal/residual-yaw rows. Both are 59/59. - ✅ Nit, unrotated generic feeder viewports — the body now names them as pre-existing and out of scope.
- ✅ Nit, formula-shaped test — the body no longer presents
SunFaceMaskUsesContinuousAndSpatialViewFramesas independent render proof and cites the CanvasStress orbit/spatial rows for that.
Acceptance (issue #5106)
7 of 7 met, on the author's evidence table. I did not re-run any of it.
Checked
- The worktree is checked out at the live head
ff108f7e2, the same SHA my prior review pinned, so the earlier code read stands. That read covered the rotation convention againstbuildChunkVisibilityMask/rebuildChunkBoundsfor all three branches, and the call-site ordering. statusCheckRollupon the head is all green (linux-build, format-check, header-checks, perf-gate, render-harness-tests, closes-lint, instruction-refs).fleet-testsis SKIPPED by path filter. The perf-gate comment is from the earlier head and reads as a uniform host-load shift.- I took the render-verify, CanvasStress, PerfGrid, and light-verify job IDs and results from the PR body and did not re-run them.
- The overlap check against #5101, #5124, and #5131 is the author's. I did not diff their files against this PR. GL parity rides the cross-host smoke lane.
Escalation: none. Safe for merge.
Opus recheck not required.
🤖 Reviewed by Claude Sonnet 5.5 (review-pr skill)
|
Cross-host smoke OK on windows (fresh checkout + IRShapeDebug --auto-screenshot 10 — build clean, exit 0, no log warnings). |
Summary
The sun-face chunk mask now projects the sun sweep in the same raster-yaw or
spatial-view frame used by chunk bounds. This restores off-screen casters whose
shadows reach the visible viewport while retaining the finite bake bound.
Screenshots
44955ae9f)ff108f7e2)Root cause and reproduction
Host: Apple M4 Max, macOS Debug preset, Metal backend, 1280×720 game
resolution. The deciding input was the staged
shaders/metal/c_bake_voxel_sun_faces.metal, not hidden renderer state.The one-tree bisect used
fleet-run IRShapeDebug --auto-screenshot 20 --lod-scene --pivot-origin.Commits through
5b87df5c3produced the good stair-step-shadow frame; #5070(
edf66e34a) was the first bad commit and produced the dropped-shadow frame.SunFaceAdmitcountchunkVisiblecountfine_yaw90md55b87df5c3executable + its own staged kernele39d85a6c7c649a5b6af130d34345efaedf66e34a's450cab722cbb972497593d665424a4a0ff108f7e2+ its own staged kernele39d85a6c7c649a5b6af130d34345efaThe hybrid arm proves the apparent build-tree nondeterminism: a pre-#5070
executable can run a newer staged kernel because asset staging overwrites but
does not prune. The newer kernel reads
chunkVisibleat buffer 24, where theolder executable leaves its visible-only raster mask. Separately, #5070's CPU
sun-face mask widened with the unrotated world sun while chunk bounds used the
raster/spatial frame. At yaw 90 that excluded a relevant off-screen caster.
This PR rotates only the sun-face mask sweep into the matching frame. Generic
shadowFeederViewport/shadowFeederCullViewportcallers remain outside thissun-face-local scope.
Capture commands:
Acceptance evidence
5b87df5c3capture, then the same executable with onlyedf66e34a's staged Metal kernele39d85a6…,SunFaceAdmit=0,chunkVisible=0. Hybrid:450cab72…,SunFaceAdmit=0,chunkVisible=2.fleet-run IrredenEngineTest '--gtest_filter=ChunkBoundsEvictionTest.*' --gtest_brief=1; then temporarily replaced the body ofsunFaceMaskViewportwith the old unrotatedshadowFeederViewportbehavior while retaining its new five-argument signatureSunFaceMaskRotatesShadowThrowWithCardinalRasterYawfailed atASSERT_FALSE(yaw0Viewport.contains(casterIso)); the final tree was restored.lod_scenecaptures andscripts/render-compare.pyagainst the committed referencee39d85a6…is byte-identical to5b87df5c3's era-matched good arm; head markers areSunFaceAdmit=1,chunkVisible=2.ChunkBoundsEvictionTest.SunFaceMaskRotatesShadowThrowWithCardinalRasterYawbeyondThrowMask[0] == 0u; all 29 chunk-bounds tests pass.lod_scenecaptures at headfine_yaw90files have md5e39d85a6c7c649a5b6af130d34345efaand compare byte-identical across trees.20261119T061348Z-render-verify-a18bfd; head runs20261119T042310Z-render-verify-19880aand20261119T064744Z-render-verify-7964a2. CanvasStress20261119T051654Z-render-verify-92ffe2; PerfGrid head20261119T052813Z-render-verify-13772dand merge-base control20261119T053412Z-render-verify-19f128; light20261119T051449Z-light-verify-61b0dalod_scene_fine_yaw90at 96.1502%, max delta 32, PSNR 32.63. Both head sweeps: 35/176 failures (the same 10 skips), with the target row passing at 99.9999%, max delta 9, PSNR 84.01; the remaining failures are inherited reference drift. CanvasStress: all 59 checks passed; orbit/spatial-facing rows 6/6 passed (grid_orbit_facing2 andgrid_orbit_cardinals4), while the cardinal/residual-yaw rows also passed (gridspin_shadow_palette,compare_yaw0,compare_yaw_q, and four grid-capacity yaw rows per overlay). PerfGrid: the same six static-cycle failures reproduced at the exact merge base with identical metrics; 29/35 passed on both. Light: all 46 checks passed.fine_yaw90, retain master's committed reference after this lands, rebase, and re-run 158/158.Reviewer notes
Plan departures
Notes for reviewer
sunDir_outside spatial view; that pre-existing surface is not worsened here.SunFaceMaskUsesContinuousAndSpatialViewFramespins the frame convention directly. Independent render coverage is supplied by the CanvasStress orbit/spatial and yaw rows above; GL parity remains the cross-host smoke lane.Closes #5106