profile: in-process SIGPROF sampler + exclusive route/phase census (L77); closes to 0.1%

Opt-in (L77 build + --linux77-profile; compiled out by default, 0.02% handler cost).
FI/TN cost account closes against direct grid-fill timing within 0.15% (LOD0-2 bins within 1.4%).
Passage carving = 66% of LOD0-2 CPU (52-54% whole view), passage support 10-14%, base packed
+ analytic field ~3%. Hotspots: value noise 17%, lower_bound in VisitNearestPassageSpatialNode
14%, ApplyResolvedStratePassageCarves 6.5%. LOD0/1 complete LAST (4.1/4.6 s) while LOD2 is
ready at 2.2 s.

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-27 17:55:39 +01:00
1 parent 68cba5a51d
commit 5e091d254c
14 files changed
+1205 -8

No files matched your search

+54 -3
View File
@@ -1873,7 +1873,8 @@ namespace StandaloneStreamBenchmark
bool bActiveLaneBatching=false,int32 ProofBlockCells=8,
bool bParallelSignEdgeRepair=false,bool bAuditNativeLattice=false,
bool bLatticeOrphanControl=false,bool bCaptureSkipWalkability=false,
bool bProfilePassageComposer=false,bool bAllowUniformSkipsWhenHashing=false)
bool bProfilePassageComposer=false,bool bAllowUniformSkipsWhenHashing=false,
bool bLinux77Profile=false)
{
using Clock=std::chrono::steady_clock;
FStandaloneOwnerWorld& World=*OwnerWorld;
@@ -2039,11 +2040,12 @@ namespace StandaloneStreamBenchmark
bAllowUniformSkipsWhenHashing);
Streamer.SetUniformBlockProofAuditEnabled(bAuditUniformBlockProofs);
Streamer.SetTileDrainInstrumentationEnabled(bInstrumentTileDrain);
Streamer.SetLinux77ProfileEnabled(bLinux77Profile);
Streamer.SetPassageComposerProfilingEnabled(bProfilePassageComposer);
Streamer.SetExactMidpointDensityMemoEnabled(bExactMidpointDensityMemo);
Streamer.SetActiveLaneBatchingEnabled(bActiveLaneBatching);
Streamer.SetProofBlockCells(ProofBlockCells);
if(bScreenSpaceGate||bReportLodWorkProfile||bInstrumentTileDrain)
if(bScreenSpaceGate||bReportLodWorkProfile||bInstrumentTileDrain||bLinux77Profile)
Streamer.SetMesherStageProfilingEnabled(true);
if(bInstrumentTileDrain)
{
@@ -2053,6 +2055,7 @@ namespace StandaloneStreamBenchmark
bExactMidpointDensityMemo?"on":"off",
bParallelSignEdgeRepair?"on":"off");
}
if(bLinux77Profile)VoxelForgeCore::Linux77Profiler::Start(1000);
const auto StreamStart=Clock::now();
const FStandaloneStreamingUpdate EarlyUpdate=Streamer.StartWithDesired(ShapeFreeDesired);
if(EarlyUpdate.DesiredTiles!=static_cast<int32>(ShapeFreeDesired.Tiles.size()))
@@ -5051,6 +5054,13 @@ namespace StandaloneStreamBenchmark
std::unique_ptr<FFarLODProfile> FarLODProfile;
if(bReportLodWorkProfile)FarLODProfile=std::make_unique<FFarLODProfile>();
std::array<std::uint64_t,9> DensitySamplesByLOD{};
using FL77Route=VoxelForgeCore::Linux77Profiler::ERoute;
using FL77Stage=VoxelForgeCore::Linux77Profiler::EStage;
std::array<std::array<std::uint64_t,
VoxelForgeCore::Linux77Profiler::StageCount
*VoxelForgeCore::Linux77Profiler::RouteCount*2>,9> L77DispatchByLOD{};
std::array<std::uint64_t,9> L77GridInteriorByLOD{},L77GridHaloByLOD{};
std::array<double,9> L77LODReadySeconds{};
std::array<std::uint64_t,9> SkirtTrianglesByLOD{};
std::array<std::uint64_t,9> TileCountByLOD{};
std::array<std::uint64_t,9> ClassifiedAirTilesByLOD{},ClassifiedSolidTilesByLOD{};
@@ -5117,8 +5127,19 @@ namespace StandaloneStreamBenchmark
if(Tile.Key.Level>=0&&Tile.Key.Level<static_cast<int32>(TileCountByLOD.size()))
{
const std::size_t LOD=static_cast<std::size_t>(Tile.Key.Level);
++TileCountByLOD[LOD];
const auto& TileDiagnostics=Tile.CoreDiagnostics;
++TileCountByLOD[LOD];
if(bLinux77Profile)
{
const auto& D=TileDiagnostics;
for(std::size_t Counter=0;Counter<D.linux77DispatchCounters.size();++Counter)
L77DispatchByLOD[LOD][Counter]+=D.linux77DispatchCounters[Counter];
L77GridInteriorByLOD[LOD]+=D.linux77GridInteriorSamples;
L77GridHaloByLOD[LOD]+=D.linux77GridHaloSamples;
if(TileCountByLOD[LOD]==ExpectedTilesByLOD[LOD])
L77LODReadySeconds[LOD]=std::chrono::duration<double>(
Clock::now()-ColdStart).count();
}
if(TileDiagnostics.tileWasClassified)
{
switch(TileDiagnostics.tileClass)
@@ -5500,6 +5521,36 @@ namespace StandaloneStreamBenchmark
MovingMcOtherMsByLOD[LOD]);
}
}
if(bLinux77Profile)
{
VoxelForgeCore::Linux77Profiler::StopAndPrint();
for(std::size_t LOD=0;LOD<TileCountByLOD.size();++LOD)
{
if(ExpectedTilesByLOD[LOD]==0)continue;
std::printf("[WorldAssemblerL77LODReady] lod=%zu tiles=%llu cold_ready_s=%.6f\n",
LOD,static_cast<unsigned long long>(ExpectedTilesByLOD[LOD]),
L77LODReadySeconds[LOD]);
std::printf("[WorldAssemblerL77GridSamples] lod=%zu interior=%llu halo=%llu\n",
LOD,static_cast<unsigned long long>(L77GridInteriorByLOD[LOD]),
static_cast<unsigned long long>(L77GridHaloByLOD[LOD]));
for(std::size_t Stage=0;Stage<VoxelForgeCore::Linux77Profiler::StageCount;++Stage)
for(std::size_t Route=0;Route<VoxelForgeCore::Linux77Profiler::RouteCount;++Route)
{
const std::size_t Index=(Stage*VoxelForgeCore::Linux77Profiler::RouteCount
+Route)*2;
const std::uint64_t Calls=L77DispatchByLOD[LOD][Index];
const std::uint64_t Points=L77DispatchByLOD[LOD][Index+1];
if(Calls==0&&Points==0)continue;
std::printf("[WorldAssemblerL77Dispatch] lod=%zu stage=%s route=%s calls=%llu points=%llu\n",
LOD,VoxelForgeCore::Linux77Profiler::StageName(
static_cast<FL77Stage>(Stage)),
VoxelForgeCore::Linux77Profiler::RouteName(
static_cast<FL77Route>(Route)),
static_cast<unsigned long long>(Calls),
static_cast<unsigned long long>(Points));
}
}
}
Streamer.Stop();
Streamer.DumpColdTimelineTrace();
bool bScreenSpaceGatePassing=true;