perf(generation): gate the tile cache window by LOD; LOD0 back to switch-off speed
2de603c's tile-sized room cache cut worker CPU, but LOD0 generation was ~9% slower. The per-tile
split shows the loss was evaluation (more candidates per sample in a bigger window), not cache
building. Policy, measured per path and LOD:
- fused path: tile window at LOD >= voxel.TileCacheWindowMinLOD (default 3)
- op-stack path: tile window at LOD >= voxel.TileCacheWindowOpStackMinLOD (default 4)
- lower LODs keep the 4-chunk worker window
- voxel.SpatialIndex: -1 auto (off at fused LOD0, on elsewhere), 0 or 1
Proof caveat closed: VF_ComputeTerrainOpEnvelope adds authored terrain-op extents (pits, chimneys,
detail overrides, ...) to the invariance envelope. Ops beyond the proven 256-voxel extent, or
malformed/unloaded ones, force the legacy window, so window invariance holds for every asset.
Sampler fix: the leaf symbol kept pointers into a TMap that FindOrAdd can rehash while later
frames resolve; the leaf is now re-found by program counter after insertion.
Game path, two runs each, sampler off (Codex; checked against its report):
LOD0 request p50/p95 generation p50/p95 worker s
static optimized 106.3 / 175.9 ms 76.6 / 124.3 ms 39.2
static switch-off 106.3 / 173.0 75.9 / 124.1 58.5 (-33%)
moving optimized 79.4 / 158.5 72.4 / 123.7 113.7
moving switch-off 82.8 / 160.4 73.2 / 125.4 141.9 (-20%)
LOD0 is flat within noise static and slightly better moving; worker CPU keeps most of the gain.
Field exact: 841/841 per-tile triangle identity, export OBJ SHA-256 unchanged (b3e5f4c3..9b377),
capability 20,830 / 10,909.
Caution: compare these numbers only within this round. The machine is in daytime use, so
absolute figures drift between rounds.
Current LOD0 map (sampler, moving, inclusive): tunnel SDF 12.5% + tunnel core 12.3% (the same
tunnel in two coordinate spaces); passage carving 11.1%, structural posts 11.4%, native floor
4.1%, with floor projection at 8.9% inside them; cave warp ~8% exclusive. Development-build-only
overheads: TArray RangeCheck ~6.5%, per-sample FScopedTimer ~2.6%.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01TaFdXhTdYMkW1xrV6ApT6Y
This commit is contained in:
1 parent
2de603cd77
commit
cfad3d1c18
8 files changed
+729
-146
No files matched your search
@@ -3849,9 +3849,21 @@ void AVoxelWorld::GenerateTileResult(const FVoxelTileKey& Tile, const FIntVector
|
||||
return bMeasureTile && TileProfileEnd.Counters[Index] >= TileProfileStart.Counters[Index]
|
||||
? TileProfileEnd.Counters[Index] - TileProfileStart.Counters[Index] : 0;
|
||||
};
|
||||
const auto CycleDelta = [&](VoxelDensityProfile::EBucket Bucket) -> uint64
|
||||
{
|
||||
const int32 Index = static_cast<int32>(Bucket);
|
||||
return bMeasureTile && TileProfileEnd.Cycles[Index] >= TileProfileStart.Cycles[Index]
|
||||
? TileProfileEnd.Cycles[Index] - TileProfileStart.Cycles[Index] : 0;
|
||||
};
|
||||
const double TileSeconds = FPlatformTime::Seconds() - TileStartSeconds;
|
||||
const double CacheBuildSeconds = FPlatformTime::ToSeconds64(
|
||||
CycleDelta(VoxelDensityProfile::EBucket::RoomGraphBuild));
|
||||
const double EvaluationSeconds = FMath::Max(
|
||||
0.0, TileSeconds - CacheBuildSeconds);
|
||||
UE_LOG(LogTemp, Display,
|
||||
TEXT("[VoxelForgeTileProfile] tile=(%d,%d,%d) level=%d step=%d cells=%d sheet=%d aborted=%d empty=%d "
|
||||
"verdict=%d classify=%.6f mesh=%.6f streams=%.6f seconds=%.6f "
|
||||
"cache_build=%.6f evaluation=%.6f "
|
||||
"refine=%u stack=%u core_samples=%u final_samples=%u core_hits=%u final_hits=%u "
|
||||
"core_leaves=%u final_leaves=%u tail_queries=%u tail_eval=%u "
|
||||
"stack_work=%.6f core_work=%.6f final_work=%.6f tail_work=%.6f "
|
||||
@@ -3868,7 +3880,7 @@ void AVoxelWorld::GenerateTileResult(const FVoxelTileKey& Tile, const FIntVector
|
||||
Tile.Coord.X, Tile.Coord.Y, Tile.Coord.Z, Tile.Level, Step, Cells,
|
||||
bSheetTile ? 1 : 0, Result.bAborted ? 1 : 0,
|
||||
Result.bEmpty ? 1 : 0, ClassifyVerdict, ClassifySeconds, MeshSeconds, StreamSeconds,
|
||||
FPlatformTime::Seconds() - TileStartSeconds,
|
||||
TileSeconds, CacheBuildSeconds, EvaluationSeconds,
|
||||
ClassifierStats.RefineNodes, ClassifierStats.StackBoxCalls,
|
||||
ClassifierStats.ExactCoreSamples, ClassifierStats.ExactFinalSamples,
|
||||
ClassifierStats.ExactCoreCacheHits, ClassifierStats.ExactFinalCacheHits,
|
||||
|
||||
Reference in new issue
Block a user