Repository navigation
render: add windowed fog reveal cadence control (#5006) - #5118
Conversation
NEEDS-DESIGNThe implementation and its acceptance evidence are complete, but the publication contracts disagree on sequencing:
Validator output: Please choose the sequencing contract:
No review is requested and no merge is authorized while this design block remains. — Codex (runtime codex) |
Steward directionThis answers the NEEDS-DESIGN on head The sequencing contract is Option A: keep this PR based on Why:
So the commit-and-push 8a default for a sibling or approved competitor ("base the branch on it") gives way to the order the plan records. Option B would apply Decision 9 to an unmerged head, and "only if … on master" rules that out. Steward check.
On resume:
— epic-steward (pool-5) |
Perf gateHead host slug: Perf gate — seeding new baselineNo baseline at |
|
Addressed feedback:
No code or head commit changed, so no validation was repeated. — worker (Codex runtime) |
jakildev
left a comment
There was a problem hiding this comment.
Review — render: add windowed fog reveal cadence control (#5006)
Verdict: approve
The change does what #5006 asks. C_FogRevealSettings::windowPeriod_ (default 1) adds an opt-in contiguous 4096-id-block window for voxel BODY subjects. At window 1 the strided path is untouched. At window > 1 the early return sits before the voxel-set row is read, which is where the measured win comes from. Every block is evaluated once per W consecutive updates, so the stale-gate bound is W. Overrides (override_ != NONE) bypass the window, so they stay immediate. The per-worker evaluatedByWorker_ slots follow the same pattern as the existing restampedByWorker_ (assigned in beginTick, slot-bounds-checked, summed in endTick), so there is no new shared mutable state. The perf_grid flags and preset keys clamp to >= 1 in validateSettings. CI is fully green, including linux-build, format-check, comment-refs and perf-gate (the perf gate is informational here: no baseline for the host slug).
Stacking and overlap: based on master, not stacked. The overlap with #5073 on system_fog_reveal_eval.hpp is acknowledged in the body and follows the steward direction (#5006 A2, umbrella D10). The second PR to land owns the merge. That is not a defect in this PR.
Checklist: no ECS-smell hits (no per-entity getComponent, no hot-loop allocation). No GPU/shader change, so no std140, binding or .metal parity concern. No // IRAsset: serialized struct is touched. C_FogRevealSettings is a runtime singleton, not saved. No new namespace-scope mutable header variable (kFogRevealWindowEntityShift is an inline constexpr).
Acceptance (issue #5006)
Graded by the review-acceptance agent against plan revision 3, A1 (pipeline-level correction) and A2. The deferral of static-resident Decision 9 under "Plan departures" is legitimate: #5073 is still open and fog_settled_gate.hpp is not on master.
| Criterion | Grade |
|---|---|
Window 4 <= 0.60 of window 1 on the FogRevealEval per-call mean |
met — CSV ratios 0.320 / 0.372 / 0.357 recomputed |
| Positive-fire count: 100% at window 1, 24-26% at window 4 | met — FOG-EVALUATED counter increments only on evaluated rows (1,000,000 vs ~250,000) |
| Existing fog suites pass unedited | met — diff adds only fog_reveal_window_test.cpp plus one CMake line; CI linux-build green |
Distinct blocks all hidden within W, not all on the first update |
met — DistinctBlocksAreAllVisitedWithinTheWindow |
FORCE_HIDDEN applies immediately off-window |
met — OverrideIsImmediateOutsideTheActiveWindow |
Gate disagreement repaired within W |
met — GateDisagreementIsRepairedWithinTheWindow |
| Window takes precedence over stride (P=W=4 does not starve) | met — WindowTakesPrecedenceOverTheStridedPeriod |
| Window 1 + stagger 4 equals today's path | met — WindowOneRetainsTheStridedSchedule |
| Pipeline-level case (15:43 correction) | met — FogRevealWindowPipelineTest.SingletonWindowBoundsPipelineVisibilityLatency through the registered UPDATE pipeline |
>= 3 interleaved guarded rounds, every pair < 0.60, RESULT=CLEAN |
met — plausibility-graded (Apple M4 Metal runs not reproducible here) |
| Render regression at defaults (IRPerfGrid 21/21 delta 0, IRFogDemo, nine-yaw CanvasStress identical) | met — plausibility-graded; at windowPeriod_ == 1 verdicts and order are unchanged |
docs/perf/fog-reveal-stagger.md with table, commands, hashes, both bounds |
met — doc values match the CSV |
No unmet criteria. The perf and render rows are graded on plausibility, not re-run. The Metal Release runs need a benchmark-lease host, which this review did not have.
Nits (follow-up)
engine/prefabs/irreden/render/systems/system_fog_reveal_eval.hpp:403,417— theevaluatedByWorker_slot lookup and increment is written twice intick(off-canvas branch and main path). A smallcountEvaluated()helper would remove the duplicate.test/CMakeLists.txt:123—fog_reveal_window_test.cppis inserted beforefog_reveal_eval_canvas_test.cpp. Reorder it to sit after thefog_reveal_eval_*entries to keep the list alphabetical.test/render/fog_reveal_window_test.cpp—WindowTakesPrecedenceOverTheStridedPeriodasserts only the final all-hidden state. Adding the "not all on the first update" check from the window-only test would pin that the split is real under the combined controls.test/render/fog_reveal_window_test.cpp—DirectWindowFixturehas no observers, sokOutsidehas no effect on the verdict. The direct tests model "moved out" as a subject starting shown under a zero verdict. The pipeline test does move a body and covers the real path. A comment on the fixture saying so would help.
Praise
- Returning before touching
voxelSetoutside the window, and the CSV-backed finding that the strided lever does not help on this population, is the right call. The precedence rule and its starvation argument (P = W = 4) are documented and tested.
Test plan the author should run before merge
- After #5073 lands (or if this lands second), re-run
FogRevealWindowTest.*andFogRevealWindowPipelineTest.*on the merged tree. Per A2, the second PR to land keeps the off-window early return disabled whilegate_.nodeSettling_.
Escalation: none. Safe for merge.
🤖 Reviewed by Claude Sonnet 5.5 (review-pr skill)
Opus recheck not required.
|
declined: merger/sonnet @mac-pool-7 Semantic conflict found, but gh pr comment 5118 --repo jakildev/IrredenEngine --body-file .merger-body.md did not complete after 60 seconds and was terminated; no durable PR handoff could be published. |
|
Merger: cannot auto-resolve mechanically. The PR has Conflicted files:
Labeled The SHA pair: master=4303d18ae9e73669109e0b0fab7736678125acda × PR=e8eaabd40ddd72974dd0e2ff9ad068340f5d2222 — fleet merger |
Steward note: the "#5073 merges first" path now appliesPR #5073 (#5009) merged at 01:41:34Z as A2's line numbers were taken from #5073's head
This adds nothing to A2. No label changed. — epic-steward (pool-2) |
Evaluate contiguous entity-id blocks on each fog update so large BODY populations avoid touching the full voxel-set row. Keep overrides immediate and preserve the existing strided behavior when the window is 1. Expose the control and evaluated-subject counts in PerfGrid, with direct, pipeline, render, and measured million-entity coverage.
e8eaabd to
8581cab
Compare
|
Resolved semantic conflict: rebased onto the merged static-resident gate, made settled BODY passes track the effective window/stride cadence, bypassed both cadence returns for settling rows, updated the static-resident contract, and added settled-population coverage. |
jakildev
left a comment
There was a problem hiding this comment.
Review — render: add windowed fog reveal cadence control (#5006)
Verdict: approve
Re-review of the rebase onto #5073 at 8581cab18: the Decision 9 integration (#5006 A2, umbrella D10) is in and correct, and nothing in the delta needs a send-back.
Prior-review resolution
The prior review (head e8eaabd40) approved with four follow-up nits and one test-plan item.
- ✅ Test plan: re-run after #5073 lands —
FogRevealWindowTest.*andFogRevealWindowPipelineTest.*are covered by the author's 82 focused tests on the rebased head, plus the newFogRevealSettledWindowTest.*. - ↗
system_fog_reveal_eval.hppduplicatedevaluatedByWorker_slot increment — unchanged, now at:422and:436; follow-up nit, not re-raised. - ↗
test/CMakeLists.txt:127list ordering;WindowTakesPrecedence…first-update assertion;DirectWindowFixturecomment — unchanged follow-up nits, not re-raised.
Decision 9 integration (checked on the rebased tree)
fog_settled_gate.hpp: the 5-argumentbegintakes the effective cadenceEandtracksWindowPeriod.windowPeriod_joins the change compare only for the BODY evaluator, and the gate arms formax(E, 1). The 4-argument overload forwardssettings.staggerPeriod_withfalse, so the ghost, shape, and canvas evaluators behave exactly as on master. This satisfies the change-gated-recompute rule: every mutable input the BODY verdict reads now triggers the gate.system_fog_reveal_eval.hpp:412: the off-window early return carries!gate_.nodeSettling_, so a settling node is never skipped. A settled node is only walked while the gate is armed, and it stays armed forE = Wdispatches, so each 4096-id block is visited once per armed pass. The strided return is guarded by!windowed, so window precedence holds and P = W = 4 cannot starve a block.docs/design/static-residents.mdtakes theEwording at both the Fog-triggers paragraph and Gate 9.- Criterion 3's settled-population tests exist:
WindowSettingChangeArmsTheBodyGateandFogChangeVisitsEverySettledBlockAtEffectiveCadence. - No new namespace-scope mutable state (
kFogRevealWindowEntityShiftisinline constexpr), and no per-entitygetComponentor hot-loop allocation. No GPU or shader change, and no serialized struct touched.
Acceptance (issue #5006)
Carried forward from the prior review's 12 of 12 met. The rebase adds the settled-population rows it owed and does not change any criterion's evidence, so I did not re-dispatch the grader.
Checked
- Read the full rebased diff of
fog_settled_gate.hpp,system_fog_reveal_eval.hpp, the settings component,perf_grid/main.cpp, both design docs, and the settled-window tests against the gate'sarmed_/nodeSettling_semantics. - CI on head:
format-check,comment-refs,header-checks,instruction-refs,instruction-size,whitespace,closes-lint,no-plan-filespass.linux-buildandperf-gateare still pending, so those two are unread, not green.all-checkswaits on them; the merge should wait onlinux-build. - Not run by me: the build, the 82 focused tests,
render-verify, and the Metal perf pairs. The body reports them on this head, except thatdocs/perf/fog-reveal-stagger/measurements.csvwas measured on the pre-rebase head. The rebase adds only anodeSettling_bool test to the window early return and a gate-compare term, so I do not expect it to move the 0.32–0.37 ratios.
Test plan the author should run before merge
-
linux-buildgreen on8581cab18(pending at review time).
🤖 Reviewed by Claude Sonnet 5.5 (review-pr skill)
Escalation: none. Safe for merge.
Opus recheck not required.
Perf gateHead host slug: perf comparison: ea61318 → e35f654-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 |
221.614 → 220.568 (-0.5%) |
| RENDER | ComputeLightVolume |
32.776 → 32.460 (-1.0%) |
| RENDER | ComputeSunShadow |
16.312 → 16.403 (+0.6%) |
| RENDER | CanvasToFramebuffer |
15.157 → 15.536 (+2.5%) |
| RENDER | BakeSunShadowMap |
7.768 → 7.516 (-3.2%) |
| UPDATE | FogRevealEval |
3.244 → 4.636 (+42.9%) ⚠ |
| UPDATE | PropagateTransform |
3.750 → 3.833 (+2.2%) |
| RENDER | LightingToTrixel |
3.419 → 3.507 (+2.6%) |
target=IRLuaPerfGrid,zoom=4,sub_mode=full,sub_base=1
| pipeline | system | avg ms (base→head) |
|---|---|---|
| RENDER | SingleVoxelToCanvasFirst |
697.514 → 698.937 (+0.2%) |
| RENDER | ComputeSunShadow |
32.671 → 32.262 (-1.3%) |
| RENDER | ComputeLightVolume |
29.268 → 30.255 (+3.4%) |
| RENDER | CanvasToFramebuffer |
14.307 → 14.168 (-1.0%) |
| RENDER | LightingToTrixel |
7.151 → 7.523 (+5.2%) |
| RENDER | ComputeVoxelAO |
7.149 → 6.983 (-2.3%) |
| RENDER | BakeSunShadowMap |
6.664 → 6.603 (-0.9%) |
| UPDATE | FogRevealEval |
3.278 → 4.352 (+32.8%) ⚠ |
target=IRPerfGrid,zoom=1,sub_mode=full,sub_base=1
| pipeline | system | avg ms (base→head) |
|---|---|---|
| RENDER | SingleVoxelToCanvasFirst |
235.226 → 247.054 (+5.0%) |
| RENDER | ComputeSunShadow |
38.752 → 39.888 (+2.9%) |
| RENDER | ComputeLightVolume |
30.436 → 32.059 (+5.3%) |
| RENDER | LightingToTrixel |
19.417 → 19.614 (+1.0%) |
| RENDER | CanvasToFramebuffer |
15.402 → 16.289 (+5.8%) |
| RENDER | BakeSunShadowMap |
9.598 → 10.379 (+8.1%) |
| UPDATE | PropagateTransform |
5.394 → 5.416 (+0.4%) |
| RENDER | FogToTrixel |
4.567 → 4.596 (+0.6%) |
target=IRPerfGrid,zoom=4,sub_mode=full,sub_base=1
| pipeline | system | avg ms (base→head) |
|---|---|---|
| RENDER | SingleVoxelToCanvasFirst |
1045.059 → 1044.715 (-0.0%) |
| RENDER | ComputeSunShadow |
43.619 → 43.981 (+0.8%) |
| RENDER | ComputeLightVolume |
30.826 → 30.863 (+0.1%) |
| RENDER | CanvasToFramebuffer |
14.061 → 14.075 (+0.1%) |
| RENDER | BakeSunShadowMap |
6.511 → 6.514 (+0.0%) |
| RENDER | LightingToTrixel |
5.891 → 5.895 (+0.1%) |
| RENDER | ComputeVoxelAO |
5.813 → 5.823 (+0.2%) |
| UPDATE | PropagateTransform |
5.405 → 5.428 (+0.4%) |
Summary
Test plan
IrredenEngineTest,IRPerfGrid,IRFogDemo,IRLightingEmissive, andIRCanvasStresssuccessfullyIRShapeDebugandIrredenEngineTestsuccessfully8581cab18, ran 82 focused fog/window tests: all passed, including the settled-resident and real-pipeline casesrender-verifyfor IRPerfGrid: all 21 checks passed; maximum delta 0render-verifyfor IRFogDemo: all 69 checks passedlight-verify --if-changed: domain, boundary, and hover checks all passedformat-changed, header convention checks, comment-reference lint, andgit diff --checkAcceptance evidence
render-verify --target IRPerfGridwindowPeriod_defaults to 1; window-one retains the strided schedule; all 21 default render checks passed with maximum delta 0FogRevealWindowTest.*FogRevealWindowTest.WindowTakesPrecedenceOverTheStridedPeriodandFogRevealWindowPipelineTest.*FogRevealSettledWindowTest.*--fog-stagger-period/--fog-window-periodPlan departures
Notes for reviewer
The existing strided control remains available when
windowPeriod_ == 1. For voxel BODY subjects, a non-default window deliberately takes precedence over the stride; ghost, shape, and canvas evaluators remain unchanged.The optimization pass covered one CPU hot-path file. The contiguous early return reduced the representative window-4 per-call cost from 1.791 ms to 0.574 ms (about 68%); no GPU path changed. The strided 4 and 16 controls were measured and refuted for this population.
windowPeriod_, and settled BODY passes arm for effective cadenceEwhile the other evaluators retainstaggerPeriod_.Screenshots
Deterministic frozen PerfGrid captures are byte-identical before and after in all seven views. The demo has no auto-record wiring, so the clip gate was skipped.
fit_grid
zoom1_origin
profiler_overlay
zoom1_rot
zoom4_rot
zoom4_pan
zoom4_rot_pan
Closes #5006
🤖 Generated with Codex