wip(assembler): round S2 (Sol) -- shared per-tile feature queries for every Core family; island placement 30x faster

Island-only worker context replaced by a shared worker-local candidate domain
(WorldAssemblyFeatureTileListV1 / ScopedWorldAssemblyFeatureQueriesV1) serving
SurfaceWorld, FloatingIslands and far-shell queries; a per-domain cost hint keeps the
full scan on small plans. Content placement prepares the same queries and skips proven
air: owner island cell p95 7.07 -> 0.24 ms; populated fixture 572 exact placements,
3.27 s -> 29 ms. Full/candidate hashes equal with dropped-feature controls on both
families; S1 default W1/W8/W16 hashes reproduced; Core-off and M2 fixtures pass.
Default contract for future families in ARCHITECTURE 8.23. Run on gpt-6.1-sol medium.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01MmSoF64BbRFmk9C3p1VsBJ
This commit is contained in:
Fr0zkaandClaude Opus 5.5 committed 2026-10-18 19:50:45 +02:00
1 parent d6e69420e8
commit 6ddb834b1c
19 files changed
+1849 -132

No files matched your search

@@ -15147,6 +15147,53 @@ bool RunCoreOffActorTest(const FExploreArguments& Arguments, FString& OutError)
return true;
}
// Paired engine timings include preparation and derived shells, with canonical output hashes.
// Mesures moteur appariees : preparation et coques derivees incluses, avec hashes canoniques.
bool RunCoreSharedFeatureCostAudit(VoxelForgeCore::World& World,
const std::vector<VoxelForgeCore::TileKey>& Keys,const TCHAR* Label,FString& OutError)
{
for (const int32 LOD : {0,1,7,8})
{
TArray<double> FullTimes,CandidateTimes,FullShellTimes,CandidateShellTimes,ListTimes;
for (const auto& Key : Keys)
{
if (Key.lod!=LOD || FullTimes.Num()>=8) continue;
VoxelForgeCore::TileGenerationOptions Options;
Options.hashDensity=true;
Options.useAssemblyFeatureQueries=false;
std::string Error;
// Warm both routes before measuring: column/page caches must not favor the second route.
// Chauffer les deux parcours : les caches ne doivent pas favoriser le second.
if (!World.generateTile(Key,Options,Error)) return false;
Options.useAssemblyFeatureQueries=true;
if (!World.generateTile(Key,Options,Error)) return false;
Options.useAssemblyFeatureQueries=false;
const double FullStart=FPlatformTime::Seconds();
auto Full=World.generateTile(Key,Options,Error);
FullTimes.Add((FPlatformTime::Seconds()-FullStart)*1000.0);
Options.useAssemblyFeatureQueries=true;
const double CandidateStart=FPlatformTime::Seconds();
auto Candidate=World.generateTile(Key,Options,Error);
CandidateTimes.Add((FPlatformTime::Seconds()-CandidateStart)*1000.0);
if (!Full||!Candidate||Full->densityHash!=Candidate->densityHash
||Full->meshHash!=Candidate->meshHash||Full->payloadHash!=Candidate->payloadHash
||Full->topologyHash!=Candidate->topologyHash)
{ OutError=TEXT("Shared feature full/candidate tile hashes differ."); return false; }
FullShellTimes.Add(Full->diagnostics.farShellMilliseconds);
CandidateShellTimes.Add(Candidate->diagnostics.farShellMilliseconds);
ListTimes.Add(Candidate->diagnostics.featureListMilliseconds);
}
const auto P95=[](TArray<double> Values)
{ Values.Sort(); return Values.IsEmpty() ? 0.0 : Values[FMath::Clamp(
FMath::CeilToInt(Values.Num()*0.95f)-1,0,Values.Num()-1)]; };
UE_LOG(LogTemp,Display,
TEXT("[VoxelForgeSharedFeatureCost] label=%s lod=%d tiles=%d hashes_identical=1 full_p95_ms=%.5f candidate_p95_ms=%.5f list_p95_ms=%.5f full_shell_p95_ms=%.5f candidate_shell_p95_ms=%.5f"),
Label,LOD,FullTimes.Num(),P95(FullTimes),P95(CandidateTimes),P95(ListTimes),
P95(FullShellTimes),P95(CandidateShellTimes));
}
return true;
}
bool RunCoreContentPlacementCostAudit(AVoxelWorld* Actor, const FVector& CoreLocalProbeCm,
const TCHAR* Label, FString& OutError);
@@ -15382,6 +15429,7 @@ bool RunCoreFloatingIslandActorIntegrationTest(
return false;
}
ReferenceWorld.retainTileRegions(Desired);
if (!RunCoreSharedFeatureCostAudit(ReferenceWorld,Desired,TEXT("islands"),OutError)) return false;
VoxelForgeCore::TileGenerationOptions Options;
Options.hashDensity = true;
std::vector<FStandaloneCoreAdapterTileHashes> AggregateRows;
@@ -16272,6 +16320,15 @@ bool RunCoreContentPlacementCostAudit(AVoxelWorld* Actor, const FVector& CoreLoc
const float CoreVoxelSizeCm = Actor->CoreVoxelSizeCm;
const FTransform OwnerXf = Actor->GetActorTransform();
FString AssemblyJson, AssemblyHash;
if (Actor->GetVoxelForgeCoreWorldAssembly(AssemblyJson,AssemblyHash))
{
const FString ExportDir=FPaths::Combine(FPaths::ProjectSavedDir(),TEXT("CoreWorldValidation/Output"));
IFileManager::Get().MakeDirectory(*ExportDir,true);
FFileHelper::SaveStringToFile(AssemblyJson,
*FPaths::Combine(ExportDir,FString::Printf(TEXT("s2_assembly_%s.json"),Label)));
}
UVoxelContentManager::FDecorationPlacementCostAudit CoreAudit;
Actor->bUseVoxelForgeCore = true;
const FVector CorePlayerWorld = OwnerXf.TransformPosition(CoreLocalProbeCm);
@@ -16319,6 +16376,20 @@ bool RunCoreContentPlacementCostAudit(AVoxelWorld* Actor, const FVector& CoreLoc
CoreAudit.CellP95Milliseconds, CoreAudit.UpdateMedianMilliseconds,
CoreAudit.UpdateP95Milliseconds, CoreAudit.Placements, CoreAudit.AnchorChecks,
CoreAudit.MaximumAnchorErrorCm, CoreAudit.MaximumDensityResidual);
UE_LOG(LogTemp, Display,
TEXT("[VoxelForgeContentCostS2] label=%s authored_full_p95_ms=%.5f authored_candidate_p95_ms=%.5f authored_active_batch_full_ms=%.5f authored_active_batch_candidate_ms=%.5f populated_cells=%d populated_placements=%d populated_full_p95_ms=%.5f populated_candidate_p95_ms=%.5f exact_transform_comparisons=%d anchor_checks=%d max_density_residual=%.6f"),
Label,CoreAudit.FullScanCellP95Milliseconds,CoreAudit.CellP95Milliseconds,
CoreAudit.FullScanActiveBatchMilliseconds,CoreAudit.ActiveBatchMilliseconds,
CoreAudit.PopulatedCells,CoreAudit.PopulatedPlacements,
CoreAudit.FullScanPopulatedCellP95Milliseconds,CoreAudit.PopulatedCellP95Milliseconds,
CoreAudit.ExactPlacementComparisons,CoreAudit.AnchorChecks,CoreAudit.MaximumDensityResidual);
UE_LOG(LogTemp,Display,
TEXT("[VoxelForgeContentActiveS2] label=%s cells=%d placements=%d full_batch_ms=%.5f candidate_batch_ms=%.5f merge_ms=%.5f apply_ms=%.5f applied_instances=%d full_total_cpu_ms=%.5f candidate_total_cpu_ms=%.5f rhi=null"),
Label,CoreAudit.SampledCells,CoreAudit.PopulatedPlacements,
CoreAudit.FullScanPopulatedBatchMilliseconds,CoreAudit.PopulatedBatchMilliseconds,
CoreAudit.PopulatedMergeMilliseconds,CoreAudit.PopulatedApplyMilliseconds,CoreAudit.AppliedInstances,
CoreAudit.FullScanPopulatedBatchMilliseconds+CoreAudit.PopulatedMergeMilliseconds+CoreAudit.PopulatedApplyMilliseconds,
CoreAudit.PopulatedBatchMilliseconds+CoreAudit.PopulatedMergeMilliseconds+CoreAudit.PopulatedApplyMilliseconds);
UE_LOG(LogTemp, Display,
TEXT("[VoxelForgeContentCost] label=%s route=legacy voxel_cm=%.3f tile_cell_cm=%.3f authored_entries=%d synthetic=%d cells=%d columns_per_cell=%d density_queries_per_cell=%.2f surface_queries_per_cell=%.2f cell_median_ms=%.5f cell_p95_ms=%.5f update_median_ms=%.5f update_p95_ms=%.5f placements=%d anchor_checks=%d max_anchor_error_cm=%.6f max_density_residual=%.6f"),
Label, VOXEL_SIZE, CHUNK_SIZE * VOXEL_SIZE,
@@ -16767,6 +16838,12 @@ bool RunCoreWorldActorIntegrationTest(const FExploreArguments& Arguments, FStrin
return true;
}
if (!RunCoreSharedFeatureCostAudit(ReferenceWorld,Desired,TEXT("surface"),OutError)) return false;
if (FParse::Param(FCommandLine::Get(),TEXT("corefeatureauditonly")))
{
UE_LOG(LogTemp,Display,TEXT("[VoxelForgeSharedFeatureCost] pass complete=1 warmed_routes=1"));
return true;
}
VoxelForgeCore::TileGenerationOptions Options;
Options.hashDensity = true;
if (Arguments.CoreHybridMesherVersion == 2)