perf(generation): exact reach gating for the tunnel core (per tile) and passage carving (per 8^3 block)

Applies ce4d878's decide-once-then-prove pattern to the two largest exact targets from the re-rank
(tunnel core 20.8%, passage carving 9.1%). Codex; reviewed by me.

Measured first, where the time is:
  core world:      far 223,860 vs near 35,515,979 cycles   -> tile gate only; the core is
                                                             near-dominated (~99%)
  core tail:       far 363,440 vs near 20,110,219
  passage, tile:   far 7,315,426 vs near 30,168,796        -> refined to an 8^3 block gate
  passage, 8^3:    far 11,233,384 vs near 26,250,838
The core already uses the tunnel spatial index. An exact skip cannot remove its cost: that cost is
in tiles near tunnels. The remaining lever there is the field-changing SDF/core merge (next).

- Core reach per tile, from lattice plus halo: swept capsule reach, floor band, floor-profile
  deviation, relief bound, room-mouth ownership. The GetDensityAt tail is identity unless
  bSupportFloor, bRoomFloor or CoreSDF < -inset.
- Passage carving per 8^3 block: capsule-chain and landing-room domains, the carve threshold and
  the SmoothMin K/6 margin. Malformed descriptors stay candidates (conservative).
- voxel.TileReachCostDiagnostics (default 0) for the far/near cost split.

Soundness: the final-field debug comparison ran 130,285,889 comparisons with 0 differences; shrunk
reach (0.5) produced 140,035 differences (60,098 in the final field) and failed as required.
Field exact: canonical 07C14005 / b3e5f4c3..9b377, 64/64 per-tile ledger identical, capability
20,830 / 10,909, strate-crossing and sealed-proof tests pass.

Final DEFAULT build vs the committed-tip DLL (same command line, two interleaved runs each):
  static  worker 28.84 -> 28.10 s (-2.6%)  LOD0 p50 53.3 -> 51.5 ms  p95 94.4 -> 93.1 ms
  moving  worker 61.39 -> 60.61 s (-1.3%)  LOD0 p50 50.9 -> 49.7 ms  p95 92.21 -> 92.27 ms (flat,
                                                                        +0.06%, within noise)
Maintenance note: these reach proofs must track tunnel/passage geometry. The next round adds an
automation test for the final-field comparison so a geometry change cannot silently break them.
Ledger: 15 builds (one C2065 fixed, one access-denied path retry); rejected TileOnly/BlockLookup
variants were slower; one hung diagnostic (a non-owner PID) was stopped; wrapper quoting failures
launched no editor. No crash folders.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01TaFdXhTdYMkW1xrV6ApT6Y
This commit is contained in:
Fr0zkaandClaude Opus 5 committed 2026-09-15 11:30:37 +02:00
1 parent 0208e93606
commit a668833ef5
8 files changed
+1062 -30

No files matched your search

+104 -1
View File
@@ -1162,7 +1162,7 @@ void AVoxelWorld::EndPlay(const EEndPlayReason::Type EndPlayReason)
TEXT("[VoxelForgeTilePostReachKinds] comparisons="
"origin_air=%llu/origin_floor=%llu/passage_sdf=%llu/landing_air=%llu/"
"tunnel_air=%llu/landing_floor=%llu/structural=%llu/native_floor=%llu/room_floor=%llu "
"differences=%llu/%llu/%llu/%llu/%llu/%llu/%llu/%llu/%llu"),
"final_field=%llu differences=%llu/%llu/%llu/%llu/%llu/%llu/%llu/%llu/%llu/%llu"),
static_cast<unsigned long long>(VoxelGenLOD::GSkippedPostComparisonsByKind[
static_cast<uint8>(VoxelGenLOD::ETilePostComparisonKind::OriginAir)].load(
std::memory_order_relaxed)),
@@ -1190,6 +1190,9 @@ void AVoxelWorld::EndPlay(const EEndPlayReason::Type EndPlayReason)
static_cast<unsigned long long>(VoxelGenLOD::GSkippedPostComparisonsByKind[
static_cast<uint8>(VoxelGenLOD::ETilePostComparisonKind::PassageLandingRoomFloor)].load(
std::memory_order_relaxed)),
static_cast<unsigned long long>(VoxelGenLOD::GSkippedPostComparisonsByKind[
static_cast<uint8>(VoxelGenLOD::ETilePostComparisonKind::FinalField)].load(
std::memory_order_relaxed)),
static_cast<unsigned long long>(VoxelGenLOD::GSkippedPostDifferencesByKind[
static_cast<uint8>(VoxelGenLOD::ETilePostComparisonKind::OriginAir)].load(
std::memory_order_relaxed)),
@@ -1216,6 +1219,106 @@ void AVoxelWorld::EndPlay(const EEndPlayReason::Type EndPlayReason)
std::memory_order_relaxed)),
static_cast<unsigned long long>(VoxelGenLOD::GSkippedPostDifferencesByKind[
static_cast<uint8>(VoxelGenLOD::ETilePostComparisonKind::PassageLandingRoomFloor)].load(
std::memory_order_relaxed)),
static_cast<unsigned long long>(VoxelGenLOD::GSkippedPostDifferencesByKind[
static_cast<uint8>(VoxelGenLOD::ETilePostComparisonKind::FinalField)].load(
std::memory_order_relaxed)));
UE_LOG(LogTemp, Display,
TEXT("[VoxelForgeTileReachDecisions] core_reachable=%llu core_skipped=%llu "
"passage_carving_reachable=%llu passage_carving_skipped=%llu"),
static_cast<unsigned long long>(VoxelGenLOD::GTunnelCoreReachableTiles.load(
std::memory_order_relaxed)),
static_cast<unsigned long long>(VoxelGenLOD::GTunnelCoreSkippedTiles.load(
std::memory_order_relaxed)),
static_cast<unsigned long long>(VoxelGenLOD::GPassageCarvingReachableTiles.load(
std::memory_order_relaxed)),
static_cast<unsigned long long>(VoxelGenLOD::GPassageCarvingSkippedTiles.load(
std::memory_order_relaxed)));
UE_LOG(LogTemp, Display,
TEXT("[VoxelForgeTileReachCost] core_world_far_calls=%llu far_cycles=%llu "
"near_calls=%llu near_cycles=%llu"),
static_cast<unsigned long long>(VoxelGenLOD::GTileReachCostCalls[
static_cast<uint8>(VoxelGenLOD::ETileReachCostKind::TunnelCoreWorld)][0].load(
std::memory_order_relaxed)),
static_cast<unsigned long long>(VoxelGenLOD::GTileReachCostCycles[
static_cast<uint8>(VoxelGenLOD::ETileReachCostKind::TunnelCoreWorld)][0].load(
std::memory_order_relaxed)),
static_cast<unsigned long long>(VoxelGenLOD::GTileReachCostCalls[
static_cast<uint8>(VoxelGenLOD::ETileReachCostKind::TunnelCoreWorld)][1].load(
std::memory_order_relaxed)),
static_cast<unsigned long long>(VoxelGenLOD::GTileReachCostCycles[
static_cast<uint8>(VoxelGenLOD::ETileReachCostKind::TunnelCoreWorld)][1].load(
std::memory_order_relaxed)));
UE_LOG(LogTemp, Display,
TEXT("[VoxelForgeTileReachCost] core_tail_far_calls=%llu far_cycles=%llu "
"near_calls=%llu near_cycles=%llu"),
static_cast<unsigned long long>(VoxelGenLOD::GTileReachCostCalls[
static_cast<uint8>(VoxelGenLOD::ETileReachCostKind::TunnelCoreTail)][0].load(
std::memory_order_relaxed)),
static_cast<unsigned long long>(VoxelGenLOD::GTileReachCostCycles[
static_cast<uint8>(VoxelGenLOD::ETileReachCostKind::TunnelCoreTail)][0].load(
std::memory_order_relaxed)),
static_cast<unsigned long long>(VoxelGenLOD::GTileReachCostCalls[
static_cast<uint8>(VoxelGenLOD::ETileReachCostKind::TunnelCoreTail)][1].load(
std::memory_order_relaxed)),
static_cast<unsigned long long>(VoxelGenLOD::GTileReachCostCycles[
static_cast<uint8>(VoxelGenLOD::ETileReachCostKind::TunnelCoreTail)][1].load(
std::memory_order_relaxed)));
UE_LOG(LogTemp, Display,
TEXT("[VoxelForgeTileReachCost] passage_carving_far_calls=%llu far_cycles=%llu "
"near_calls=%llu near_cycles=%llu"),
static_cast<unsigned long long>(VoxelGenLOD::GTileReachCostCalls[
static_cast<uint8>(VoxelGenLOD::ETileReachCostKind::PassageCarving)][0].load(
std::memory_order_relaxed)),
static_cast<unsigned long long>(VoxelGenLOD::GTileReachCostCycles[
static_cast<uint8>(VoxelGenLOD::ETileReachCostKind::PassageCarving)][0].load(
std::memory_order_relaxed)),
static_cast<unsigned long long>(VoxelGenLOD::GTileReachCostCalls[
static_cast<uint8>(VoxelGenLOD::ETileReachCostKind::PassageCarving)][1].load(
std::memory_order_relaxed)),
static_cast<unsigned long long>(VoxelGenLOD::GTileReachCostCycles[
static_cast<uint8>(VoxelGenLOD::ETileReachCostKind::PassageCarving)][1].load(
std::memory_order_relaxed)));
UE_LOG(LogTemp, Display,
TEXT("[VoxelForgeTileBlockReachCost] core_world_far_calls=%llu far_cycles=%llu "
"near_calls=%llu near_cycles=%llu; core_tail_far_calls=%llu far_cycles=%llu "
"near_calls=%llu near_cycles=%llu; passage_far_calls=%llu far_cycles=%llu "
"near_calls=%llu near_cycles=%llu"),
static_cast<unsigned long long>(VoxelGenLOD::GTileReachBlockCostCalls[
static_cast<uint8>(VoxelGenLOD::ETileReachCostKind::TunnelCoreWorld)][0].load(
std::memory_order_relaxed)),
static_cast<unsigned long long>(VoxelGenLOD::GTileReachBlockCostCycles[
static_cast<uint8>(VoxelGenLOD::ETileReachCostKind::TunnelCoreWorld)][0].load(
std::memory_order_relaxed)),
static_cast<unsigned long long>(VoxelGenLOD::GTileReachBlockCostCalls[
static_cast<uint8>(VoxelGenLOD::ETileReachCostKind::TunnelCoreWorld)][1].load(
std::memory_order_relaxed)),
static_cast<unsigned long long>(VoxelGenLOD::GTileReachBlockCostCycles[
static_cast<uint8>(VoxelGenLOD::ETileReachCostKind::TunnelCoreWorld)][1].load(
std::memory_order_relaxed)),
static_cast<unsigned long long>(VoxelGenLOD::GTileReachBlockCostCalls[
static_cast<uint8>(VoxelGenLOD::ETileReachCostKind::TunnelCoreTail)][0].load(
std::memory_order_relaxed)),
static_cast<unsigned long long>(VoxelGenLOD::GTileReachBlockCostCycles[
static_cast<uint8>(VoxelGenLOD::ETileReachCostKind::TunnelCoreTail)][0].load(
std::memory_order_relaxed)),
static_cast<unsigned long long>(VoxelGenLOD::GTileReachBlockCostCalls[
static_cast<uint8>(VoxelGenLOD::ETileReachCostKind::TunnelCoreTail)][1].load(
std::memory_order_relaxed)),
static_cast<unsigned long long>(VoxelGenLOD::GTileReachBlockCostCycles[
static_cast<uint8>(VoxelGenLOD::ETileReachCostKind::TunnelCoreTail)][1].load(
std::memory_order_relaxed)),
static_cast<unsigned long long>(VoxelGenLOD::GTileReachBlockCostCalls[
static_cast<uint8>(VoxelGenLOD::ETileReachCostKind::PassageCarving)][0].load(
std::memory_order_relaxed)),
static_cast<unsigned long long>(VoxelGenLOD::GTileReachBlockCostCycles[
static_cast<uint8>(VoxelGenLOD::ETileReachCostKind::PassageCarving)][0].load(
std::memory_order_relaxed)),
static_cast<unsigned long long>(VoxelGenLOD::GTileReachBlockCostCalls[
static_cast<uint8>(VoxelGenLOD::ETileReachCostKind::PassageCarving)][1].load(
std::memory_order_relaxed)),
static_cast<unsigned long long>(VoxelGenLOD::GTileReachBlockCostCycles[
static_cast<uint8>(VoxelGenLOD::ETileReachCostKind::PassageCarving)][1].load(
std::memory_order_relaxed)));
if (VoxelGenLOD::GTilePostReachDebugEnabled.load(std::memory_order_relaxed)
&& TilePostReachDifferences != 0)