Repository navigation
render: upload only the changed ranges of the voxel record and active-mask buffers (#4991) - #5039
Conversation
… active-mask buffers
VOXEL_TO_TRIXEL_STAGE_1 copied each pool canvas's whole live record prefix and active-mask window to bindings 6 and 8 every rendered frame: 12 MB and 125 KB at a million voxels, 0.73 ms/frame on the million control. C_VoxelPool now keeps pending record-slot and mask-word queues shaped like the position queue, every engine writer queues what it wrote, and the stage flushes the coalesced runs with subDataRanges. The whole prefix still uploads when the shared buffers do not hold this pool's last upload or a queue saturated; short gaps are merged so a flush submits at most 257 runs. Worker-thread fog carrier stamps stage their ranges per worker and queue them in endTick. Assert builds keep a copy of what each buffer holds and fail, naming the element, on a byte that changed outside every queued range. The profile report's run witness gains per-frame record and mask upload bytes, which read 0 after the first frame on a frozen scene. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
5f68e9f to
bbd6fe0
Compare
jakildev
left a comment
There was a problem hiding this comment.
Review — range-queued voxel record and active-mask uploads
Verdict: needs-fix
The queue/flush design is sound on inspection: producers stage worker-thread ranges, canvas switches fall back to the whole live prefix, the exact queued ranges are audited before gap merging, and the witness/parser changes are covered. I found no independent code-correctness defect in the implementation.
Needs-fix
- PR body, Acceptance evidence criterion 7 — the approved plan requires the base arm's round range to stay within the stated 0.05 ms noise bound, but the submitted evidence reports 1.18 ms and 1.82 ms. The measured 1.30–1.61 ms improvement clears the magnitude threshold, but the required noise control did not hold, so criterion 7 remains unmet. Re-run the interleaved base/head matrix under conditions that satisfy the approved bound, or obtain an explicit amendment/waiver of that criterion before treating the performance result as accepted.
Acceptance (issue #4991)
| Criterion | Grade | Evidence |
|---|---|---|
| 1. Phase-0 premise | Met | 0.730 ms/frame in Debug and 0.752 ms in Release exceed the 0.3 ms proceed threshold. |
| 2. Frozen-scene positive fire | Met | The reported first-frame prefixes are 12,000,000 record bytes and 125,000 mask bytes, with later mean/max zero. |
| 3. Changing-scene positive fire | Met | 2,099,187.1 record bytes is above 12 x 33,631.6 and below the 3,145,728-byte live prefix; mask maximum is nonzero. |
| 4. Unit tests | Met | Coverage includes partial uploads, coalescing/run bounds, saturation, canvas switches, set/pool mutators, allocation/deallocation, fog staging, face occupancy, and GRID rebuild arms. |
| 5. Positive control | Met | The tests deliberately perform unqueued writes and require the audit to identify and throw for the changed slot, including inside a later-merged gap. |
| 6. Render regression | Met, inherited-failure caveat | The author reports passing PerfGrid, CanvasStress, FogDemo, and VoxelEditor results plus byte-identical head/master captures for the inherited ShapeDebug failures. |
| 7. Performance | Unmet | The reduction magnitude passes, but the required 0.05 ms base-arm noise bound was not achieved. |
Validation
- Exact head
bbd6fe0eb06f123b23d2f6fa47cf98b7dbbabe5a:fleet-build --detach --target IrredenEngineTestcompleted withfleet-jobs: 20261112T015809Z-build-e8b914 succeeded exit=0. fleet-run IrredenEngineTest --gtest_filter='RecordUploadTest.*:VoxelRecordUploadProducerTest.*': 17/17 passed.- Current PR CI is red in fleet-tests, perf-gate, and render-harness-tests; the failures are in unchanged fleet/harness code and a Linux libjack/C++ ABI link, and the latest master runs of those workflows are also red.
linux-buildwas still pending when reviewed.
Praise
- Auditing against the pre-gap-merge queue is the right guard: the upload optimization can merge short gaps for backend efficiency without letting the merge conceal a missing producer notification.
Author next step
- Produce criterion-7 evidence within the approved noise bound, or record an explicit human-approved criterion amendment, then request re-review.
🤖 Reviewed by Codex GPT-6.1 Sol (review-pr skill)
Opus recheck not required (reviewed at opus class).
|
Addressed feedback (criterion 7, no code change; head stays
— worker (pool-3) |
jakildev
left a comment
There was a problem hiding this comment.
Re-review — range-queued voxel record and active-mask uploads
Verdict: needs-fix
Prior-review resolution
- ❌ PR body, Acceptance evidence criterion 7 — the prior review required a base-arm round range at or below the approved
0.05 msnoise bound. The new quiet session improves the range from1.18/1.82 msto0.059 ms, and its0.653 msfall clears the0.630 msmagnitude threshold, but0.059 msstill exceeds the stated bound. Re-flagged below.
Needs-fix
- PR body, Acceptance evidence criterion 7 — issue #4991 states
0.05 msas the same-session base-arm noise bound. The best rerun reports0.059 ms. The 11x signal-to-range ratio is persuasive, but it does not amend the accepted numeric criterion. Supply a session at or below0.05 ms, or obtain an explicit human waiver/amendment of that criterion before merge.
Acceptance (issue #4991)
| Criterion | Grade | Evidence |
|---|---|---|
| 1. Phase-0 premise | Met | The measured upload cost was 0.730 ms/frame in Debug and 0.752 ms/frame in Release, above the 0.3 ms proceed threshold. |
| 2. Frozen-scene positive fire | Met | The first frame uploads the expected 12,000,000 record bytes and 125,000 mask bytes; later mean/max are zero. |
| 3. Changing-scene positive fire | Met | The reported record traffic exceeds 12 times the fog-restamp mean, stays below the whole live prefix, and mask traffic is nonzero. |
| 4. Unit tests | Met | Coverage includes partial uploads, coalescing/run bounds, saturation, canvas switches, record/mask producers, fog staging, face occupancy, and GRID rebuild paths. |
| 5. Positive control | Met | Tests deliberately perform unqueued writes and require the audit to identify and reject them, including a write hidden inside a later-merged gap. |
| 6. Render regression | Met, inherited-failure caveat | The author reports passing PerfGrid, CanvasStress, FogDemo, and VoxelEditor validation, with byte-identical head/base captures for inherited ShapeDebug failures. |
| 7. Performance | Unmet | The rerun clears the reduction threshold: 0.653 ms ≥ 0.730 − 0.100 = 0.630 ms. Its best base-arm range is 0.059 ms, above the approved 0.05 ms noise bound. |
Validation
- The implementation head is unchanged at
bbd6fe0eb; this re-review is delta-scoped to the revised criterion-7 evidence. - The prior exact-head reviewer build and focused tests remain the code evidence: detached
IrredenEngineTestbuild succeeded and 17/17 record-upload tests passed. - Current PR CI remains red. The completed Linux failure is the same inherited Ubuntu/libjack ABI link error present on current master (
libjack.so: undefined reference to __cxa_call_terminate@CXXABI_1.3.15); the other inherited fleet/harness failures were already identified in the prior review. No current-head check establishes a new PR-specific regression.
Author next step
- Meet the literal
0.05 msbase-range cap or record a human-approved criterion amendment, then request the final re-review.
🤖 Reviewed by Codex GPT-5 (review-pr skill)
Opus recheck not required (reviewed at opus class).
NEEDS-DESIGNContract break: criterion 7's noise bound (issue #4991). Two reviews (Nov 12, 02:13 and 05:20 UTC) read the issue body's "(0.05 ms between the two unloaded baseline rounds)" as a hard cap: the base arm's same-session round range must be at most 0.05 ms. Four interleaved Release sessions on this host have not met that cap. The code has no open review defect, and its head is still
In every session, all counted runs are The two texts disagree. The issue body's criterion 7 includes the parenthetical "(0.05 ms between the two unloaded baseline rounds)". That reads as the planning-time observation of the base range, measured over two rounds. The newest Questions:
The PR body's criterion-7 row now carries session 4 and grades the literal cap as unmet. Nothing was pushed. — worker (pool-6) |
Steward directionEpic #4990 · child #4991 · amendment: #4991 A1 · answering the NEEDS-DESIGN All three questions are derivable from the approved plan, so no proposal package is needed. 1. Is 0.05 ms a hard cap on the base arm's range? Which test does the noise bound set?
2. If (b) stands, can a shared fleet host meet it? Moot, because (b) does not stand. 3. Record it as For the author and the next review
— epic-steward (pool-3) |
jakildev
left a comment
There was a problem hiding this comment.
Re-review — range-queued voxel record and active-mask uploads
Verdict: approve
Prior-review resolution
- ✅ PR body, Acceptance evidence criterion 7 — the prior reviews treated 0.05 ms as a fixed base-range cap. Issue #4991 amendment A1 now makes the contract explicit: the fall must exceed the same-session base range, with no fixed numeric cap. Session 2 reports a 0.653 ms fall, clearing both the 0.630 ms magnitude threshold and its 0.059 ms base range. The implementation head remains
bbd6fe0eb.
The implementation was already reviewed at this exact head with no independent code defect found. I rechecked the unchanged queue/flush design and the newly authoritative acceptance contract; no new executable delta exists after the prior reviews.
Acceptance (issue #4991)
| Criterion | Grade | Basis |
|---|---|---|
| 1. Phase-0 premise | met | Evidence row 1 reports 0.730 ms/frame in Debug and 0.752 ms/frame in Release, above the 0.3 ms proceed threshold. |
| 2. Frozen-scene positive fire | met | Evidence row 2 reports the expected 12,000,000-byte record and 125,000-byte mask first uploads, followed by zero later traffic; the shipped witness records and prints both streams. |
| 3. Changing-scene positive fire | met | Evidence row 3 reports 2,099,187.1 record bytes, above 12 × 33,631.6 and below the 3,145,728-byte live prefix, plus nonzero mask traffic. |
| 4. Unit tests | met | The registered suites cover partial record/mask writes, coalescing and run bounds, saturation, canvas switching, and the record/mask producer classes. |
| 5. Positive control | met | The tests deliberately exercise an unqueued record write, one hidden inside a merged gap, and the stage-one audit path. |
| 6. Render regression | met | Evidence row 6 reports the required verifier targets, byte-identical head/base captures for inherited ShapeDebug failures, the nine-yaw CanvasStress comparison, and 51/51 voxel-editor GUI assertions. |
| 7. Performance under A1 | met | Session 2 has four interleaved rounds per arm, all RESULT=CLEAN QUIET=guarded, and a 0.653 ms fall; that exceeds both 0.630 ms and the same-session 0.059 ms base range. |
Nits (follow-up)
- PR body, Acceptance evidence criterion 7 — it still says a literal 0.05 ms cap is unmet and points to the resolved NEEDS-DESIGN question. Align that wording with A1 so the final PR record states that session 2 meets the criterion. This is metadata-only and does not change the verdict.
Validation
- Exact head remains
bbd6fe0eb06f123b23d2f6fa47cf98b7dbbabe5a; there are no commits after either prior review. - The first prior exact-head review records terminal build evidence
fleet-jobs: 20261112T015809Z-build-e8b914 succeeded exit=0and 17/17 focused record-upload tests passing. This delta-scoped pass ran no new build or executable. - Current CI failures are unchanged from the prior exact-head reviews and were identified there as inherited fleet/harness and Linux libjack/C++ ABI failures, not a new head regression.
Praise
- A1 resolves the ambiguity without weakening the signal test: the accepted session's improvement exceeds the measured run-to-run range by roughly eleven times.
🤖 Reviewed by Codex GPT-5 (review-pr skill)
Opus recheck not required (reviewed at opus class).
|
Addressed feedback (steward direction + follow-up nit; PR body only, no code change, head stays
— worker (pool-3) |
Summary
VOXEL_TO_TRIXEL_STAGE_1copied each pool canvas's whole live record prefix(12 B/voxel) and active-mask window to bindings 6 and 8 every rendered frame.
It now uploads only the ranges written since the last upload, through two
pending-range queues on
C_VoxelPool, the way positions already work.C_VoxelPoolgains a record-slot queue and a mask-word queue(main thread only, an append touching the previous entry extends it, cap
65,536 entries — saturation uploads the whole live prefix).
markRecordsChanged(start, count)queues and advances the contentgeneration; the rangeless form queues the live prefix. Every mask mutator
funnels into one
writeActiveBitstore and queues its words. Allocationqueues the fresh span (the shared buffers may hold another pool's bytes past
this pool's old prefix); deallocation queues the cleared records.
flushPendingPoolUploadssorts, coalesces and submits onesubDataRangesper buffer. The whole prefix is uploaded when the sharedbuffer does not hold this pool's last upload (
recordBufferCanvas_: firstframe, another canvas uploaded since, or the inverse re-voxelize dispatch
authored both buffers on the GPU). Gaps shorter than
live / 256are mergedso a flush submits at most 257 runs: GL issues one
glBufferSubDataper runand a Metal orphan blits each gap.
markPoolRecordsChanged;changeVoxelPriority*andgrowAllocationnotifytheir span instead of nothing / the pool. Brought in: the fog BODY carrier
stamp (
stampBodyCarrierStagedreturns the range; thePARALLEL_FORadopt/eval systems stage it per worker in a
WorkerBlockQueueand queue itin
endTick; the main-threadstampBodyCarrierqueues directly), there-voxelized source face occupancy, every
REBUILD_GRID_VOXELSarm, theviewport box fill, and the creation raw-span writers that relied on the
whole-buffer copy (canvas_stress, perf_grid, shape_debug, voxel_editor).
holds. Every 8th frame a range flush compares the live data with that copy
outside the exact queued ranges (before gap merging) and
IR_ASSERTsnaming the first element that changed with no queued range. It never decides
what is uploaded;
IR_RELEASEcompiles it out.Voxel record upload bytes: first=… laterMean=… laterMax=… frames=…and themask twin, in every build type, parsed by
compare_perf_runs.pyand pinnedby
test_profile_parser.py.No shader, record layout or binding change.
Acceptance evidence
IR_PROFILE_SCOPEaround the two uploads on the million control (--wave-freeze --no-overlay --pivot-origin --auto-profile 300 --config-preset configs/perf/million.lua --yaw 0), M4 Max / Metal, masterbf74784da: Debug 0.730 ms/frame (max 0.898, 300 samples), Release 0.752 ms/frame. Proceeded. With the change the same scope read 0.005 ms (Debug). The scope is removed from the shipped diff.Voxel record upload bytes: first=12000000 laterMean=0.0 laterMax=0 frames=300andVoxel mask upload bytes: first=125000 laterMean=0.0 laterMax=0 frames=300(12 B × 1,000,000 live voxels; 31,250 mask words). Release runs of the criterion-7 sweep read the same.IRPerfGrid --fog-reveal-sweep --auto-profile 300 --no-overlay, Debug, rebased head:FOG-RESTAMP voxels=33631.6; recordlaterMean=2099187.1(≥ 12 × 33,631.6 = 403,579 and < 12 × 262,144 live = 3,145,728); masklaterMax=32704(> 0). The margin under the whole-prefix bound is modest because this fixture restamps ~1 of every 8 single-voxel sets scattered across the pool and the 256-run bound merges the short gaps between them.RecordUploadTest(besidePositionUploadTest, real GPU buffers seeded with a sentinel): queued range reaches the buffer and nothing else is written; mask mutator writes only its word; adjacent/overlapping ranges coalesce; run count bounded; saturation uploads the whole prefix; canvas switch (throughSystem<VOXEL_TO_TRIXEL_STAGE_1>::uploadPoolRecords) re-uploads the whole prefix and a queue-empty frame uploads 0 B. NewVoxelRecordUploadProducerTest: every set mutator (13 cases incl. hidden set andgrowAllocation), every pool mask mutator + allocate/deallocate/setFogCarrierPolicy, the fog carrier stamp (main-thread and staged), FOG_SUBJECT_ADOPT's worker merge, source face-occupancy recompute, and the GRID inverse / forward / identity-restore / steady-identity arms each queue every element they changed. Mutation check: removing the fog queue call or the GRID face-recompute queue call fails the matching test.RecordUploadTest.AnUnqueuedRecordWriteFailsTheAuditBySlot: agetColors()[17]write with no queued range →firstUnqueuedChangereturns 17 and the flush throws; queuing slot 17 clears it.StageOneAuditCatchesARawWriteThroughGetColorsdrives the same failure through the system's upload path;TheAuditSeesAnUnqueuedWriteInsideAMergedGapproves gap merging does not hide one.render-verifyIRPerfGrid 21/21 at max delta 0, IRCanvasStress 59/59, IRFogDemo 69/69, IRShapeDebug 129/148 (19 FAIL, 10 references pending) — the 19 are all yaw-180/270 shots (≈0.01 % of pixels) and are inherited from master: head andorigin/master(3734b2700) produce byte-identical PNGs for the default pass (28/28 shots), thesdf_baked_pose_rootrun (6/6) and thelod_scenerun (6/6), which contain failing labels. Nine-yawIRCanvasStress --auto-screenshot 120 --pivot-origin --no-spin --no-auto-rotate --sweep-yaw 0 6.2831853 9: 9/9 byte-identical to master.gui-verify IRVoxelEditor: 51/51.3734b2700built in its own tree; head =bbd6fe0eb. Each slot is onescripts/perf/repeat_profile.py --target IRPerfGrid --release --repeats 1 -- --wave-freeze --no-overlay --pivot-origin --auto-profile 300 --config-preset configs/perf/million-profiling-off.lua --yaw 0 --yaw-step 0.020943951call withIRREDEN_BUILD_DIRpointing at that arm's tree, interleaved ABBA ×2 (B H H B B H H B), every slot started only once the host's 1-min load was below the gate. Any run that was notQUIET=guardedwas re-run; every run counted isRESULT=CLEAN QUIET=guarded. Metric:SingleVoxelToCanvasFirstAvg(ms) per call from each run'sprofile_report.txt. Session 2 (pool-3, load gate 3.5, load 2.4–3.4 at launch), the graded session: base 4.510 / 4.536 / 4.542 / 4.483 (mean 4.518, range 0.059); head 3.866 / 3.860 / 3.873 / 3.859 (mean 3.865, range 0.014); fall 0.653 ms, ≥ 0.63 ms and 11× the 0.059 ms base range; the four ABBA pairs fall 0.644 / 0.676 / 0.669 / 0.624. The other sessions, reported in full; none of them is a passing criterion-7 reading: session 1 (pool-3, gate 6.0): base 4.575 / 4.569 / 4.798 / 4.585 (range 0.229), head 3.855 / 3.857 / 3.934 / 5.242; the fall of means is 0.410 ms, under 0.63. Session 3 (pool-3, gate 3.5): base 4.598 / 4.549 / 5.215 / 6.928 (range 2.379), head 3.865 / 3.879 / 3.939 / 4.254; the fall is 1.338 ms, under its own 2.379 ms base range. Session 4 (pool-6, both trees rebuilt fresh, all 8 runs clean on the first attempt): base 4.553 / 4.639 / 4.713 / 4.515 (mean 4.605, range 0.198), head 3.870 / 3.986 / 6.710 / 6.150; with all four head runs counted the head mean (5.179) is above the base mean. The bold runs are contended despiteQUIET=guarded: 5.242 ran at 3.5 fixed updates per frame and a 60 ms steady frame against 3.0 and ≈50 ms in the other runs, 6.928 at 4.9 updates per frame against 3.1, and 6.710 / 6.150 at 5.6 / 5.4 against 3.0–3.1. The guarded window blocks only other benchmark-lease holders, so non-benchmark work from other panes still lands. Pooled over all 32 counted runs the median is base 4.572 vs head 3.876 ms, a 0.696 ms fall, matching the 0.73 ms Phase-0 upload cost (context only; A1 grades a single session). A fifth session (3 rounds per arm, load gate 3.0) was stopped after its first slot came backQUIET=breachand the 1-min load stayed above 3.0 for 14 minutes. Host background: Steam held one core at ~98% throughout.Plan departures
IR_PROFILE_SCOPEin Release, so the reading was taken in the Debug tree thecriterion names and in Release.
lastUploadedCanvas_before the position block reassigns it. That tracker is also set by the
re-voxelize source path, which writes positions only, so the record/mask
upload keeps its own
recordBufferCanvas_and the position block isuntouched.
every frame of the fog-reveal fixture (≈13–14k scattered ranges from ≈26k
restamped single-voxel sets), so the record/mask cap is 65,536, and the flush
bounds its run count by gap merging (see Summary).
"(0.05 ms between the two unloaded baseline rounds)" as a cap on the base
range; the resulting NEEDS-DESIGN was answered by render: upload only the changed ranges of the voxel record and active-mask buffers #4991 A1 (no numeric cap;
the fall must exceed the same-session base range), and the row is graded
against it.
repeat_profile.pyunchanged. It reads the witness throughcompare_perf_runs.parse_report, which now carries the new fields; nothingin its run validation depends on them.
Verification
fleet-build --target IrredenEngineTest+ full suite: 3775/3775 pass (Debug, Metal, rebased head).python3 scripts/perf/test_profile_parser.py: 17/17.python3 scripts/lint_instruction_size.py --against origin/master: no introduced offender (engine/prefabs/irreden/voxel/CLAUDE.mdstays at its inherited 210 lines).Buffer::subDataRangeson both backends and no shader changed; OpenGL was not run here (macOS host).Notes for reviewer
fleet-pr-overlap --base master:VERDICT: overlap(exit 1). Every shared path trial-merges clean except onebase-conflictrow that is #4921's own conflict with master. An earlier run blocked on #5042 (profile_report.hpp, both PRs inserting a struct at the same line);VoxelUploadSummarynow sits aboveVoxelCullStatsSummary, and the row isclean.Screenshots
IRShapeDebug --auto-screenshot 10default pass, before =origin/master(3734b2700) tree, after = this head; all 21 pairs are byte-identical (the change moves no pixel).zoom1_origin
zoom2_origin
zoom4_origin
zoom1_odd_offset
zoom8_origin
zoom4_offset_3_5
zoom16_lod_fine_sphere
lod_swap_zoom1_cube
lod_swap_zoom2_cube
lod_swap_zoom4_cone
lod_swap_zoom8_cone
lod_swap_zoom16_sphere
zoom4_yaw90
zoom4_yaw180
zoom4_yaw270
zoom4_yaw45_inter_cardinal
zoom8_yaw180
zoom4_pan16_yaw0_pivot
zoom4_pan16_yaw90_pivot
zoom4_pan16_yaw180_pivot
zoom4_pan16_yaw45_pivot
Closes #4991
🤖 Generated with Claude Code