core: stamp passage route slabs into the tile cache (L125, evaluator v225)

Conservative route slabs with an outside sentinel, tight expanded segment bounds; DensityGrid exact fallbacks
479k -> 0 per run. Near-ready 2-14% faster than L119, still +4.7..+10.2% vs L109; whole view within -0.5..+8%.
Same look (floor offset 7.884 mm, captures checked), seam audit bit-identical, fast tier + walk audits,
Clang/GCC W1/W8/W12 determinism green. BVH and 25 cm tolerance trials rejected. Not for merge yet.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_016dhxM43dnWvUu2B5Ph1iG1
This commit is contained in:
Fr0zkaandClaude Opus 5.5 committed 2026-10-30 14:43:31 +01:00
1 parent 103fa75e1c
commit 4111b967bd
40 files changed
+2748 -28

No files matched your search

@@ -59,6 +59,7 @@ namespace
int ShapeHelperLimit=8;
bool AuditBasePageEquivalence=false;
bool AuditRouteParity=false;
bool AuditPassageTileSeams=false;
bool AuditPassageSourceClamp=false;
bool AuditPassageCarveReach=false;
bool RegionCrossing=false;
@@ -1465,6 +1466,7 @@ namespace
" --shape-helper-limit=8|12 (default 8; shape build A/B)\n"
" --audit-base-page-equivalence (hash one tile through both shape routes)\n"
" --audit-route-parity (compare page, native-only, exact-query and mesh routes)\n"
" --audit-passage-tile-seams (compare shared LOD0 density samples in adjacent route tiles)\n"
" --audit-passage-source-clamp (compare passage source floors 2,3,4,6 over all near tiles)\n"
" --audit-passage-carve-reach (compare post-composer reaches 1.5,2,2.5,4 m over all near tiles)\n"
" --audit-tile-shape-readiness (run a deliberately mis-marked tile against the native-only guard)\n"
@@ -1547,6 +1549,7 @@ namespace
}
else if(arg=="--audit-base-page-equivalence")options.AuditBasePageEquivalence=true;
else if(arg=="--audit-route-parity")options.AuditRouteParity=true;
else if(arg=="--audit-passage-tile-seams")options.AuditPassageTileSeams=true;
else if(arg=="--audit-passage-source-clamp")options.AuditPassageSourceClamp=true;
else if(arg=="--audit-passage-carve-reach")options.AuditPassageCarveReach=true;
else if(arg=="--region-crossing")options.RegionCrossing=true;
@@ -2330,5 +2333,6 @@ int main(int argc,char** argv)
options.StreamingSchedulerPolicy,options.MovingCameraTrace,
options.MovingCameraSpeedMetersPerSecond,options.MovingCameraDurationSeconds,
options.MovingCameraDwellSeconds,options.ColdWorkerTimeline,
options.AuditPassageSourceClamp,options.AuditPassageCarveReach);
options.AuditPassageSourceClamp,options.AuditPassageCarveReach,
options.AuditPassageTileSeams);
}
+121 -1
View File
@@ -24,6 +24,7 @@
#include <queue>
#include <string_view>
#include <thread>
#include <tuple>
#include <unordered_map>
#include <unordered_set>
#include <vector>
@@ -2383,7 +2384,7 @@ namespace StandaloneStreamBenchmark
bool bMovingCameraTrace=false,double MovingCameraSpeedMetersPerSecond=0.0,
double MovingCameraDurationSeconds=12.0,double MovingCameraDwellSeconds=5.0,
bool bColdWorkerTimeline=false,bool bAuditPassageSourceClamp=false,
bool bAuditPassageCarveReach=false)
bool bAuditPassageCarveReach=false,bool bAuditPassageTileSeams=false)
{
using Clock=std::chrono::steady_clock;
const std::clock_t ColdCpuOrigin=std::clock();
@@ -5676,6 +5677,125 @@ namespace StandaloneStreamBenchmark
return 9;
}
}
if(bAuditPassageTileSeams)
{
std::unordered_set<FVoxelTileKey,FStandaloneTileKeyHash> desiredKeys(
Desired.Tiles.begin(),Desired.Tiles.end());
std::vector<std::tuple<VoxelForgeCore::TileKey,
VoxelForgeCore::TileKey,std::size_t>> candidates;
candidates.reserve(128);
for(const FVoxelTileKey& nativeA:Desired.Tiles)
{
if(nativeA.Level!=0)continue;
const VoxelForgeCore::TileKey a{{nativeA.Coord.X,nativeA.Coord.Y,
nativeA.Coord.Z},0};
if(Shape.passageOverlapScore(a)==0)continue;
for(std::size_t axis=0;axis<3;++axis)
{
FVoxelTileKey nativeB=nativeA;
if(axis==0)++nativeB.Coord.X;
else if(axis==1)++nativeB.Coord.Y;
else ++nativeB.Coord.Z;
if(!desiredKeys.contains(nativeB))continue;
const VoxelForgeCore::TileKey b{{nativeB.Coord.X,nativeB.Coord.Y,
nativeB.Coord.Z},0};
if(Shape.passageOverlapScore(b)>0)
candidates.emplace_back(a,b,axis);
}
}
VoxelForgeCore::TileGenerationOptions seamOptions;
seamOptions.hashDensity=true;
seamOptions.captureDensitySamples=true;
seamOptions.forceFullDensityCapture=true;
seamOptions.profilePassageComposer=true;
const auto sampleIndex=[](std::int32_t x,std::int32_t y,std::int32_t z)
{
constexpr std::size_t Dim=VoxelForgeCore::CoreTileVoxelCount+3;
return (static_cast<std::size_t>(z)*Dim+static_cast<std::size_t>(y))*Dim
+static_cast<std::size_t>(x);
};
std::uint64_t comparedSamples=0,mismatches=0;
std::size_t testedPairs=0,examinedPairs=0;
double maximumDelta=0.0;
bool passed=false;
for(const auto& [a,b,axis]:candidates)
{
if(examinedPairs++>=128)break;
std::string errorA,errorB;
const auto tileA=Shape.generateTile(a,seamOptions,errorA);
const auto tileB=Shape.generateTile(b,seamOptions,errorB);
if(!tileA||!tileB)
{
if(examinedPairs==128)
std::printf("[PassageTileSeamCandidate] keyA=(%d,%d,%d,lod0) keyB=(%d,%d,%d,lod0) status=SKIP errorA=%s errorB=%s\n",
a.coordinate.x,a.coordinate.y,a.coordinate.z,b.coordinate.x,
b.coordinate.y,b.coordinate.z,errorA.c_str(),errorB.c_str());
continue;
}
if(tileA->diagnostics.passageSweepRouteSegmentCandidates==0
||tileB->diagnostics.passageSweepRouteSegmentCandidates==0)continue;
constexpr std::int32_t Dim=VoxelForgeCore::CoreTileVoxelCount+3;
const std::size_t expected=static_cast<std::size_t>(Dim)*Dim*Dim;
if(tileA->debugDensitySamples.size()!=expected
||tileB->debugDensitySamples.size()!=expected)
{
std::printf("[PassageTileSeam] axis=%c keyA=(%d,%d,%d,lod0) keyB=(%d,%d,%d,lod0) shared_samples=0 mismatches=1 max_abs_delta=inf status=FAIL reason=missing_full_density_capture\n",
"xyz"[axis],a.coordinate.x,a.coordinate.y,a.coordinate.z,
b.coordinate.x,b.coordinate.y,b.coordinate.z);
++mismatches;
break;
}
std::uint64_t pairMismatches=0;
double pairMaximumDelta=0.0;
for(std::int32_t v=0;v<Dim;++v)
for(std::int32_t w=0;w<Dim;++w)
{
std::array<std::int32_t,3> coordinateA{},coordinateB{};
coordinateA[axis]=Dim-2;
coordinateB[axis]=1;
coordinateA[(axis+1)%3]=v;
coordinateB[(axis+1)%3]=v;
coordinateA[(axis+2)%3]=w;
coordinateB[(axis+2)%3]=w;
const float densityA=tileA->debugDensitySamples[sampleIndex(
coordinateA[0],coordinateA[1],coordinateA[2])];
const float densityB=tileB->debugDensitySamples[sampleIndex(
coordinateB[0],coordinateB[1],coordinateB[2])];
if(std::bit_cast<std::uint32_t>(densityA)
!=std::bit_cast<std::uint32_t>(densityB))
{
++pairMismatches;
pairMaximumDelta=std::max(pairMaximumDelta,
std::abs(static_cast<double>(densityA)-densityB));
}
}
++testedPairs;
comparedSamples+=static_cast<std::uint64_t>(Dim)*Dim;
mismatches+=pairMismatches;
maximumDelta=std::max(maximumDelta,pairMaximumDelta);
std::printf("[PassageTileSeam] axis=%c keyA=(%d,%d,%d,lod0) keyB=(%d,%d,%d,lod0) shared_samples=%llu mismatches=%llu max_abs_delta=%.9g status=%s\n",
"xyz"[axis],a.coordinate.x,a.coordinate.y,a.coordinate.z,
b.coordinate.x,b.coordinate.y,b.coordinate.z,
static_cast<unsigned long long>(static_cast<std::uint64_t>(Dim)*Dim),
static_cast<unsigned long long>(pairMismatches),pairMaximumDelta,
pairMismatches==0?"PASS":"FAIL");
if(pairMismatches)break;
if(testedPairs>=4)break;
}
passed=testedPairs>0&&mismatches==0;
std::printf("[PassageTileSeamAudit] candidates=%zu examined=%zu pairs=%zu shared_samples=%llu mismatches=%llu max_abs_delta=%.9g status=%s\n",
candidates.size(),examinedPairs,testedPairs,
static_cast<unsigned long long>(comparedSamples),
static_cast<unsigned long long>(mismatches),maximumDelta,
passed?"PASS":"FAIL");
if(!passed)
{
Streamer.Stop();
return 10;
}
}
FStandaloneDesiredTileSet EarlyDesired=Desired;
if(bDeferFarWorld)
std::erase_if(EarlyDesired.Tiles,[](const FVoxelTileKey& Key){return Key.Level>1;});
+19
View File
@@ -1606,6 +1606,25 @@ private:
static_cast<unsigned long long>(D.passageSweepBaseInfluenceHits),
static_cast<unsigned long long>(D.passageSweepOutOfInfluenceHits),
static_cast<unsigned long long>(D.passageSweepMissingSamples));
if(D.passageComposerProfiled)
std::printf("[PassageSweepCount] key=(%d,%d,%d,lod%d) touched=%llu stamped_outside=%llu cache_valid=%llu cache_valid_unique=%llu touched_unique=%llu body_band=%llu shell_band=%llu exact_band_unique=%llu contributing_pairs=%llu overlap_pairs=%llu cross_passage_overlap=%llu floor_profile_calls=%llu cache_bytes=%llu scratch_bytes=%llu offgrid_miss=%llu unprepared_miss=%llu\n",
Event.Key.Coord.X,Event.Key.Coord.Y,Event.Key.Coord.Z,Event.Key.Level,
static_cast<unsigned long long>(D.passageSweepTouchedSamples),
static_cast<unsigned long long>(D.passageSweepStampedOutsideSamples),
static_cast<unsigned long long>(D.passageSweepCacheValidSamples),
static_cast<unsigned long long>(D.passageSweepCacheValidUniqueSamples),
static_cast<unsigned long long>(D.passageSweepUniqueTouchedSamples),
static_cast<unsigned long long>(D.passageSweepBodyBandSamples),
static_cast<unsigned long long>(D.passageSweepShellBandSamples),
static_cast<unsigned long long>(D.passageSweepUniqueBandSamples),
static_cast<unsigned long long>(D.passageSweepContributingPairs),
static_cast<unsigned long long>(D.passageSweepOverlapPairs),
static_cast<unsigned long long>(D.passageSweepCrossPassageOverlaps),
static_cast<unsigned long long>(D.passageSweepFloorProfileCalls),
static_cast<unsigned long long>(D.passageSweepAllocatedBytes),
static_cast<unsigned long long>(D.passageSweepPrepareScratchBytes),
static_cast<unsigned long long>(D.passageSweepOffGridMisses),
static_cast<unsigned long long>(D.passageSweepUnpreparedMisses));
}
void RecordTimelineEvent(FStandaloneCpuTileTimelineEvent::EType Type,
const FVoxelTileKey& Key,int32 WorkerId,size_t QueueDepth,size_t ActiveWorkers,