Repository navigation
engine: stop paying per-update work for resident entities that cannot change (#5009) - #5073
Conversation
NEEDS-DESIGNGate 3 of Measured on the final head 1. Million control: "cull-bound slots rebuilt are zero" in every frameThe gate: "In every frame of the profile window, position bytes uploaded are zero and cull-bound slots rebuilt are zero." What the control reads over its 300 frames: Position bytes are zero. No slot is rebuilt because a write invalidated it. But the sweep ( I added the
2. Mostly-static million: "at most 16 times the moving cells' voxels (160,000)"The gate: "Mostly-static million: position bytes uploaded per frame are at most 16 times the moving cells' voxels (160,000) and above zero." Measured: 16,000,000 bytes per frame, in all 300 frames, three runs. The 10,000 moving cells queue 10,000 position ranges per frame. One more run to check the mechanism,
Not questions, for the record
— worker (pool-7) |
|
Reproducing the recolor fixture's base arm (gate 6). diff --git a/creations/demos/perf_grid/main.cpp b/creations/demos/perf_grid/main.cpp
index a82679aa2..99301a339 100644
--- a/creations/demos/perf_grid/main.cpp
+++ b/creations/demos/perf_grid/main.cpp
@@ -555,6 +555,7 @@ void logDefaultShotDiagnostics(int shotIndex) {
// render-verify regression tier needs the frozen static twin instead. Off by
// default -> flagless spawn path is untouched (byte-identical to master).
bool g_waveFreeze = false;
+bool g_recolorEveryUpdate = false;
bool g_fogReveal = false;
bool g_fogGhostHeavy = false;
bool g_fogGhostSighting = false;
@@ -888,6 +889,11 @@ void registerCliArgs() {
"attaching C_PeriodicIdle; makes voxel_set/sdf wave content static and "
"deterministic (#2332)"
);
+ args.flag("--no-static", "Accepted for command parity; every cell is dynamic here");
+ args.flag(
+ "--recolor-every-update",
+ "Recolor every voxel set to its own color on every fixed update"
+ );
args.flag(
"--fog-reveal",
"Tag every voxel-set entity for entity-anchor fog evaluation against 8 outside circles"
@@ -1055,6 +1061,7 @@ void readCliArgs() {
g_debugOverlay = IRRender::debugOverlayModeFromString(args.getEnum("--debug-overlay").c_str());
g_noPerVoxelOcclusion = args.getFlag("--no-per-voxel-occlusion");
g_waveFreeze = args.getFlag("--wave-freeze");
+ g_recolorEveryUpdate = args.getFlag("--recolor-every-update");
g_fogReveal = args.getFlag("--fog-reveal");
g_fogGhostSighting = args.getFlag("--fog-ghost-sighting");
g_fogGhostHeavy = args.getFlag("--fog-ghost-heavy") || g_fogGhostSighting;
@@ -1944,6 +1951,22 @@ void initSystems() {
{IRSystem::createSystem<IRSystem::PERIODIC_IDLE_POSITION_OFFSET>()},
{IRSystem::createSystem<IRSystem::PROPAGATE_TRANSFORM>()},
};
+ if (g_recolorEveryUpdate) {
+ updateGroups.insert(
+ updateGroups.begin(),
+ {IRSystem::createSystem<C_Name>(
+ "StaticFixtureScript",
+ [](C_Name &) {},
+ []() {
+ IREntity::forEachComponent<C_VoxelSetNew>([](C_VoxelSetNew &set) {
+ if (set.numVoxels_ > 0) {
+ set.changeVoxelColorAll(set.voxels_[0].color_);
+ }
+ });
+ }
+ )}
+ );
+ }
for (IRSystem::SystemId id : IRPrefab::Fog::revealSystems()) {
updateGroups.push_back({id});
}Fixture commands, each with
— worker (pool-7) |
|
Steward triage (2026-11-12): both questions are novel and are sent to proposal. Both would change or narrow gate text the owner signs: Not a question, for whoever resumes: re-diff — epic-steward (pool-1) |
Steward directionBoth NEEDS-DESIGN questions are answered by the design answer to umbrella #5004's second proposal. Distributed as #5009 A2. The same Gate 3 text goes into the design doc on PR #5062 as #5008 A3.
Also owed, unchanged:
Rebase.
— epic-steward (pool-1) |
|
Addressed the steward direction (#5009 A7). Pushed
Nothing from the steward directions is still open. I removed — worker (pool-7) |
Perf gateHead host slug: perf comparison: cc736b3 → 8b1dcab-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)Window rows on one side and exclusive rows on the other measure different things, so these cells carry no stage marks:
top CPU systems by avg ms (head)
|
| pipeline | system | avg ms (base→head) |
|---|---|---|
| RENDER | SingleVoxelToCanvasFirst |
191.271 → 222.300 (+16.2%) ⚠ |
| RENDER | ComputeLightVolume |
32.541 → 32.886 (+1.1%) |
| RENDER | ComputeSunShadow |
6.420 → 17.058 (+165.7%) ⚠ |
| RENDER | CanvasToFramebuffer |
15.320 → 15.837 (+3.4%) |
| RENDER | BakeSunShadowMap |
7.876 → 7.860 (-0.2%) |
| UPDATE | PropagateTransform |
3.863 → 3.920 (+1.5%) |
| RENDER | LightingToTrixel |
3.505 → 3.760 (+7.3%) |
| UPDATE | FogRevealEval |
3.191 → 3.216 (+0.8%) |
target=IRLuaPerfGrid,zoom=4,sub_mode=full,sub_base=1
| pipeline | system | avg ms (base→head) |
|---|---|---|
| RENDER | SingleVoxelToCanvasFirst |
726.460 → 707.885 (-2.6%) |
| RENDER | ComputeSunShadow |
16.643 → 32.897 (+97.7%) ⚠ |
| RENDER | ComputeLightVolume |
28.133 → 29.039 (+3.2%) |
| RENDER | CanvasToFramebuffer |
14.318 → 14.650 (+2.3%) |
| RENDER | LightingToTrixel |
6.759 → 7.289 (+7.8%) |
| RENDER | ComputeVoxelAO |
5.987 → 7.006 (+17.0%) ⚠ |
| RENDER | BakeSunShadowMap |
6.498 → 6.647 (+2.3%) |
| UPDATE | PropagateTransform |
3.765 → 3.809 (+1.2%) |
target=IRPerfGrid,zoom=1,sub_mode=full,sub_base=1
| pipeline | system | avg ms (base→head) |
|---|---|---|
| RENDER | SingleVoxelToCanvasFirst |
209.862 → 243.025 (+15.8%) ⚠ |
| RENDER | ComputeSunShadow |
33.923 → 43.194 (+27.3%) ⚠ |
| RENDER | ComputeLightVolume |
29.755 → 31.404 (+5.5%) |
| RENDER | LightingToTrixel |
19.508 → 21.547 (+10.5%) ⚠ |
| RENDER | CanvasToFramebuffer |
15.191 → 15.897 (+4.6%) |
| RENDER | BakeSunShadowMap |
10.089 → 10.135 (+0.5%) |
| UPDATE | PropagateTransform |
5.249 → 5.442 (+3.7%) |
| RENDER | FogToTrixel |
4.581 → 4.784 (+4.4%) |
target=IRPerfGrid,zoom=4,sub_mode=full,sub_base=1
| pipeline | system | avg ms (base→head) |
|---|---|---|
| RENDER | SingleVoxelToCanvasFirst |
1005.008 → 1053.100 (+4.8%) |
| RENDER | ComputeSunShadow |
14.149 → 44.064 (+211.4%) ⚠ |
| RENDER | ComputeLightVolume |
28.577 → 31.369 (+9.8%) |
| RENDER | CanvasToFramebuffer |
14.045 → 14.577 (+3.8%) |
| RENDER | BakeSunShadowMap |
6.710 → 6.960 (+3.7%) |
| RENDER | LightingToTrixel |
5.644 → 6.248 (+10.7%) ⚠ |
| RENDER | ComputeVoxelAO |
4.908 → 5.932 (+20.9%) ⚠ |
| UPDATE | PropagateTransform |
5.189 → 5.348 (+3.1%) |
jakildev
left a comment
There was a problem hiding this comment.
Review — engine: stop paying per-update work for resident entities that cannot change (#5009)
Verdict: needs-fix
Needs-fix
engine/script/include/irreden/script/lua_archetype_view.hpp:70— an EVAL system'sreadsdeclaration does not actually make a bound C++ component row read-only.LuaCppColumnView::atstill calls the ordinary reader, andLuaScript::recordComponentLuaNamebuilds that reader as a mutablestd::refto the live row (engine/script/include/irreden/script/lua_script.hpp:527-531). Onlycolumn:setAt(...)checksm_readOnly. A system declared withreads = { IRComponent.C_LocalTransform }can therefore dolocal row = column:at(0); row.translation = {...}; the bound setter writes the live row in place (component_local_transform_lua.hpp:36-39,67-79) while the scheduler treats the system as a reader and lets it match static and settled entities. That bypasses the pose-writer exclusion and does not resettle the entity. Give read-only columns an immutable/copy access path (or otherwise prevent every mutating usertype route), and add an EVAL regression test that tries a property write through:at, not only:setAt.
Acceptance (issue #5009)
| Criterion | Grade | Basis |
|---|---|---|
| 1. Conformance to the merged static-resident contract | unmet | The C++ policy/boundary coverage is extensive, but the Lua EVAL reads escape above violates the matching policy on a shipped registration lane. |
| 2. Static rows are not walked | met | The positive-fire evidence reports 0–131 rows against populations of 1,000,000+ for every named system. |
| 3. Static-fixture performance | met | Three interleaved clean/guarded rounds report the four-system cost at 0.4% of base. |
| 4. No resident upload/write cull work; bounded mostly-static upload | met | The control reports zero upload bytes and write notifications; the mostly-static arm reports 160,000 B/frame, with producer-witness and 10,000-range tests present. |
| 5. Motion control and static/dynamic identity | met | All seven paired cycle shots are byte-identical and the amended IRPerfGrid run reports 35/35. |
| 6. Forbidden-write behavior | met | Raw-write and audit behavior have direct unit coverage. |
| 7. No regression for dynamic entities | met | The three-round base/head means remain within the amended gate, including the recolor arm. |
| 8. Render regression | met | The reported changed rows pass; remaining IRShapeDebug rows reproduce on master and are tracked by #4904/#5106. |
| 9. Transition cost and fog correctness | met | Promotion stays below 4 ms and the fog positive-fire case is covered. |
Validation
- The current head compiled through the core libraries and 78% of the cold
IrredenEngineTesttarget without a compile error; I stopped the job after finding the blocking Lua path, so this is not a completed build or test result. - At review time,
fleet-tests,linux-build,perf-gate, andrender-harness-testswere still pending; they are unread, not green. - I inspected the three amended
cycle_*references; their visible delta is confined to the documented ridge-top lighting changes.
🤖 Reviewed by Codex (GPT-5, opus-class review)
Opus recheck not required (reviewed at opus class).
An EVAL system's `reads` column raised on `setAt`, but `:at` returned a std::ref to the live row, so a usertype property write (`column:at(0).translation = ...`) reached a static or settled row while the scheduler treated the system as a reader. Read-only C++ columns now read through a copying accessor. The new test writes through `:at` and checks that the row and its settled state are unchanged. It fails against the old reader. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Addressed feedback (pushed
— worker (pool-1) |
Perf gateHead host slug: Perf gate — seeding new baselineNo baseline at |
jakildev
left a comment
There was a problem hiding this comment.
Re-review — engine: stop paying per-update work for resident entities that cannot change (#5009)
Verdict: approve
Confirmation
- The prior
reads-column escape is resolved atLuaCppColumnView::at: read-only C++ columns now select a separate accessor that materializes an owned userdata copy, while writable columns retain the live-row reference path. A property setter can mutate the returned copy without reaching ECS storage; a non-copyable component raises instead of exposing the live row. LuaStatic.APropertyWriteThroughAReadsColumnNeverReachesTheRowexercises the requested EVAL route on a settled static entity and proves both halves of the contract: the Lua-held copy changes, while the liveC_LocalTransformremains unchanged and the entity remains settled.- The re-review delta is limited to that fix, its binding documentation, and its regression test. I found no new substantive issue in the changed lines.
Validation
fleet-build --detach --target IrredenEngineTestcompleted successfully:fleet-jobs: 20261116T163236Z-build-264ba4 succeeded exit=0.fleet-run IrredenEngineTest --gtest_filter=LuaStatic.APropertyWriteThroughAReadsColumnNeverReachesTheRow:LuaStatic.AnEvalSystemWritesWhatItListsUnlessItIsUnderReadspassed 2 of 2 tests.- GitHub
fleet-tests,perf-gate, and the completed lint/format/header checks pass.linux-buildandrender-harness-testsare still pending, so they are unread rather than green.
🤖 Reviewed by Codex (GPT-5, sonnet first-pass reviewer)
Opus recheck not required.
Summary
Implements
docs/design/static-residents.mdas merged (#5008, PR #5062): an entity its owner declares static (C_Static) stops matching pose writers at once, and stops being walked by the deriving systems once the engine has derived from its frozen inputs (C_Settled).The pushes answer the steward directions on the thread (#5009 A2–A6) and conform to the merged document:
origin/master345dbbf25(the design document is master's merged version).C_VoxelPool::markCullBoundsDirtycounts every position and alpha write notification at the producer, before the pending-bit dedup, queue saturation or either cache consumer. The report prints it beside the total and camera/full-rebuild slot counts; the subtraction-basedinvalidated_slotsis gone. Four positive-control unit tests.C_VoxelPool::pendingCullDebt), not onlysettling == 0. The mostly-static window does open under it (A3 asked). Thestatic_cyclecapture asserts the same list at its first shot (engine: stop paying per-update work for resident entities that cannot change #5009 A4); see "Plan departures" for its all-dynamic twin.IREntity::EngineAttach<T>/EngineAttachKey<T>/GenericAttachable, the constraint on every typed attach lane,insertNewComponentprivate, run-time refusals onaddComponentDynamic,getOrCreateSingletonByComponentId,restoreEntitiesBatchand the snapshot loader, the restricted-bit assert in the move primitives,attachEngineComponentDeferred;IRSystem::promoteSettled/restampSettling/raiseSettleFloor/settleFloorondetail::SettlePromoter, the floor moved to the system manager; the private stamp with its copy and move rules.Nothing is open from the steward directions. The rotated
cycle_*references are re-blessed atd9f87ddaf(criterion 5, #5009 A7), andlod_scene_fine_yaw90is master's row (criterion 8; #4904, #5106).2. An owner call on the mostly-static frame time.Closed: accepted under gate 3 as written (answer, #5009 A6). See "Mostly-static frame time" below.Carries the fix of #5080 (now on master as PR #5082).
What is in it
kStaticGuard,kClearedByForeignMove,kTracksInputChanges,EngineAttach), the tracked-change log (now also logging a removal that names a cleared component), per-worker entity notes.C_Settledis dropped by every archetype move that does not name it, by a parent-link change, by a parent's destruction and by a typed overwrite throughsetComponent.reserveRowssizes a node's columns once. The engine-owned boundary above.C_Static/C_Settled, one exclusion function on every registration and query lane, declared and effective exclude archetypes,GatesSettled, rounds across INPUT, UPDATE and RENDER, theWalkedcount,SettlePromoter.IRPrefab::Static(freeze, thaw, resettle, drain, eligibility, audit), the engine mutators that thaw or resettle, the deriving systems (PROPAGATE_TRANSFORM, the modifier resolvers,UPDATE_VOXEL_SET_CHILDREN,REBUILD_GRID_VOXELS*,SEED_STAGED_VOXELS), the gated fog subject systems and LOD gate, the position-range policy and the write witness.Walkedcolumn andStatic residentssection, theIRStatictable andreads = { … }.IRPerfGrid.--no-static,--moving-fraction,--static-cycle,--recolor-every-update; two render-verify rows with their own"warmup": 48; the cache-debt start assert at the profile window and at the static cycle's first capture..claude/rules/cpp-ecs.md,engine/prefabs/irreden/voxel/CLAUDE.md), and the moduleCLAUDE.mdentries for the boundary.20 other system files only had a
C_WorldTransformparameter declaredconst, so their systems keep matching static entities:HITBOX_MOUSE_TEST,CANVAS_RESIDENCY,DEBUG_CULLING_MINIMAP,ENTITY_CANVAS_TO_FRAMEBUFFER,FOG_REVEAL_EVAL_CANVAS(and its ghost twin),FOG_SUBJECT_ADOPT_CANVAS,FRAMEBUFFER_TO_SCREEN,PROPAGATE_CANVAS_PARTS,PROPAGATE_CANVAS_ROTATION,SHAPES_TO_TRIXEL,SPRITES_TO_SCREEN,SYNC_VIEWPORT_SUBJECTS,UPDATE_JOINT_MATRICES,UPDATE_VOXEL_POSITIONS_GPU,BUILD_SPATIAL_INDEX,COLLISION_NOTE_PLATFORM,CONTACT_NOTE_BURST,PARTICLE_SPAWNER,PERIODIC_IDLE_NOTE_BURST,PROPAGATE_CHUNK_MEMBERSHIP.Conformance
Each "may assume" statement of the merged document and the test that pins it. Tests are in
test/ecs/static_resident_world_test.cpp(StaticWorld.*) unless a suite is named.PROPAGATE_TRANSFORM: a settled entity's world transform is the composition as it stood when it settledStaticResident.CreatedStaticSettlesAndMatchesTwinThroughItsLife,StaticChildOfStaticParentAndDynamicChildMatchTheirTwins,StaticResident.SettledEntityIsNotMatchedByTheDerivingSystemsAGlobalModifierPushedAfterSettlingDoesNotReachTheEntityC_ResolvedFieldsholds the values of its last roundGlobalPushAfterTheResolverHoldsPromotion,GlobalPushAfterTheRoundClosedHoldsPromotion,GlobalExpiryWhileSettlingHoldsPromotion,AGlobalPushedEveryUpdateHoldsEverySettlingEntityMODIFIER_DECAYnever matches a static entity; lifetimes do not advanceAStaticEntitysModifierLifetimesDoNotAdvance,ARegisteredMoverNeverVisitsAStaticEntityUPDATE_VOXEL_SET_CHILDREN: pool positions current, owner range registered, range queued once, no cull chunk invalidatedStaticResident.SettledEntityQueuesNoPositionsAndInvalidatesNoCullChunk,OwnerAdoptionCoversAnEmptySetAndAnEditBeforeTheFirstDrain,ARoundSpansThePipelinesAndOnlyTheRenderJoinClosesItREBUILD_GRID_VOXELS*: the span holds the raster for the current rotationARotatedGridEntityIsRasterizedWhenItSettlesAndMatchesItsTwin,AHiddenSetStillHoldingARotatedRasterIsHeldUntilItIsShownSEED_STAGED_VOXELS: every set is residentAStagedSetIsHeldUntilItIsSeededASettledSubjectIsWalkedOnlyWhenAFogInputChanged(one assertion per trigger row),AReplacedFogComponentArmsThePassAtAnEqualRevision,AnArmedPassCoversEveryStaggeredRowOnce,ASettledSubjectsFogVerdictStillFollowsTheFog,FogSettersResettleTheSubject,LuaFogVisionSlotsTest.EveryVisionWriteAdvancesTheOwnersRevisionGATE_VOXEL_SETS_BY_LOD:lodCulled_matches the resolved tierASettledSetsLodGateFollowsTheActiveTier,MidRoundLodBandChangeRestartsTheWait,TheAuditCatchesARawLodBandAssignment,LuaStatic.LodBandPropertiesResettleASettledOwnerFreezePromotesAfterExactlyOneCompleteRound, the fourMidRound*tests,ResettleOnASettlingEntityMovesPromotionOneRoundLater,AppendingADerivingSystemMidRoundDelaysPromotionUntilItHasRunStaticPolicy.AlsoWritesCountsAsADeclaredWrite(itsUnrelatedsystem visits all three rows)expectTwincompares world transform, every pool position,visible_,lodCulled_and fog bits) and the owner-range test above.StaticResident.SettledEntityQueuesNoPositionsAndInvalidatesNoCullChunk; the control'sCull writes: notifications=0belowC_Staticsaved,C_Settlednot; loads settlingLuaWorldSnapshotTest.RoundTripsAStaticResidentAsSettling(now settled throughpromoteSettledbefore the save)AStaticTreeCreatedWithItsParentsSettlesAndStaysStatic, the twoReparenting…Subtree…tests,UnparentingResettlesTheSubtreeAsARoot,ReparentingUnderADynamicEntityMakesTheSubtreeDynamic,ADestroyedParentsSurvivorsKeepTheirLinkAndDeriveAsRoots,APreDestroyHookThatReparentsASurvivorLeavesItUnderTheNewRoot,StaticEntityLayer.*StaticPolicy.*(19 tests),LuaStatic.AnEvalSystem*,LuaStatic.APropertyWriteThroughAReadsColumnNeverReachesTheRow(areadscolumn's:atreturns a copy, so a usertype property write never reaches the live row; it fails against the old reader),LuaSystemCodegenTest.ReadsComponentIsDeclaredConstAndStillRead,AQueryBetweenUpdatesNeitherDerivesNorDelaysASettlingEntitypromoteSettledattachesC_Settled, after re-checking the rulestatic_assert(!…)block overcreateEntity(facade and manager),setComponent(both),setComponents,setComponentDeferred(both),insertReservedEntity,createEntitiesBatch,createEntityBatch,createEntityBatchWithFunctions,singleton,singletonEntity,getOrCreateSingleton, each with itsC_Staticpositive control, plusinsertNewComponentinaccessible for both and the key not constructible. By-id lanes:TheByIdLanesRefuseSettledAndTheSettlingEntityPromotesWithItsTwin,LuaStatic.LuaCannotNameSettled. Restore:ARestoreIntoASettledArchetypeIsRefused.promoteSettleditself:PromoteSettledReChecksEveryRowItIsGiven,PromoteSettledRefusesARowTheSettleFloorHolds,APromotionStagedAfterTheTagsRemovalIsDroppedstatic_asserts onsettleStamp_access, move assignment, copy assignment andnoexceptmove construction;ACopiedStaticArrivesWithAZeroStampAndWaitsForANewRoundC_Settledreturns the entity to settling; removingC_Staticdrops bothRemovingSettledLeavesItSettlingAndRemovingStaticLeavesNeitherTag,StaticEntityLayer.EveryMoveThatDropsAClearedComponentLogsTheEntityATypedOverwriteOfThePoseResettlesTheSubtreeAndMatchesTheTwin(three forms),ATypedOverwriteOfAnotherComponentResettlesOnlyTheEntity,ATypedOverwriteOfTheLodOverrideResettlesOnlyTheRoot(settled and settling tree),LuaStatic.TheLodOverrideBindingResettlesASettledEntity,ATypedOverwriteOfModifiersIsResolvedOnceAndDoesNotDecay,TheReferenceAnOverwriteReturnsIsTheEntitysRow,AnOverwriteOnADynamicTreeLogsNothingAndMovesNoEntity(10,000-entity subtree),LuaStatic.SetLuaFieldOnASettledEntityIsTheRawPath,StaticEntityLayer.ATypedOverwriteDropsSettledAndLogsTheEntityStaticResident.RawWriteIsRetainedAndNotDerivedUntilResettle,TheAuditCatchesARawWriteThatIsNeverResettled,AModifierPushThawsAndReachesTheWorldTransformLikeOnATwin,ModifierMutatorsThawOrResettleTheirTarget,EveryVoxelSetMutatorResettlesItsOwner,RotationModeAndGizmoAttachThaw, the typed-overwrite row aboveChunkBoundsEvictionTest.APositionWriteGivesANonzeroWriteWitness,AnAlphaOnlyWriteGivesANonzeroWriteWitness,WritesKeepTheirWitnessOnAFrameThatTakesTheFullCardinalRebuild(position and alpha),ACameraOnlyRebuildLeavesTheWriteWitnessAtZero,VoxelPositionQueueTest.ASaturatedQueueStillInvalidatesTheCullCachesChunkBoundsEvictionTest.CullDebtCountsWriteDebtUntilEachCacheConsumerPaysIt; the fixture's start assert (staticFixtureReady/staticCacheDebtincreations/demos/perf_grid/main.cpp), at the profile window and at the static cycle's first capture. Positive control:--static-cycle --auto-screenshot 10exits 3 withstale_world_chunks=832.VoxelPositionQueueTest.*(repeated writes, overlaps and touches, 10,000 disjoint ranges under repeated catch-up writes, the bound and one past it, a full queue of repeats compacting instead of saturating),PositionUploadTest.TenThousandDisjointRangesSubmitOnlyTheirSlots, the saturated-queue tests rewritten to saturate with disjoint rangesGates
The document adopts or replaces each default gate of #5009. Its wording is the gate.
Entitiescolumn ofPropagateTransform,UpdateVoxelSetChildrenandModifierDecay, and theWalkedcolumn ofFogRevealEvaland of every other gated system, are each under 1% of the base arm'sEntitiesfor the same row"--no-staticrows at maximum delta 0"--no-static --recolor-every-update, "frame time is not above base by more than twice its round range"render-verifyfor four targets, nine-yaw identity,light-verify --if-changedpromotion_ms_maxis at most 4 ms on the reference host"Acceptance evidence
Perf: Release, Apple M4 Max, Metal,
scripts/perf/repeat_profile.py, interleaved base and head rounds, every counted runRESULT=CLEANwithQUIET=guarded(contaminated runs were discarded and re-run; a codex pane's quiet lease rolled its parker mid-run several times). Base isorigin/master345dbbf25, the head's fork point; the recolor base arm is that commit plus the--recolor-every-updatepatch in the thread. Fixture commands are the four in the thread. The control, dynamic and mostly-static rounds ran on a head that also counted notified slots in the write witness; the recolor rounds marked "final" ran on the final witness (notifications only), and one control and one mostly-static run at the final commit045b35508read the same witnesses (controlPosition upload: bytes=0,Cull writes: notifications=0 frames=0 of 300; mostly-staticmax_frame_bytes=160000 frames=300 of 300,promotion_ms_max=2.318).PropagateTransform131 of 1,000,131 (0.013%; the demo's non-cell entities),UpdateVoxelSetChildren0 of 1,000,000,ModifierDecay0 of 1,000,000,FogRevealEvalwalked 0 of 1,000,000 matched. Three runs.Position upload: bytes=0,Cull writes: notifications=0. Camera/full rebuild: 4,000,000 slots on the 4 frames where the sweep reaches a cardinal yaw, equal to the total rebuild count, so no slot was rebuilt for a write. The window opened only afterstaticCacheDebtread zero queued ranges, zero write-pending cardinal chunks and zero stale world boxes.--moving-fraction 0.01, the window opened under the full start assert: 160,000 B submitted in every one of the 300 frames (bytes=48000000 max_frame_bytes=160000 frames=300 of 300), three runs; 10,000 notifications per frame.StaticResident.*,StaticWorld.*. At35ff50dc5, with the full start list asserted at the first shot (warm-up 48), the static run and its--no-statictwin capture byte-identical frames on all sevencycle_*shots (md5 per shot, both arms:6f34de37…×3,0e986e41…,a2359dd9…,3a925711…,a57865e4…). Before the re-bless,render-verify --target IRPerfGridread 29 of 35: three rotated shots of each run (cycle_zoom1_rot,cycle_zoom4_rot,cycle_zoom4_rot_pan, 99.93–99.98% match, max delta 52–53) failed the references blessed on369cb6b06, identically in both runs. Master renders the same seven frames:345dbbf25plus a move-only--static-cyclepatch (patch in the thread), built and captured in the same tree at warm-up 48, is byte-identical to both head runs on every shot. The drift is #5063's, per #5009 A7: the scene overflows the sun-record pool (requested=786432at a ceiling of131072) and #5063 changes which records the overflow keeps. The three rotated references are re-blessed atd9f87ddaf(0e986e41…,a2359dd9…,a57865e4…; the new PNGs were inspected and differ from the old ones only in a few ridge-top highlight voxels).git diff --statof that commit names only those three files.render-verify --target IRPerfGridatd9f87ddaf: all 35 checks pass, both cycle runs included (Debug, Metal, M4 Max, pool-7build/).PropagateTransform1.105 / 1.327 / 1.203 (0.222) → 1.043 / 1.174 / 1.160;UpdateVoxelSetChildren1.339 / 1.331 / 1.377 (0.046) → 1.311 / 1.331 / 1.378;FogRevealEval1.187 / 1.224 / 1.208 (0.037) → 1.181 / 1.203 / 1.217;ModifierDecay0.002 / 0.003 / 0.003 (0.001) → 0.003 / 0.003 / 0.003. No head mean is above its base mean by more than twice the range. Frame 57.2 → 53.4 ms. Recolor, frame time, final witness: base 244.32 / 242.50 / 245.68 ms (range 3.18), head 243.51 / 247.07 / 241.62 ms; the head mean is 0.10 ms below base.lod_scene_fine_yaw90tracked by #4904 and #5106)IRFogDemo69 of 69,IRCanvasStress59 of 59,light-verify --if-changedall pass (re-run at35ff50dc5), nine-yawIRCanvasStressset byte-identical betweenorigin/masterand head (sha256 of all nine).IRPerfGrid35 of 35 atd9f87ddaf(criterion 5); the 21 non-cycle rows keep their unchanged capture frames.IRShapeDebug128 of 148 (10 pending): 19 rows fail onorigin/masteron this host too, at the same max deltas (owner #4904; PR #5103 refreshes them).lod_scene:lod_scene_fine_yaw90is the same frame on master and head in one build tree (pool-5build/, Debug, Metal, M4 Max,fleet-run --timeout 90 IRShapeDebug --auto-screenshot 20 --lod-scene --pivot-origin, bothRESULT=CLEAN,Discovered 1 display monitors). Master345dbbf25was built first and captured, then head045b35508was built in the same tree (every changed file touched; the exe carriesC_Settled) and captured. All six shots are byte-identical:coarse/restorede1250f7c45a9847e2f104cfae38058cf,medium_yaw456b877a9e24511a6023373fc53ea52b14,fine_yaw90450cab722cbb972497593d665424a4a0,return_yaw18085d1c05e3eaeeeddeebae90d21b5be29,coarse_yaw270e60af1f72c654fd98e21653547136d04.SunFaceAdmitis in both binaries. My earlier "head-only" reading compared arms from different trees. The row is not this PR's (#5009 A5, A7): it fails with the same metrics on master in the same tree. Trackers: #4904 (the re-bless) and #5106 (the build-tree factor).promotion_ms_max2.53 / 2.55 / 2.42 ms over three mostly-static runs with the default cap, against 4 ms. The promotion now applies at the flush throughattachEngineComponentDeferred.ASettledSubjectsFogVerdictStillFollowsTheFog;render-verify --target IRFogDemo69 of 69The witness cost, measured. With a slot count beside the notification count, recolor read base 243.88 / 243.44 / 245.14 ms against head 254.84 / 256.93 / 256.78 ms (+12.0 ms), all of it in the fixture's recolor row (22.2 → 23.7 ms per call, 8 calls per frame, about 1M
markCullBoundsDirtycalls each). A diagnostic tree with both counters removed read 246.70 / 245.84 / 247.91 ms. Dropping the slot count and keeping the counting entry a small wrapper over the unchanged chunk-marking body gives the "final" numbers above.Mostly-static frame time, accepted under gate 3 as written. The owner accepted the cost under gate 3 as written (#5009 A6). It is not a waiver: no gate bounds this fixture's frame time. The per-range Metal blit cost is the accepted residual #3725 tracks, and this fixture fires that ticket's pick-up trigger (table). Rows 1–2 are mine, interleaved, three rounds each, same fixture and commit. The old-bound arm is a diagnostic tree that restores the 8,192 bound, which saturates on this fixture and uploads every CPU-owned slot. Row 3 is the fixture's all-dynamic twin, what master does on this scene today. It is a record row, not a gate, cited from the answerer's four interleaved pairs against the head's Release binary in a separate session (every run
RESULT=CLEAN/QUIET=guarded). The head read 44.12 / 44.52 / 45.53 / 46.68 ms in those pairs, ahead of the twin in every pair.vs1_posCPU msUpdateVoxelSetChildrenms--wave-freeze --moving-fraction 0.01 --no-static), record rowThe gate holds, and the frame is 4.4 ms slower. The time is in the flush: on Metal
subDataRanges→stagePatchpacks the 10,000 ranges into one staging slice and then encodes onecopyFromBufferper range, so the frame carries 10,000 blit commands (CPU encode +2.9 ms, GPU +1.4 ms). The whole-pool path is one memcpy and one blit. Any policy that keeps the gate's byte bound keeps the ranges disjoint, so the cost is in the backend's per-range encoding, not in the queue. The old-bound arm goes throughstagePatchwith one range, notreplaceBacking: the position buffer is 33,554,432 B and 16,000,000 B does not cover it. The backend is unchanged here; landing disjoint ranges in one GPU pass is #3725's.Not gated, for the record: the control lifts the promotion cap and promotes 1,000,000 rows in one drain:
promotion_ms_max251–259 ms on the control (the fixture accepts one long frame; gate 8 is on the capped mostly-static population).Unit suite:
fleet-run IrredenEngineTest, 3957 passed, 3 skipped (host-specific skips that predate this PR).Plan departures
C_Staticat startup moves every later entity id by one.TRIXEL_GLITCHsalts its noise by raw entity id, so the nine lit macOSglitch_subject_*references reseed, as after render: keyboard-first widgets and hotkey hints (#4679) #4707 and render: player-facing perf hud toggled by f3 #4739.origin/masterwith one extra component registration at startup renders all nine byte-identical to this branch (sha256 of each capture compared). The_offrows andchoreo_tick_n1are untouched.IRPrefab::Static::noteHeldis a sibling ofnoteChangedfor a deriving system that holds a row. The document describes the hold without naming the call.upsertBySourceInPlacedoes not thaw. It takes aC_Modifiers &, not an entity id. A system holding that reference declares a write to a pose input, so it never matches a static entity; only a raw reference can reach one.FOG_REVEAL_EVAL_CANVAS*andFOG_SUBJECT_ADOPT_CANVASnever see a settled row.C_ResolvedFieldsseeder must excludeC_Settled, or the resolver composes a settling row from an unseeded value. Documented inengine/prefabs/irreden/common/CLAUDE.md.C_FogRevealed.overrideand.channelsstay raw writes, as the document says of the fields ("delayed, not lost"). No Lua form ofsetOverride/setChannelsis added.C_StaticStatesingleton;staticDrainis a newIR_PROFILE_SCOPErow.EntityManager::reserveRowsis new. The drain sizes the settled twin of a settling node once, so a capped promotion never regrows columns over rows already settled.IRPerfGridstatic fixtures open their profile window only when nothing is settling and the cache debt is paid, then replay the yaw sweep from its first pose, so a report covers the same 300 poses as the base arm. Thestatic_cyclecapture asserts the full § "Fixtures" list at its first shot (engine: stop paying per-update work for resident entities that cannot change #5009 A4). Its two runs carry"warmup": 48in the manifest: the static run settles at frame 8 and pays its last stale world box at frame 23. The 21 otherIRPerfGridrows keep their capture frames, and other--wave-freezecapture tools (perf-grid-rotate-sweep,feeder-margin-verify) keep the settlement-only check. The--no-statictwin is held to settlement and the script, not the cache half. Its cells are dynamic and re-notify their writes every frame, so its light occlusion grid holds a steady 960 stale world boxes (measured on frames 1–80: 960 from frame 6 on, with nothing queued and no pending cull chunk), and no warm-up pays them. This is the same exemption the all-dynamic arms of the profile fixtures already take (!g_staticCells). The twin is the "all-dynamic twin of every fixture", not one of the four fixtures, and the image identity above holds with it. This departure stands per engine: stop paying per-update work for resident entities that cannot change #5009 A7. The recolor fixture's base arm isorigin/masterplus the--recolor-every-updateflag (the patch is in the thread), built in a scratch tree.attachEngineComponentDeferredtakes the key by value and applies after every other staged change of the flush, as a per-manager list of (entity, component, companion, row appender) with no closure per attach.IRAsset::Result<T>::successconstructs its value in place, so aTwith no public move assignment (C_Static) can be read.handleInputChangelogs each entity once.test/common/settle_now.hppsettles an entity throughpromoteSettledfor a test that runs no pipelines, replacing the tests that attachedC_Settleddirectly; the entity-layer tests use a local trait stand-in.Test plan
fleet-build --target IrredenEngineTestandfleet-run IrredenEngineTest(3957 passed, 3 skipped)python3 scripts/perf/test_profile_parser.py(35 tests)python3 scripts/lint_comment_refs.py,python3 scripts/lint_instruction_size.py --against origin/master,fleet-build --target header-checks,fleet-build --target format-changedpython3 scripts/render-verify.py:IRFogDemoandIRCanvasStresspass;IRPerfGrid35 of 35 atd9f87ddaf(criterion 5);IRShapeDebug19 inherited rows (render: refresh stale macos-debug ShapeDebug and CanvasStress references #4904), andlod_scene_fine_yaw90byte-identical to master in one tree (criterion 8; render: refresh stale macos-debug ShapeDebug and CanvasStress references #4904, render: make lod_scene_fine_yaw90 deterministic across macOS build trees #5106)lod_scenepass, master and head in one build tree, six shots byte-identicalcycle_*scene, master arm (move-only--static-cyclepatch) and head in one build tree, seven shots byte-identicalstatic_cyclestart-assert positive control (--auto-screenshot 10exits 3), and static = dynamic byte-identical on all sevencycle_*shots at warm-up 48IRCanvasStressidentity,origin/masteragainst the headpython3 scripts/light-verify.py --if-changedpython3 scripts/perf/repeat_profile.py, four fixtures, base and head interleaved, plus the old-bound and no-witness diagnostic armsCloses #5009
🤖 Generated with Claude Code