Repository navigation
Conversation
Use the shared face-sort record width for both source-face and overflow-family addresses, CPU sizing, shader adapters, and tests. Extend the hermetic source test with dialect checks and mutation controls so either caller family cannot drift back to a literal width.
jakildev
left a comment
There was a problem hiding this comment.
Review — render: single-source overflow sort record width (#4945)
Verdict: needs-fix
The PR leaves one overflow reader family on literal 4u widths: the env-gated overflow census from #5084. That family is also missing from the test's site census, so acceptance criterion 2 is unmet.
Needs-fix
engine/prefabs/irreden/render/systems/system_trixel_to_framebuffer.hpp:237—countOverflowOwnersstill sizes the censusbindRangeaskOverflowControlUints + overflowCap_ * 4u. This is the same kind of CPU caller as the composite binding at :797, which the PR converted. Change it to* kFaceSortRecordWords.engine/render/src/shaders/c_per_axis_overflow_census.glsl:54andengine/render/src/shaders/metal/c_per_axis_overflow_census.metal:50—entryBase = ... + gid * 4u. Convert both tokFaceSortRecordWords. The census shaders only includeir_scatter_depth.*andir_per_axis_face_footprint.*, so confirm the constant reaches them through those includes, or includeir_iso_common.*. Also update the "four-word records" comment at glsl:21 / metal:27.scripts/tests/test_render_source_face_order.py:12-45— add a "census reader" row per dialect toOVERFLOW_WIDTH_SITESand a "census binding" row toCPU_WIDTH_SITES. Without these rows, a width change at the three sites above does not fail the test (criterion 2: the test "fails by name when any record-addressing site … uses a width other than the shared constant"). After the fix, grep once more for\* 4unext tooverflowCap_/overflowScratchLayout.z/kOverflowControlUintsacrossengine/to confirm nothing else is left. The plan predates #5084, so its Affected-files list could not have named these sites.
Nits
scripts/tests/test_render_source_face_order.py:156-161— the* 3uface-family mutation control now mutates only the GLSL emitter (index * …). The control it replaces ran for both dialects and also mutated the reader (instanceId * …). The plan asked to keep the #4936 control, so consider restoring the per-dialect emitter+reader loop.engine/render/src/shaders/c_light_overflow_faces.glsl:99-100— the comment still says "Entry i: 4 uints at overflowScratchLayout.z + i*4".test/render/gpu_compute_dispatch_test.cpp:2477-2481— theRecord{...}brace-init still lists four explicit words. With a wider constant it would still compile and silently zero-fill the rest. A loop overkFaceSortRecordWordswould keep it width-agnostic.
Acceptance (issue #4945)
3 of 5 met.
- 2. Source test covers every record-addressing site — unmet. The census sites are missing (see Needs-fix).
- 3. Build / light-verify / CI green — unverifiable for now. The build and light-verify jobs are audited as succeeded after the head commit.
render-harness-tests,linux-build,fleet-testsandperf-gateare still in progress on a7c91c8. - Criterion 4 also asks the body to cite where the shot-count warning was seen (
a6b9953c3,45cf005a8) and to name #4925 as its owner. Row 4 says only "pre-existing". This is a body edit only.
Checked
- Read the full diff at a7c91c8, plus the shared constant:
ir_render_types.hpp:122,ir_iso_common.glsl:1354,metal/ir_iso_common.metal:1340. The sort shader and the stage-2 / source-face users already use the constant on master. - Swept the shaders and engine C++ for remaining literal-width overflow addressing; this found the three census sites above.
- Ran locally:
test_render_source_face_order.py(OK; both dialects printoverflow_records=PASS shared_width=PASS),test_render_overflow_append.py(OK) andtest_render_per_axis_receiver.py(OK). - CI: shader-parity, header-checks, format-check and python-lint are green. render-harness-tests, linux-build, fleet-tests and perf-gate have not finished, so they are unread.
- Render checklist: no struct layout or binding changes and no new shaders. Only the multiplier changed; the value is the same (4), so pixels are byte-identical as claimed.
Test plan the author should run before merge
- Convert the three census sites and add their rows to the site census.
- Re-run
python3 -m unittest discover -s scripts/tests -p test_render_source_face_order.py -v. - Run
fleet-build --target IRShapeDebug(the census shaders compile only underIR_PERAXIS_OVERFLOW_CENSUS=1, so start one run with it set to prove the constant resolves). - Confirm render-harness-tests and linux-build are green on the new head.
Escalation: author-agent to address, then re-request review.
Opus recheck not required.
🤖 Reviewed by Claude Sonnet 5.5 (review-pr skill)
Perf gateHead host slug: perf comparison: 69fca9e → b82dd02-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 |
219.587 → 216.822 (-1.3%) |
| RENDER | CanvasToFramebuffer |
25.042 → 25.143 (+0.4%) |
| RENDER | ComputeLightVolume |
25.633 → 25.087 (-2.1%) |
| UPDATE | FogRevealEval |
8.013 → 9.096 (+13.5%) ⚠ |
| RENDER | BakeSunShadowMap |
5.958 → 6.024 (+1.1%) |
| UPDATE | PropagateTransform |
3.601 → 3.679 (+2.2%) |
| RENDER | UpdateVoxelSetChildren |
2.566 → 3.023 (+17.8%) ⚠ |
| UPDATE | LuaWaveStateToOffset |
2.725 → 2.917 (+7.0%) |
target=IRLuaPerfGrid,zoom=4,sub_mode=full,sub_base=1
| pipeline | system | avg ms (base→head) |
|---|---|---|
| RENDER | SingleVoxelToCanvasFirst |
723.097 → 723.506 (+0.1%) |
| RENDER | CanvasToFramebuffer |
35.845 → 36.414 (+1.6%) |
| RENDER | ComputeLightVolume |
22.987 → 22.849 (-0.6%) |
| UPDATE | FogRevealEval |
7.998 → 8.248 (+3.1%) |
| RENDER | ComputeVoxelAO |
7.066 → 7.034 (-0.5%) |
| RENDER | BakeSunShadowMap |
5.269 → 5.094 (-3.3%) |
| UPDATE | PropagateTransform |
3.460 → 3.517 (+1.6%) |
| UPDATE | LuaWaveStateToOffset |
3.151 → 3.212 (+1.9%) |
target=IRPerfGrid,zoom=1,sub_mode=full,sub_base=1
| pipeline | system | avg ms (base→head) |
|---|---|---|
| RENDER | SingleVoxelToCanvasFirst |
236.960 → 236.067 (-0.4%) |
| RENDER | CanvasToFramebuffer |
36.139 → 37.534 (+3.9%) |
| RENDER | ComputeSunShadow |
29.622 → 30.404 (+2.6%) |
| RENDER | ComputeLightVolume |
24.279 → 24.013 (-1.1%) |
| RENDER | LightingToTrixel |
18.460 → 18.494 (+0.2%) |
| RENDER | BakeSunShadowMap |
8.197 → 8.312 (+1.4%) |
| UPDATE | FogRevealEval |
6.799 → 7.238 (+6.5%) |
| UPDATE | PropagateTransform |
4.704 → 4.733 (+0.6%) |
target=IRPerfGrid,zoom=4,sub_mode=full,sub_base=1
| pipeline | system | avg ms (base→head) |
|---|---|---|
| RENDER | SingleVoxelToCanvasFirst |
1098.407 → 1106.028 (+0.7%) |
| RENDER | CanvasToFramebuffer |
44.368 → 45.672 (+2.9%) |
| RENDER | ComputeLightVolume |
22.118 → 22.346 (+1.0%) |
| UPDATE | FogRevealEval |
6.842 → 7.664 (+12.0%) ⚠ |
| RENDER | ComputeVoxelAO |
5.722 → 5.891 (+3.0%) |
| RENDER | BakeSunShadowMap |
5.252 → 5.330 (+1.5%) |
| UPDATE | PropagateTransform |
4.877 → 4.942 (+1.3%) |
| RENDER | UpdateVoxelSetChildren |
2.772 → 3.138 (+13.2%) ⚠ |
|
Every failed workflow on this head is also red on master:
These failures are inherited and are not this pull request's to fix. |
|
Addressed feedback:
— worker (Codex) |
jakildev
left a comment
There was a problem hiding this comment.
Re-review — render: single-source overflow sort record width (#4945)
Verdict: approve (re-review of 9f5603ee9, delta-scoped against a7c91c84c)
Every finding from the previous round is fixed, and nothing outside those findings changed. With the overflow census family converted, every overflow record-addressing site uses kFaceSortRecordWords, and the site census now names each of them.
Previous findings
- Census CPU binding: fixed.
system_trixel_to_framebuffer.hpp:237now sizes the censusbindRangewith* kFaceSortRecordWords. The composite binding at :797 already uses the same constant in this scope. - Census shader readers: fixed. The census
entryBaseuses the shared constant inc_per_axis_overflow_census.glsl:54andmetal/c_per_axis_overflow_census.metal:50. Both files reach the constant throughir_scatter_depth.*→ir_iso_common.*, which define it at glsl:1354 / metal:1340. Both header comments were updated. - Site census rows: fixed. Each dialect has a
census readerrow inOVERFLOW_WIDTH_SITES, andCPU_WIDTH_SITEShas acensus bindingrow. The two CPU rows for the same file stay distinct by anchoring onstd::size_t(census) andsize_t(composite), and each expects exactly one match. - Face-family
* 3ucontrol (nit): fixed. Emitter (index *) and reader (instanceId *) are each mutated separately for both GLSL and Metal, as subtests. c_light_overflow_faces.glslcomment (nit): fixed.- GPU test
Recordextraction (nit): fixed. A width-driven loop fillsstd::array<std::uint32_t, kFaceSortRecordWords>(gpu_compute_dispatch_test.cpp:2361). - Criterion 4 body citation: fixed. Row 4 now cites
a6b9953c3and45cf005a8and names #4925 as the owner.
Acceptance (issue #4945)
4 of 5 met; 1 cannot be checked yet.
- 1. Met. The two consecutive CanvasStress runs cited in the body match 59/59. The delta only renames a multiplier whose value stays 4, so output is unchanged.
- 2. Met. The census rows close the gap from the last round (verified locally; see Checked).
- 3. Cannot be checked yet. On the new head,
linux-build,render-harness-tests,fleet-testsandperf-gateare still pending. Light-verify on9f5603ee9could not run because the host had no display (exit 69,NO-DISPLAY). The author has addedfleet:needs-macos-hostso a display-capable macOS host runs it. That is the remaining gate; it is not a defect in the diff. - 4. Met.
- 5. Met. The write-back comments on #4904 and #4925 are cited in the PR body.
Checked
- Read the full delta
a7c91c84c..9f5603ee9(6 files, +36/−22). - Searched
engine/andtest/for any overflow/record address still multiplied by literal4u(overflowCap_,overflowScratchLayout.z,*OverflowControlUints,gid,instanceId,index): none found. - Ran locally on
9f5603ee9:test_render_source_face_order.py: 3/3 OK. Both dialects reportexact_permutation=PASS sorted_keys=PASS guard=PASSandoverflow_records=PASS shared_width=PASS, and all four emitter/reader mutation subtests fail as intended.test_render_overflow_append.py: OK.test_render_per_axis_receiver.py: OK.
- CI on the new head: format-check, header-checks, shader-parity, python-lint, whitespace and instruction-* are green. linux-build, render-harness-tests, fleet-tests and perf-gate are pending and unread. On the prior head, render-harness-tests was already red on master (#5234).
- Render checklist: struct layout, bindings, dispatch grids and shader set are unchanged. Only the multiplier names changed, and the value is the same.
Nits (follow-up)
None.
🤖 Reviewed by Claude Sonnet 5.5 (review-pr skill)
Opus recheck required: the diff touches core render paths (engine/render shaders, the TRIXEL_TO_FRAMEBUFFER system), and this was reviewed at sonnet class; one Opus pass is owed before approval.
Perf gateHead host slug: perf comparison: 69fca9e → 9f00355-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 |
219.587 → 218.581 (-0.5%) |
| RENDER | ComputeLightVolume |
25.633 → 25.953 (+1.2%) |
| RENDER | CanvasToFramebuffer |
25.042 → 25.253 (+0.8%) |
| UPDATE | FogRevealEval |
8.013 → 8.210 (+2.5%) |
| RENDER | BakeSunShadowMap |
5.958 → 6.072 (+1.9%) |
| UPDATE | PropagateTransform |
3.601 → 3.634 (+0.9%) |
| RENDER | UpdateVoxelSetChildren |
2.566 → 2.983 (+16.3%) ⚠ |
| RENDER | ComputeVoxelAO |
2.763 → 2.903 (+5.1%) |
target=IRLuaPerfGrid,zoom=4,sub_mode=full,sub_base=1
| pipeline | system | avg ms (base→head) |
|---|---|---|
| RENDER | SingleVoxelToCanvasFirst |
723.097 → 729.559 (+0.9%) |
| RENDER | CanvasToFramebuffer |
35.845 → 36.958 (+3.1%) |
| RENDER | ComputeLightVolume |
22.987 → 22.008 (-4.3%) |
| UPDATE | FogRevealEval |
7.998 → 7.798 (-2.5%) |
| RENDER | ComputeVoxelAO |
7.066 → 7.172 (+1.5%) |
| RENDER | BakeSunShadowMap |
5.269 → 5.221 (-0.9%) |
| UPDATE | PropagateTransform |
3.460 → 3.468 (+0.2%) |
| RENDER | UpdateVoxelSetChildren |
2.843 → 3.081 (+8.4%) |
target=IRPerfGrid,zoom=1,sub_mode=full,sub_base=1
| pipeline | system | avg ms (base→head) |
|---|---|---|
| RENDER | SingleVoxelToCanvasFirst |
236.960 → 234.273 (-1.1%) |
| RENDER | CanvasToFramebuffer |
36.139 → 36.397 (+0.7%) |
| RENDER | ComputeSunShadow |
29.622 → 29.185 (-1.5%) |
| RENDER | ComputeLightVolume |
24.279 → 23.628 (-2.7%) |
| RENDER | LightingToTrixel |
18.460 → 17.920 (-2.9%) |
| RENDER | BakeSunShadowMap |
8.197 → 8.295 (+1.2%) |
| UPDATE | FogRevealEval |
6.799 → 7.236 (+6.4%) |
| UPDATE | PropagateTransform |
4.704 → 4.720 (+0.3%) |
target=IRPerfGrid,zoom=4,sub_mode=full,sub_base=1
| pipeline | system | avg ms (base→head) |
|---|---|---|
| RENDER | SingleVoxelToCanvasFirst |
1098.407 → 1104.385 (+0.5%) |
| RENDER | CanvasToFramebuffer |
44.368 → 45.680 (+3.0%) |
| RENDER | ComputeLightVolume |
22.118 → 22.081 (-0.2%) |
| UPDATE | FogRevealEval |
6.842 → 7.256 (+6.1%) |
| RENDER | ComputeVoxelAO |
5.722 → 5.949 (+4.0%) |
| RENDER | BakeSunShadowMap |
5.252 → 5.189 (-1.2%) |
| UPDATE | PropagateTransform |
4.877 → 4.847 (-0.6%) |
| RENDER | UpdateVoxelSetChildren |
2.772 → 3.079 (+11.1%) ⚠ |
Summary
Single-source the shared four-word face-sort record width across the overflow family: CPU allocation and dispatch sizing, GLSL and Metal append/sort/scatter paths, and receiver tests now all use
kFaceSortRecordWords. Extend the hermetic source-order test to cover both shader dialects and both caller families, with mutations proving a literal-width regression fails.Screenshots
No visual change: both consecutive 59-check IRCanvasStress runs were byte-identical on macOS Metal.
Acceptance evidence
python3 scripts/render-verify.py --target IRCanvasStress20261126T045019Z-render-verify-7afc94and20261126T045630Z-render-verify-0c4660each passed all 59 checks at 100% similarity / delta 0. The reference tree is unchanged.python3 -m unittest discover -s scripts/tests -p test_render_source_face_order.py -v9f5603ee9. Both dialects reportsource_faces=1287 exact_permutation=PASS sorted_keys=PASS guard=PASSandoverflow_records=PASS shared_width=PASS. The face-family control rejects* 3uindependently in each dialect's emitter and reader; the overflow control rejectsidx * 4u. The site census now covers both overflow-census shaders and their CPU binding.fleet-build --target IRShapeDebug;fleet-build --target IrredenEngineTest;fleet-build --target header-checks;fleet-run --timeout 15 IrredenEngineTest --gtest_filter=PositionUploadTest.OverflowSortHandlesFirstPopulationAndCountTransitions;python3 scripts/light-verify.py --if-changed9f5603ee9; the focused GPU test exited cleanly but skipped because this session exposes no Metal device. Light verification is blocked on this host session: detached job20261126T070134Z-light-verify-c5d6a3and the single direct rerun both endedRESULT=NO-DISPLAY/ exit 69 afterDiscovered 0 display monitors. The prior head's audited light-verify run passed; new-head display-backed validation remains required.captured 12 shots, manifest expects 6; ignoring extraswarning. The warning is also present at known-cleana6b9953c3and45cf005a8; #4925 owns its shot-count follow-up. No threshold, manifest, shot-count, or reference changes are included.1fe4e7cdb, the three-word/four-word sorter-width mismatch, #4936, and the two clean CanvasStress job IDs.Reviewer notes
Plan departures
20261126T042132Z-render-verify-509be0, could not acquire the GPU lock during an active benchmark window. No executable ran in its two lock-failed rows; it is not one of the two acceptance runs.9f5603ee9could not obtain display-backed evidence because the host session had no WindowServer connection. The build and source-level checks passed; the PR remains gated for a display-capable macOS validation.Notes for reviewer
fleet-pr-overlap --base master --repo jakildev/IrredenEnginereturnedVERDICT: overlap, which is publishable but requires review of these rows:engine/prefabs/irreden/render/systems/system_voxel_to_trixel.hpp— clean.engine/render/src/shaders/c_voxel_to_trixel_stage_1_body.glsl— base-conflict (the competitor already conflicts with current master).engine/render/src/shaders/metal/c_voxel_to_trixel_stage_1_body.metal— base-conflict (the competitor already conflicts with current master).engine/prefabs/irreden/render/systems/system_trixel_to_framebuffer.hpp— clean.test/render/gpu_compute_dispatch_test.cpp— clean.Closes #4945
Authored by Codex.