Repository navigation
D3D12.X: rectangle-list variants build off the game's threads - #49
ThatRecompDev merged 2 commits into
Conversation
|
nice, getting that 25 s compile off the game thread makes a lot of sense, and skipping the draw while it's pending matches what we already do for pending pipelines. two things before merging though: moving BeforeDraw above CopyTwin breaks --depth-twins. CopyTwin resets VariantBound and rebinds the game's pipeline, so after a twin copy the draw goes out with the plain pipeline again (half rectangles). could you keep the "still building -> skip" check up front, but do the actual bind after CopyTwin like before? Finish runs on a bare thread with no catch, so anything thrown in Build (a program load, the rect-gs compiler) would take the whole process down. it used to land in UnmanagedGuard. a catch that logs once and stores 0 would do it. smaller stuff: a thread per pipeline is a lot, PipelineBuildQueue would fit nicer. and Variant can start a second build if Finish lands between the _variants and _building checks (re-check _variants in Start). otherwise looks good |
A rectangle-list draw built its pipeline's variant on the drawing thread, outside the compile budget and the in-flight list. The variant of a tiled-lighting pipeline is a full compile of its pixel program. In a run that reached the opening cutscene, a game job thread sat in CreatePipelineState inside the driver's compiler for over 25 s: a ninth driver compile next to the eight budgeted builds in flight, all of them tiled-lighting pipelines taking 1 to 21 s each. The frame waited for that job, and the game's 30 s hang watchdog ended the run. The first draw now starts the variant's build on a thread of its own, within the compile budget, and is skipped; later draws bind the variant once it is built. A build that finishes after its pipeline address was remembered again is released. The rectangle-list count line adds the draws skipped while a variant built. Test: the first rectangle-list draw is skipped and draws nothing; once the variant is built, the draw covers the whole rectangle. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…d after the depth-twin copy Review of ThatRecompDev#49: - A draw checks first whether its variant still builds (RectangleDraws.Building) and is skipped then; the variant is bound right before the draw as before, after CopyTwin, which binds the game's pipeline again (--depth-twins). - Variants are urgent creations on the pipeline build queue, not a thread each. - A build that throws is reported once and keeps 0 (drawn as triangles): it no longer ends the build thread. - Start checks the variants again once its build is registered: a build that finished between Variant's two lookups no longer starts a second one. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
30034b3 to
a041f48
Compare
|
Thanks, all four points are addressed (rebased on main):
Loader tests: 367 passed, 1 failed. The failure is |
|
In game (recorded runs, RX 7800 XT)
The fps that remain are bounded by the driver-compile backlog (about 2,100 pipelines queued) and by GPU time (50–85 ms per frame on the direct queue). Neither comes from this change. |
|
thanks, this is great. the pending check before CopyTwin with the bind after it, the catch in Finish, the shared PipelineBuildQueue and the re-check in Start are all exactly right, and the throwing-library test is a nice way to cover the catch. merged (566a88d), with one blank line added for the statement grouping rule. a few non-blocking notes for later: the heavy tiled-lighting variants go on the normal builds queue, so they skip the heavy-build memory check stand-ins get. RestoreCompute calls BeforeDraw without the Building check, which can fire the "no rectangle-list variant" warning while a build is running. and the ManualResetEventSlim per build is never disposed |
A rectangle-list draw built its pipeline's variant on the drawing thread, outside the compile budget and outside the list of compiles in flight. The variant of a tiled-lighting pipeline (VS_TiledLighting linked to its TL_PS) is a full compile of its pixel program.
What a game run showed
In a run that reached the opening cutscene, the game's 30 s hang watchdog fired. The
--watch-hangdumps at 5, 15 and 25 s (with the operation history of #47) showed:CreatePipelineState, insideamdxc64.dll, in all three dumps. Its stack went through a JIT-compiled loader frame.fivestar pipeline buildthreads were in the driver. They matched the eight budgeted compiles in flight, all of them tiled-lighting pipelines taking 1 to 21 s each.So the worker was a ninth, untracked driver compile on a game thread. Of the loader's direct pipeline creations, the only one that runs at draw time on the game's thread with no budget is the rectangle-list variant. That attribution is inferred, not read from a frame: the stack walk stops at the JIT frame.
Change
RectanglePipelines.Variantno longer builds. The first call for a pipeline starts the build on a thread of its own and returnsPending. The build goes throughCompileBudget.Enter/Exit.Remembered again is released.RectangleDraws.BeforeDrawnow returns true while the variant is pending. The draw shims (slots 12, 13) then skip the draw, the same policy as for a stand-in not built yet. They check this before the breadcrumb and timing work.Tests: the two rectangle-list tests now check that the first draw is skipped and draws nothing, and that after
WaitBuiltthe draw covers the whole rectangle. Loader tests and architecture rules pass. Docs are updated ind3d12x-shim.md(Rectangle lists).🤖 Generated with Claude Code