wip(standalone): GPU step 26 -- first launch fixed again; device-removed was our readback overrun

Luna: on a marker miss the deferred warmup no longer gates the initial view
(starts after the full CPU view is presented). The forced-cold DXGI 0x887A0005 was
ours: GetDeviceRemovedReason = DEVICE_HUNG after the audit readback of tile
(-7,-7,0,lod8), slot 1433 -- the readback copied the theoretical 61,440-vertex maximum
from a 19,456-vertex pooled slot, 41,984 vertices past the end of the last chunk's
buffer. Readback now clamps to slot capacity (audit-only path; normal launches never
read back). Auto and forced-cold survival both pass (1,434 submissions, ~44.6 s, <8 GB).
Added a no-write option for the warmup marker. Direction answer in LUNA_DIALOGUE.md.

My runs outside the sandbox (Step26.exe, marker removed first, interleaved, -Timeline):
  CPU 1.299 / 1.291 / 1.266 s
  GPU marker miss 1.319 s (all-CPU, = CPU again; step 25 was 2.015 s)
  GPU cached 1.151 / 1.122 / 1.138 s, all 1,434 GPU tiles (timestamps 243 / 307 / 241 ms,
      max dispatch 6.3 / 66.7 / 5.2 ms)
Audits: hashes w1/w8, walk 5,642/5,642, near/far 0 sign/topology diffs vs CPU and
WARP on protected/thin, ten captures pass.

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-08 03:22:38 +02:00
1 parent 20acf57678
commit 7d92e148a9
9 files changed
+184 -17

No files matched your search

+21 -4
View File
@@ -1555,6 +1555,7 @@ namespace
EGpuWarmupLaunchPolicy GpuWarmupLaunchPolicy=EGpuWarmupLaunchPolicy::Auto;
bool bGpuWarmupDeferredUntilFirstView=false,bGpuWarmupDeferredStarted=false;
bool bGpuWarmupCacheKeyAvailable=false;
bool bGpuWarmupCacheWriteDisabled=false;
std::filesystem::path GpuWarmupStatePath;
std::string GpuWarmupCacheKey,GpuWarmupCacheIdentity;
bool bGpuFarWarmupKernelFences=false;
@@ -2289,6 +2290,11 @@ float3 Lit=Rock*(Ambient+0.88*Diffuse)+float3(0.50,0.69,0.82)*Head*0.75;
void MarkGpuWarmupCacheReady()
{
if(bGpuWarmupCacheWriteDisabled)
{
std::printf("[GpuWarmupCacheState] result=write_disabled policy=command_line\n");
return;
}
if(!bGpuFarShaderPrewarm||bGpuFarWarmupResourcesOnly
||!GpuWarmupEntryFilter.empty()||GpuWarmupStatePath.empty())return;
ResolveGpuWarmupLaunchPolicy(true);
@@ -3655,20 +3661,29 @@ float3 Lit=Rock*(Ambient+0.88*Diffuse)+float3(0.50,0.69,0.82)*Head*0.75;
ResolveGpuWarmupLaunchPolicy(false);
if(bGpuWarmupDeferredUntilFirstView&&!bGpuWarmupDeferredStarted)
{
if(!bCpuReadyFramePresentedBeforeGpu)return;
// On an ordinary first-launch cache miss, let the complete CPU
// clipmap reach the front buffer before starting cold shader
// warmup. Starting after only the first CPU frame competes with
// the remaining CPU mesh work and regresses startup. The survival
// audit has GPU-owned candidates and needs the first CPU frame to
// break its CPU/GPU readiness cycle.
const bool bDeferredWarmupGateSatisfied=bGpuFarAuditEnabled
?bCpuReadyFramePresentedBeforeGpu:bWholeViewPresented;
if(!bDeferredWarmupGateSatisfied)return;
std::string DeferredPipelineError;
if(!EnsureGpuFarPipeline(DeferredPipelineError))
{
std::fprintf(stderr,"[GpuPipelineInitError] deferred_after_first_CPU_view: %s\n",
std::fprintf(stderr,"[GpuPipelineInitError] deferred_after_CPU_ready_gate: %s\n",
DeferredPipelineError.c_str());
bGpuFarEnabled=false;bGpuWarmupDeferredStarted=true;
AddGpuFarCpuFallbackTiles(DesiredTiles);
return;
}
bGpuWarmupDeferredStarted=true;
std::printf("[GpuWarmupDeferredStart] at_ms=%.3f first_CPU_view_presented=true\n",
std::printf("[GpuWarmupDeferredStart] at_ms=%.3f gate=%s\n",
std::chrono::duration<double,std::milli>(
std::chrono::steady_clock::now()-ColdProcessStart).count());
std::chrono::steady_clock::now()-ColdProcessStart).count(),
bGpuFarAuditEnabled?"first_CPU_frame_presented":"whole_CPU_view_presented");
StartGpuShaderWarmupAsync();
}
std::string PipelineError;
@@ -7372,6 +7387,8 @@ int main(int Argc,char** Argv)
App.GpuWarmupLaunchPolicy=EGpuWarmupLaunchPolicy::ForceDeferred;
else if(Arg=="--gpu-far-force-cached-start")
App.GpuWarmupLaunchPolicy=EGpuWarmupLaunchPolicy::ForceEager;
else if(Arg=="--gpu-far-no-warmup-cache-write")
App.bGpuWarmupCacheWriteDisabled=true;
else if(Arg=="--gpu-far-warmup-before-workers")
App.bGpuFarEnabled=true,App.bGpuFarShaderPrewarm=true,App.bGpuFarWarmupBeforeWorkers=true,
App.bShapeWorld=true,App.bForceGenerate=true,App.bPresentCpuFrameBeforeGpu=true,