wip(standalone): GPU step 23 -- skip empty connector-ring dispatch; cached 1.07-1.17 s

Connector-ring kernel skipped when a tile has no rings, no connector vertices and no
visible skirts (skirted tiles keep it: an earlier variant lost remote coverage, caught
by the captures). Outlier controls: the step 22 67 ms tile runs in ~23 us isolated,
also after a pool touch; no-present control did not remove outliers. Cause unknown.
My runs outside the sandbox (Step23.exe, marker removed first, interleaved, -Timeline):
  CPU 1.360 / 1.294 / 1.287 s
  GPU cached 1.168 / 1.072 / 1.151 s (GPU timestamps 295 / 245 / 264 ms,
      max dispatch 52.7 / 9.2 / 35.0 ms)
  GPU marker miss 1.449 s. Measured: on the miss route, device-init end to
      generation-setup begin takes ~132-155 ms (s22 a/e, s23 a) vs ~3.5 ms on the
      match route; s22 f (miss) was 3.5 ms. That gap explains the slow first launches.
Audits: hashes w1/w8, walk 5,642/5,642, near 960 / far 1,114 0 diffs vs CPU and
WARP, thin 353, survival ~6.14 GB, ten captures as step 22.

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 00:32:13 +02:00
1 parent 052b6de354
commit bb082f3ae9
10 files changed
+332 -36

No files matched your search

+25 -10
View File
@@ -1565,6 +1565,7 @@ namespace
bool bGpuFarPreparationDeferredReported=false;
bool bGpuFarFirstPreparedInputReported=false;
bool bGpuWarmupCompleted=false,bGpuFarTimelineEnabled=false;
bool bGpuFarNoPresent=false,bGpuFarNoPresentReported=false;
bool bGpuWarmupRoutePending=false;
bool bGpuShaderWarmupQueueSucceeded=false;
std::atomic<bool> bGpuShaderWarmupQueueFinished{false};
@@ -2976,8 +2977,9 @@ float3 Lit=Rock*(Ambient+0.88*Diffuse)+float3(0.50,0.69,0.82)*Head*0.75;
double DispatchMs)const
{
if(!bGpuFarTimelineEnabled||DispatchMs<5.0)return;
std::printf("[GpuFarSlowDispatchTile] key=(%d,%d,%d,lod%d) dispatch_ms=%.6f cells=%d step=%d near_detail=%d protected=%llu thin=%llu solid=%llu near_proxy_samples=%u skirt_faces=0x%02x connector_rings=%u connector_vertices=%u\n",
Key.Coord.X,Key.Coord.Y,Key.Coord.Z,Key.Level,DispatchMs,Tile.InputCells,
std::printf("[GpuFarSlowDispatchTile] key=(%d,%d,%d,lod%d) dispatch_ms=%.6f output_slot=%u output_chunk=%u cells=%d step=%d near_detail=%d protected=%llu thin=%llu solid=%llu near_proxy_samples=%u skirt_faces=0x%02x connector_rings=%u connector_vertices=%u\n",
Key.Coord.X,Key.Coord.Y,Key.Coord.Z,Key.Level,DispatchMs,Tile.OutputSlot,
Tile.OutputSlot/VoxelForgeGpuFarViewer::PooledOutputSlotsPerChunk,Tile.InputCells,
Tile.InputStep,Tile.bNearDetailInput?1:0,
static_cast<unsigned long long>(Tile.ProtectedSamples),
static_cast<unsigned long long>(Tile.ProtectedThinSamples),
@@ -5170,9 +5172,21 @@ float3 Lit=Rock*(Ambient+0.88*Diffuse)+float3(0.50,0.69,0.82)*Head*0.75;
const UINT PresentSyncInterval=(bDisableVSync||bNonBlockingStartupPresent)?0u:1u;
const UINT PresentFlags=bNonBlockingStartupPresent?DXGI_PRESENT_DO_NOT_WAIT:0u;
const auto PresentCallStart=std::chrono::steady_clock::now();
const HRESULT PresentResult=SwapChain->Present(PresentSyncInterval,PresentFlags);
// The CPU-ready frame is the ownership handoff gate for this route.
// Keep that one presentation, then suppress presents while GPU work runs.
const bool bDidPresent=!bGpuFarNoPresent||bDeferGpuUntilCpuFrame;
const HRESULT PresentResult=bDidPresent
?SwapChain->Present(PresentSyncInterval,PresentFlags):S_FALSE;
const auto PresentCallEnd=std::chrono::steady_clock::now();
if(GpuFarTilesSubmitted>0&&!bGpuFirstBackedPresentReported)
if(!bDidPresent&&!bGpuFarNoPresentReported)
{
bGpuFarNoPresentReported=true;
std::printf("[GpuPresentationControl] mode=no_present_after_cpu_handoff first_skipped_frame_ms=%.3f render_commands_still_submitted=1 gpu_tiles_submitted=%llu\n",
ColdTimelineMilliseconds(PresentCallEnd),
static_cast<unsigned long long>(GpuFarTilesSubmitted));
std::fflush(stdout);
}
if(bDidPresent&&GpuFarTilesSubmitted>0&&!bGpuFirstBackedPresentReported)
{
bGpuFirstBackedPresentReported=true;
std::printf("[GpuFirstBackedPresent] at_ms=%.3f call_ms=%.3f sync=%u flags=0x%08x hr=0x%08lx submitted_tiles=%llu batches=%llu\n",
@@ -5183,7 +5197,7 @@ float3 Lit=Rock*(Ambient+0.88*Diffuse)+float3(0.50,0.69,0.82)*Head*0.75;
static_cast<unsigned long long>(GpuFarSubmissionBatches));
std::fflush(stdout);
}
if(bInitialClipmapReported&&!bWholeViewPresented)
if(bDidPresent&&bInitialClipmapReported&&!bWholeViewPresented)
{
bWholeViewPresented=true;
std::printf("[WholeViewPresented] at_ms=%.3f present_ms=%.3f sync=%u hr=0x%08lx\n",
@@ -5192,7 +5206,7 @@ float3 Lit=Rock*(Ambient+0.88*Diffuse)+float3(0.50,0.69,0.82)*Head*0.75;
PresentSyncInterval,static_cast<unsigned long>(PresentResult));
std::fflush(stdout);
}
if(bGpuWarmupHoldReported&&!bGpuWarmupReleaseReported)
if(bDidPresent&&bGpuWarmupHoldReported&&!bGpuWarmupReleaseReported)
{
bGpuWarmupReleaseReported=true;
std::printf("[GpuWarmupPresentRelease] at_ms=%.3f first_post_warmup_present_ms=%.3f sync=%u hr=0x%08lx\n",
@@ -5201,8 +5215,8 @@ float3 Lit=Rock*(Ambient+0.88*Diffuse)+float3(0.50,0.69,0.82)*Head*0.75;
PresentSyncInterval,static_cast<unsigned long>(PresentResult));
std::fflush(stdout);
}
const uint64 PresentOrdinal=++PresentCallCount;
if(bNonBlockingStartupPresent)
const uint64 PresentOrdinal=bDidPresent?++PresentCallCount:0;
if(bDidPresent&&bNonBlockingStartupPresent)
{
++StartupNonBlockingPresentCalls;
if(PresentResult==DXGI_ERROR_WAS_STILL_DRAWING)++StartupNonBlockingPresentSkips;
@@ -5210,7 +5224,7 @@ float3 Lit=Rock*(Ambient+0.88*Diffuse)+float3(0.50,0.69,0.82)*Head*0.75;
std::fprintf(stderr,"[PresentStartupError] hr=0x%08lx\n",
static_cast<unsigned long>(PresentResult));
}
if(PresentOrdinal<=3)
if(bDidPresent&&PresentOrdinal<=3)
std::printf("[PresentProfile] ordinal=%llu at_ms=%.3f sync=%u flags=0x%08x mode=%s hr=0x%08lx call_ms=%.3f gpu_tiles_submitted=%llu gpu_batches=%llu\n",
static_cast<unsigned long long>(PresentOrdinal),
std::chrono::duration<double,std::milli>(PresentCallEnd-ColdProcessStart).count(),
@@ -5219,7 +5233,7 @@ float3 Lit=Rock*(Ambient+0.88*Diffuse)+float3(0.50,0.69,0.82)*Head*0.75;
std::chrono::duration<double,std::milli>(PresentCallEnd-PresentCallStart).count(),
static_cast<unsigned long long>(GpuFarTilesSubmitted),
static_cast<unsigned long long>(GpuFarSubmissionBatches));
if(bDeferGpuUntilCpuFrame&&!StreamingBatches.empty())
if(bDidPresent&&bDeferGpuUntilCpuFrame&&!StreamingBatches.empty())
{
bCpuReadyFramePresentedBeforeGpu=true;
std::printf("[CpuReadyFrameBeforeGpu] at_ms=%.3f uploaded_cpu_batches=%zu next_action=submit_gpu_far\n",
@@ -7112,6 +7126,7 @@ int main(int Argc,char** Argv)
else if(Arg=="--affinity-all-cpu"){}
else if(Arg=="--gpu-far-no-present-hold")
App.bDisableGpuWarmupPresentHold=true;
else if(Arg=="--gpu-far-no-present")App.bGpuFarNoPresent=true;
else if(Arg=="--gpu-far-no-cold-drain")App.bDisableGpuColdStartDrain=true;
else if(Arg=="--gpu-far-timeline")App.bGpuFarTimelineEnabled=true;
else if(Arg=="--gpu-far-no-prewarm")