Repository navigation
runtime: serve XboxBvhBuilder.dll with the layer's XDXR builder (RT-5, boot stop 18) - #7516
romainveurrier wants to merge 3 commits into
Conversation
…, boot stop 18) The package's XboxBvhBuilder.dll creates 52 console compute programs as pipelines in its constructor, on the title's thread. Translated, they take 25-60 s to compile on a cold driver cache (ItsNotRexed#7231/ItsNotRexed#7049: 31.2 s for one on an RTX 4080, 59.5 s for all 52 on an RX 9070 XT), longer than the title's ~30 s startup watchdog, so a first boot ends at the builder. runtime/shims/xbox_bvh_builder.cpp serves the seven exports the executable imports (measured statically on 1.0.2.1: constructor 1 call site, destructor 1, Set64BitMortonCodes 8, GetRaytracingAccelerationStructure- PrebuildInfo 3, BuildRaytracingAccelerationStructureBatched2X 6, CopyRaytracingAccelerationStructure 2, RehydrateRaytracingAcceleration- StructureBatched2X 4) with the layer's own XDXR builder (D3D-178). The loader binds imports to a shim before a bundled module, so the DLL is not loaded and its programs are never created. - each BATCHED_DESC2 element (docs/xdxr.md §1) is one layer build with its postbuild descriptions; the offline-statistics type (0x10), which the DLL refuses by throwing, skips the element instead (a shim must not throw); - XDXR stream records and Set64BitMortonCodes tune the console builder's heuristics and are ignored (logged once); - prebuild sizes and copies are the layer's; - the builder's state is kept in a table keyed by `this`: nothing is written into the title's object, whose size isn't known; - rehydration answers E_NOTIMPL for now (stage 2); - LEONIDA_BVH_BUILDER=console keeps the bundled DLL. xbox_bvh_builder_test (12 checks) calls the exports through the shim registry as the title binds them; xdxr_bvh.py check-build validates the BLAS, TLAS and compacted BLAS it builds (0/1000 rays differ on each). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Independent native Windows 11 dual-GPU review of Environment
Results (
|
|
Independent Windows + GPU test of Setup: Windows 11 x64, MSVC 19.44.35220 (
AI-assisted review/test. |
|
Native Windows retail A/B at
Both exited 0. The seven additional shim bindings correspond to seven fewer bindings to a packaged module. On the same machine all three builder CTests passed. The synthetic BLAS, compacted BLAS and TLAS each had zero structure-validation errors and 0/1,000 rays differing from brute force. This checks module selection on Windows and geometry correctness on Ada. The retail runs stopped after mapping, so they do not measure initialization time or show whether the startup watchdog is cleared. AI-assisted verification. |
|
Tested Retail Xbox Series 1.0.2.1 package + executable (sizes match
Outcomes only; no game data. |
|
Live run on top of a boot stack (environment below),
Environment: CachyOS, Wine 11.22, RTX 5070 Ti / NVIDIA 620.73.04, Vulkan 1.4.357, clang-cl 23.1.5 + xwin SDK 10.0.26100, Release, |
|
Native Windows check of
The local package check only exercised mapping and import routing. These measurements don't cover live startup or the rehydration implementation. |
|
Additional stop-18 data point for the console BVH path on an RTX 3080. Windows build 26300, NVIDIA 621.14, MSVC 19.44 RelWithDebInfo. I used the public RT-5 integration at c6f58906d, with LLVM 23.1.5, SPIRV-Tools v2026.4 and wave64 emulation. All 52 compute modules passed validation and all 52 pipelines compiled in each standalone
The 36-second compile exceeds the roughly 30-second startup watchdog budget described in this PR. The warm-driver control also sped up the run. These measurements cover standalone Vulkan pipeline creation. A retail boot with this cache is pending. AI-assisted with Codex. |
|
Tested Retail
With
Not covered: the title never reached a build, copy or rehydrate call in these runs, so the shim's results are not exercised on retail here. AI-assisted. |
…he proxy path From @KarolKurzyna's review of 242a5db: - builder_device() returned the builder's device without a reference, so a destructor on another thread could release it during GetRaytracingAccelerationStructurePrebuildInfo. It now takes a reference under the lock, and the caller releases it after the call. - The test only passed an unwrapped device. It now also constructs a builder on a d3d12_xs device proxy (create_device_proxy, as D3D12XboxCreateDevice hands out) and checks that its prebuild sizes are the real device's (13 checks). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Thanks all for the live runs: @zohaiblazuli, @Marukooh, @sennecools (the A/B with the 31.9 s watchdog end on AMD is the clearest measurement of the problem), and @KarolKurzyna, @MartinIndra02, @cdomergue, @ciagnij for the Windows runs. @KarolKurzyna, both points are fixed in 98c065c:
@sennecools, right: these runs never reached a build, copy or rehydrate call, so the retail exercise of those results is still to come. Rehydration is #7903 (stage 2). AI-assisted. |
|
checked: static read of the retail executable against this PR's call-site list | result: everything matches except one count. The image has 8 direct Other shapes confirmed here: ctor 1 (the exe allocates exactly 24 bytes for the object and passes bool 0), dtor 1, |
… its interfaces From @tupacfan04's review of ItsNotRexed#7903: on a boot stack with the console list proxy (ItsNotRexed#7076), the title's lists are proxies whose QueryInterface answers only the console and public list IIDs. The shim asked the proxy itself, so a private interface was refused, and a PC interface it did answer would have been called through a console-shaped vtable. d3d12_xs_device exposes real_object_behind_proxy(), the real object behind any child proxy (proxy_real_object, which a console list proxy joins, as the file and ItsNotRexed#7076 say), and the shim asks that real list for ID3D12GraphicsCommandList4. On main lists aren't wrapped, so nothing changes there; with ItsNotRexed#7076 the shim follows its lists without a further change. docs/xdxr.md: BuildRaytracingAccelerationStructureBatched2X is 6 call [rip+disp32] sites through the import table; IDA counts 8 direct calls, two of them in another form (@FJKiXfaR on ItsNotRexed#7516). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
… its interfaces From @tupacfan04's review of ItsNotRexed#7903: on a boot stack with the console list proxy (ItsNotRexed#7076), the title's lists are proxies whose QueryInterface answers only the console and public list IIDs. The shim asked the proxy itself, so a private interface was refused, and a PC interface it did answer would have been called through a console-shaped vtable. d3d12_xs_device exposes real_object_behind_proxy(), the real object behind any child proxy (proxy_real_object, which a console list proxy joins, as the file and ItsNotRexed#7076 say), and the shim asks that real list for ID3D12GraphicsCommandList4. On main lists aren't wrapped, so nothing changes there; with ItsNotRexed#7076 the shim follows its lists without a further change. docs/xdxr.md: BuildRaytracingAccelerationStructureBatched2X is 6 call [rip+disp32] sites through the import table; IDA counts 8 direct calls, two of them in another form (@FJKiXfaR on ItsNotRexed#7516). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
@FJKiXfaR, thanks for the read. My count was The rest matches what you read. The shim never writes into the 24-byte object, so its size doesn't matter. @tupacfan04's proxy finding on #7903 also applied here, and is fixed in the same commit. AI-assisted. |
|
Tested
No game data. AI-assisted (Claude Code). |
|
@sambagarandawertanda, thanks for the RTX 3080 numbers. A cold first run takes 40.9 s with its slowest pipeline at 36 s, over the watchdog, and a saved cache only helps from the second launch. That's the case this PR removes: with the shim the 52 programs are never compiled at boot. AI-assisted. |
|
Tested
AI-assisted. |
|
Tested Unit (
Live retail
Both end at the same later stop (slot 67 library pipelines, which my work folder doesn't have translated yet), so this PR changes nothing past the builder on this GPU. Watchdog: not reproduced here. Both sides reach that stop in about 5 s (4.98 s / 4.73 s with a warm cache; 4.72 s / 5.05 s with AI-assisted (Claude Code). |
Item: new RT-5 item, claimed in #7333 (claim). Stage 1 of 2; stage 2 is rehydration.
Why
XboxBvhBuilder.dll's constructor creates its 52 console compute programs as pipelines, on the title's thread. Translated, they take 25–60 s to compile on a cold driver cache: 31.2 s for one of them on an RTX 4080 (@kapitche), 59.5 s for all 52 on an RX 9070 XT (@sennecools). The title's startup watchdog fires at about 30 s, so a first boot ends at the builder (stop 18). @KkelebekK hit the same thing under Wine on an RTX 4070 Laptop.The layer already builds XDXR BVH4 structures itself (D3D-178,
runtime/src/xdxr_build.*), in the node format the game's translated traversal shaders read, and its pipeline compiles in well under a second. The loader binds an import to a shim before a bundled module (Loader::resolve). So this serves the DLL's exports with the layer's builder, and the DLL is never loaded. It's the same kind of substitution as DLSS behind the FFX upscaler shim.What
runtime/shims/xbox_bvh_builder.cppserves the seven exports the executable imports. Measured statically on my own 1.0.2.1 copy (game_scarlett_master.exe, SHA-256e95020b2…a08993); nothing was run for this; export names and call counts only, all through the IAT:(ID3D12Device11*, bool)this; nothing is written into the title's object, whose size isn't known; no programsSet64BitMortonCodes(bool)GetRaytracingAccelerationStructurePrebuildInfo(INPUTS*, XDXR_STREAM_DESC*, PREBUILD_INFO*)BuildRaytracingAccelerationStructureBatched2X(GCL6*, UINT, BATCHED_DESC2*)docs/xdxr.md§1,src/xdxr_descs.h), with its postbuild descriptionsCopyRaytracingAccelerationStructure(GCL4*, dest, source, mode)RehydrateRaytracingAccelerationStructureBatched2X(GCL8*, UINT, BUILD_DESC*, UINT64*)E_NOTIMPL+ a log line for now (stage 2)Where it differs from the DLL, on purpose:
docs/xdxr.md§3) andSet64BitMortonCodestune the console builder's heuristics. They're ignored (logged once); the result is still a valid BVH of the same geometry.0x10) is one of those.LEONIDA_BVH_BUILDER=consolekeeps the bundled DLL, for work on the console programs themselves (make_game, shader library: XboxBvhBuilder.dll's embedded programs are translated and found on the Vulkan device (D3D-557) #5680, d3d12: compute root arguments in the table behind s[0:1], for programs that read them there (XboxBvhBuilder) #7318).d3d12_xsyet, so the list the title passes is the backend's own and answersID3D12GraphicsCommandList4. When a console list proxy lands (§3.5a),list4_ofis where its real list is taken.Stage 2:
RehydrateRaytracingAccelerationStructureBatched2X, rebuilding each structure on the GPU from the source geometry its description carries (docs/bvh.md§4a), in the leaf framecompressionParamsgives, so it agrees with #4011's TLAS folding.Tests
xbox_bvh_builder_test(12 checks) calls every export throughrt::shims::find("xboxbvhbuilder.dll", <mangled name>), the way the title's imports bind, withthisfirst:COMPACTED_SIZEpostbuild) and a TLAS through the batched export; the BLAS compacted through the copy export into a buffer of exactly that size.E_NOTIMPL.xbox_bvh_builder_checkrunstools/xdxr_bvh.py check-buildon the three structures.xbox_bvh_builder_consolechecks thatLEONIDA_BVH_BUILDER=consoleregisters nothing.Tested
Fedora 44, clang-cl with xwin (SDK 10.0.26100), Wine 11.21, NVIDIA GeForce RTX 2050:
xbox_bvh_builder: 12/12.xbox_bvh_builder_check: 0 validation errors and 0/1000 rays differing from brute force on the BLAS, the compacted BLAS and the TLAS.xbox_bvh_builder_consolepasses.gta6rt --dry-run(my own copy; binding kinds and counts only): all 7XboxBvhBuilder.dllimports bind toshim, and 4 modules are mapped instead of 5, so the bundled DLL isn't loaded.mainalone the run stops well before it, since stops 1–17 are in open PRs. If you run the boot stack (@rafaelpssz, @KkelebekK, @Pipodi), a run with this on top would confirm the watchdog stop is gone. I'll do the same on an integration tree next.tests/test_docs_links.pyfails onmaintoo (an anchor indocs/dev-tools.md);scripts/check_no_game_data.pypasses on the new files.No game files in the repository. AI-assisted (Claude Code).
🤖 Generated with Claude Code