Files
VoxelForge/Standalone/Research/WorldAssemblerM3/Round1/BuildFloatingIslandsAudit.ps1
T
Fr0zkaandClaude Opus 5.5 53a1e69af7 wip(assembler): M3 round 1 -- native FloatingIslands recipe in Core (standalone)
Bounds 517 boxes, 0 missed, negative control caught; capsule route 1044 centers, raised-route control
fails; W1/W8/W16 stable (field bf3ce7da876431e2); 39 ms native vs 64 ms legacy. My review: islands read
as thin flat pads with a radial pinch under them, not rock; next round fixes the look.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01MmSoF64BbRFmk9C3p1VsBJ
2026-10-10 11:36:32 +02:00

119 lines
6.2 KiB
PowerShell

[CmdletBinding()]
param(
[string]$ProbePath = (Join-Path $PSScriptRoot '..\..\OwnerShapeWorld\core_strate_coverage\probes\type_6_FloatingIslands.json'),
[string]$OutputDirectory = (Join-Path $PSScriptRoot 'results')
)
$ErrorActionPreference = 'Stop'
$ScriptProcess = Get-Process -Id $PID
$ScriptProcess.PriorityClass = 'BelowNormal'
$StandaloneRoot = [IO.Path]::GetFullPath((Join-Path $PSScriptRoot '..\..\..'))
$BuildRoot = Join-Path $StandaloneRoot 'Build\VoxelForgeCore'
$CoreLibrary = Join-Path $BuildRoot 'VoxelForgeCore.lib'
$AuditSource = Join-Path $PSScriptRoot 'FloatingIslandsAudit.cpp'
$AuditExe = Join-Path $BuildRoot 'FloatingIslandsAudit.exe'
$ProbePath = [IO.Path]::GetFullPath($ProbePath)
$OutputDirectory = [IO.Path]::GetFullPath($OutputDirectory)
$VcVars = 'E:\Program Files\Microsoft Visual Studio\2022\Community\VC\Auxiliary\Build\vcvars64.bat'
if (-not (Test-Path -LiteralPath $CoreLibrary -PathType Leaf)) { throw "Core library is missing: $CoreLibrary" }
if (-not (Test-Path -LiteralPath $ProbePath -PathType Leaf)) { throw "Legacy probe is missing: $ProbePath" }
if (-not (Test-Path -LiteralPath $VcVars -PathType Leaf)) { throw "MSVC environment script is missing: $VcVars" }
[IO.Directory]::CreateDirectory($OutputDirectory) | Out-Null
$IncludeArgs = @(
('/I"{0}"' -f (Join-Path $StandaloneRoot 'Core\include')),
('/I"{0}"' -f (Join-Path $StandaloneRoot 'Core\src')),
('/I"{0}"' -f (Join-Path $StandaloneRoot 'Compat')),
('/I"{0}"' -f (Join-Path $StandaloneRoot 'Source')),
('/I"{0}"' -f (Join-Path $StandaloneRoot 'Source\VoxelForge\Public')),
('/I"{0}"' -f (Join-Path $StandaloneRoot 'Source\VoxelForge\Private'))
)
$LegacyObjectNames = @(
'UnrealPerlin.obj','StandaloneDataAssetGlue.obj','VoxelBiomeDefinition.obj','VoxelCaveMorphology.obj',
'VoxelDensityAblation.obj','VoxelDensityOpStack.obj','VoxelDensityProfile.obj','VoxelDiffLayer.obj',
'VoxelGenerator.obj','VoxelHeightOpStack.obj','VoxelMarchingCubesMesher.obj','VoxelSettings.obj',
'VoxelStrateComposer.obj','VoxelStrateManager.obj','VoxelStrateMeasure.obj','VoxelTerrainOpDefinition.obj',
'VoxelWormField.obj','GpuFarViewerLinkStubs.obj'
)
foreach ($ObjectName in $LegacyObjectNames) {
if (-not (Test-Path -LiteralPath (Join-Path $BuildRoot $ObjectName) -PathType Leaf)) {
throw "Required legacy bridge object is missing: $ObjectName; run Standalone/Build.ps1 -Target All first."
}
}
$ResponsePath = Join-Path $BuildRoot 'floating-islands-audit.rsp'
$ResponseLines = @('/nologo','/std:c++20','/O2','/arch:AVX2','/fp:precise','/EHsc','/D_CRT_SECURE_NO_WARNINGS') +
$IncludeArgs + @(('/Fe"{0}"' -f $AuditExe),('"{0}"' -f $AuditSource)) +
@($LegacyObjectNames | ForEach-Object { '"{0}"' -f $_ }) + @(
('"{0}"' -f $CoreLibrary),'/link','d3d11.lib','dxgi.lib','d3dcompiler.lib','user32.lib','gdi32.lib'
)
[IO.File]::WriteAllLines($ResponsePath,$ResponseLines,[Text.UTF8Encoding]::new($false))
Push-Location $BuildRoot
try {
$CompileCommand = 'call "{0}" >nul && cl.exe @"{1}"' -f $VcVars,$ResponsePath
& $env:ComSpec /d /s /c $CompileCommand
if ($LASTEXITCODE -eq -1073741502) { throw 'Audit build exited with 0xC0000142; retry once using this same wrapper.' }
if ($LASTEXITCODE -ne 0) { throw "Floating-island audit build failed with exit code $LASTEXITCODE" }
if (-not (Test-Path -LiteralPath $AuditExe -PathType Leaf)) { throw "Audit executable was not produced: $AuditExe" }
} finally { Pop-Location }
$RunLedger = Join-Path $OutputDirectory 'run_ledger.txt'
$RunRecords = [Collections.Generic.List[string]]::new()
$Succeeded = $false
for ($Attempt = 1; $Attempt -le 2 -and -not $Succeeded; ++$Attempt) {
$StartInfo = [Diagnostics.ProcessStartInfo]::new()
$StartInfo.FileName = $AuditExe
$StartInfo.Arguments = '"{0}" "{1}"' -f $ProbePath.Replace('"','\"'),$OutputDirectory.Replace('"','\"')
$StartInfo.WorkingDirectory = $BuildRoot
$StartInfo.UseShellExecute = $false
$StartInfo.CreateNoWindow = $true
$StartInfo.RedirectStandardOutput = $true
$StartInfo.RedirectStandardError = $true
$Process = [Diagnostics.Process]::new()
$Process.StartInfo = $StartInfo
[void]$Process.Start()
try { $Process.PriorityClass = 'BelowNormal' } catch { }
$StdoutTask = $Process.StandardOutput.ReadToEndAsync()
$StderrTask = $Process.StandardError.ReadToEndAsync()
$Clock = [Diagnostics.Stopwatch]::StartNew()
[int64]$PeakPrivateBytes = 0
$LimitFailure = $null
while (-not $Process.WaitForExit(250)) {
$Process.Refresh()
$PeakPrivateBytes = [Math]::Max($PeakPrivateBytes,$Process.PrivateMemorySize64)
if ($PeakPrivateBytes -gt 8GB) {
$LimitFailure = 'process private bytes exceeded 8 GiB'
$Process.Kill()
break
}
if ($Clock.Elapsed.TotalMinutes -ge 15.0) {
$LimitFailure = 'audit test exceeded the 15-minute time box'
$Process.Kill()
break
}
}
$Process.WaitForExit()
$Clock.Stop()
$Process.Refresh()
$PeakPrivateBytes = [Math]::Max($PeakPrivateBytes,$Process.PrivateMemorySize64)
$Stdout = $StdoutTask.GetAwaiter().GetResult()
$Stderr = $StderrTask.GetAwaiter().GetResult()
if ($Stdout) { Write-Output $Stdout.TrimEnd() }
if ($Stderr) { [Console]::Error.WriteLine($Stderr.TrimEnd()) }
$ExitCode = $Process.ExitCode
$Status = if ($LimitFailure) { $LimitFailure } elseif ($ExitCode -eq 0) { 'passed' } else { "failed exit=$ExitCode" }
$RunRecords.Add("attempt=$Attempt status=$Status elapsed_s=$([Math]::Round($Clock.Elapsed.TotalSeconds,2)) peak_private_MiB=$([Math]::Round($PeakPrivateBytes/1MB,1)) exit=$ExitCode")
if ($LimitFailure) { break }
if ($ExitCode -eq 0) { $Succeeded = $true; break }
if ($ExitCode -eq -1073741502 -and $Attempt -eq 1) {
$RunRecords.Add('retry_reason=0xC0000142 single permitted retry')
continue
}
break
}
[IO.File]::WriteAllLines($RunLedger,$RunRecords,[Text.UTF8Encoding]::new($false))
Get-Content -LiteralPath $RunLedger | Write-Output
if (-not $Succeeded) { throw "Floating-island audit run failed or exceeded a process limit. See $RunLedger" }
Write-Output "audit_executable=$AuditExe"
Write-Output "audit_results=$OutputDirectory"