Direct3D 12 back end (nyannoying's experiment): test results on an Intel Arc iGPU, and what a path to main needs #1619
Labels
No labels
area/accessibility
area/audio
area/input
area/install
area/menu
area/renderer
area/saves
area/tooling
area/upscaling
beanstalk: approved
beanstalk: failed
beanstalk: needs approval
beanstalk: running
beanstalk: tested
ci: approved
good first issue
gpu/amd
gpu/igpu
gpu/intel
gpu/nvidia
help wanted
kind
bug
kind
chore
kind
docs
kind
feature
kind
performance
kind
question
needs measurements
platform/linux
platform/macos
platform/steam-deck
platform/windows
preview
priority
critical
priority
high
priority
low
regression
risk
high
risk
low
risk
medium
status
blocked
status
confirmed
status
duplicate
status
invalid
status
needs-info
status
wontfix
ci: approved
No milestone
No project
No assignees
2 participants
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
MagicBeanDev/Longshot#1619
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Type: feature · Area: renderer, Windows · Part of: #1493
TL;DR
nyannoying's fork has a Direct3D 12 back end that sits behind the same renderer seam as the Vulkan one. We ran its base and head commits on a Windows laptop with an Intel Arc integrated GPU, and built and tested them on Linux. It plays: the title, a save, Kokiri Forest and the Market, in three of four valid D3D12 runs, with one crash at the title that did not repeat. Its native-mesh path hangs the GPU at the same replay operation (668 of 933) as on the author's B580. Neither commit merges into main today. No speed claim is made: these are single cold runs.
Breakdown
5e7d84ab2andf0f9a048e, the comparenyannoying/[email protected]), kept in one place so the work can be found, discussed and reproduced.tests/test_d3d12_*.pypass at both.MKWVK_API_VERSION29 on the branch, 33 on main; the DLL refuses any other), plus the two fixtures.2. What was tested and how
2.1 Scope
We queued the two commits of the compare in our test harness:
tests/test_d3d12_*.py, plus a Windows-target syntax check of the changed fixtures, plus the third-party provenance check.2.2 The laptop
shader model 6.8, binding tier 3, waves of 8 to 32 lanes, mesh shader tier 10, enhanced barriers yes, relaxed format casting yes, and a video-memory budget of 47,889 MB (that is the shared system memory, not a dedicated pool).2.3 The builds
v3.0.0-rc.7-32-g5e7d84ab2(base) andv3.0.0-rc.7-34-gf0f9a048e(head), both reporting renderer interface version 29 on both sides, so the version check refused nothing. Both builds linked without warnings. The shader translator inputs are identical between the two commits (the lift is the same), so only the renderer DLLs and the Eden recompiler files differ.gpu/d3d12/build.py(thedev_build.py d3d12entry stops on a Linux host with "Windows only", so the Linux-hosted llvm-mingw route was used). Both DLLs exportmkwvk_init, import only the kernel, user and UCRT libraries plusd3d12.dllanddxgi.dll, and built with zero warnings.spirv_to_dxil.dll(the one in the test package, see section 7) for every D3D12 run, and DXC (dxcompiler.dllanddxil.dll, pinned by the fork with URL and hash, v1.9.2609) only for the native-mesh run.RX_D3D12=1andlongshot_d3d12.dllbeside the exe, asdocs/d3d12.mdsection 10.1 describes. The test package's README describes a different route (rename the DLL tolongshot_vk.dllin a launcher-installed rc.7); we did not run that route because it targets the released exe, which has no such switch.2.4 The run procedure
Every run used the same scripted session through the game's control bridge, so the arms are comparable in what they did even though one run each is not a statistical sample:
d3d12: device lost, a failed D3D12 call, "back end did not start", FATAL, CRASH) ends the observation.The caps were 450 s per run and 300 s for the native-mesh run, with that run last on purpose.
3. Results
f0f9a048e, default renderer5e7d84ab2, default rendererRX_D3D12=1RX_D3D12=1Intel(R) Arc(TM) Graphics, then the host crashed 16 s later in the title, before the menu (section 5).RX_D3D12=1, same buildlongshot_d3d12.dllRX_D3D12=1 RX_D3D12_MESH_NATIVE=1 RX_D3D12_MARKERS=2, 300 s cap, lastRX_D3D12_DEBUG=1Reading the table: three D3D12 runs on the head build were valid, one crashed and two played. Two D3D12 runs (base and head) reached the Market. The two Vulkan runs did not reach the Market within the script's wait, because the first Vulkan start on a machine with empty caches translates shaders in play and the laptop's Arc GPU does not finish a fresh shader preparation in any reasonable time (an older run of ours reached 399 of 38,809 programs in 392 s). So there is no Vulkan-against-D3D12 comparison at the Market, and the Kokiri comparison is picture-only.
4. The native-mesh hang
With
RX_D3D12_MESH_NATIVE=1:IDXGISwapChain::Present failed (0x887a0005): the device was removed (0x887a0006).native mesh: program 4059, indirect 0. Markers 26 to 28 (programs 4053, 4087, 4082) belong to the same pass: draws to a 960x540 R11G11B10F colour target with a 960x540 D32F depth target. The dispatch before it was program 12744.EDEN_NX2_TENSORto emulate. That is the upscaler's cooperative-matrix shaders, unrelated to the mesh path, but it appears with native mesh on.What this does and does not say: it says the first native mesh draw in this scene hangs two different Arc GPUs at the same replay position. It does not say why. The fork's
docs/d3d12.mdsection 11 already lists the translator-side suspicions (variable pointers,OpAccessChainwith an undefined operand, warp operations in divergent control flow). We have nothing to add on cause. A debug-layer or GPU-based-validation run of exactly that draw would be the next useful step, and it needs Graphics Tools on the machine.5. The crash at the title (first head run)
d3d12: started on Intel(R) Arc(TM) Graphics, version linev3.0.0-rc.7-34-gf0f9a048e), and 16 seconds later, in the title and before the menu, the host crashed with exception0xc0000005(an access violation, a read of a guest address) on a worker thread, with the title movie's video decoder thread waiting for a core at the time.longshot_d3d12.dll: the call came from ntdll, called from the exe. A second, different exception (0x87a) was raised insidedxgi.dllunder the D3D12 DLL during the quit that followed, which is probably fallout from the crash rather than the cause.6. What the pictures show
The control bridge's pictures were used (1280x720). Our usual window capture failed in every run ("expected exactly one visible owned game window; found 0"), so there is no picture of the window itself, and the Insert-menu overlay does not appear (the D3D12 table has no overlay, settings rows or upscaler yet).
7. The Mesa DLL and the test package
third_party/mesa-spirv-to-dxil/PROVENANCE.mdnames the asset (spirv_to_dxil.dllof mesa-dist-winmesa3d-26.2.6-release-msvc.7z) but gives neither a URL nor a hash. We fetched the asset (tag 26.2.6) through the release API. The file's SHA-256 equals the release asset's owndigestfield, and the release ships no separate checksum file. Only that DLL was extracted; the archive and scratch files were deleted.spirv_to_dxil.dllin the test package the fork's author supplied is byte-identical to the one we fetched (10,407,936 bytes, SHA-256 beginning8c6e6f8e). So the package corroborates the hash we recorded on first use. If the fork wants a pinned hash, that is the one we saw.longshot_d3d12.dll(7,181,824 bytes, SHA-256 beginning9d91ab0c) against our cross-build off0f9a048e(SHA-256 beginning2478cd87): same size, same single export (mkwvk_init), same 16 imports, same section sizes and entry point. In.text, 22,519 of 3,782,582 bytes differ (0.6%), which is what a different tree path, a different timestamp and 96 more bytes of.rdatashifting the addresses would produce. Same code, not bit-identical.8. Frame rates: what they are and are not
D3D12 medians: 7.8 (base), 8.8 (head), 11.6 (head, package DLL); Vulkan medians: 11.8 (head), 13.7 (base). They are the host's own present counters, one run each, on a cold shader cache, on a shared-memory iGPU, with the machine's other processes uncontrolled. They are not measurements, not a comparison of the two renderers, and not a comparison of the two commits. What they do say: the D3D12 renderer is playable-slowly on this iGPU and not obviously several times slower than Vulkan on the same machine, which is as much as one cold run can show. The fork's own notes give frame rates for a discrete B580; that is a different machine.
9. Game-free results on Linux
All runs strict, six at a time, in separate worktrees of the base, the head and current main (
876dc3609).5e7d84ab2f0f9a048etests/test_d3d12_*.pypass at the base and at the head (astc_gpu, back_diff, bounce_homes, cbufs, copy_split, live_bounce, lookups, pool_open_race, program_cache, resume_collects, snorm_attributes, vertex_copy, workers).nx2/test_draw_parameters.pyandtests/test_mesh_unreachable_outputs.py. Both are text-cutting fixtures of Eden's SPIR-V emitter: the head's emitter now usesctx.profile.hlsl_mesh,ctx.cf_depthandctx.cf_early_exit, which the fixtures' stand-in context does not have (error: no member named 'profile' in 'Ctx',no member named 'cf_early_exit'). The fork's commit message says the same 47 tests fail before and after on the author's PC; on this PC these two pass before and fail after. They test the Vulkan back end's emitter, which the commits change behindhlsl_meshandcf_depthguards, so the fix is probably to extend the fixtures' stand-in, and a Vulkan run of the head is still wanted (the commit message says it was not checked).test_framegen_preset,test_import_reach,test_rumble_menu,test_target_image_pool,test_tested_configurations,test_upscaler_round_trip,test_vcore_escape,test_vk_swapchain_compat).test_d3d12_pool_open_race.pypasses;test_d3d12_program_cache.pyfails because its generated C++ lacks_CRT_SECURE_NO_WARNINGSunder-Werror(fopenandmemcpyare deprecated), and it fails identically at the base, so it is inherited, not caused by these two commits.third_party/spirv-cross(Apache-2.0, withLICENSE,LICENSES/*and a PROVENANCE with upstream URL, SHA-256 and tree SHA-256),third_party/dxc-api(the header, three licence texts, PROVENANCE with URL and hash), and earlier in the branchthird_party/directx-headers(MIT) andthird_party/mesa-spirv-to-dxil(two headers; the PROVENANCE names the DLL asset but has no URL and no hash, see section 7). The repository's own check says "17 parts as their notes say".10. Distance from main
5e7d84ab2is 32 commits ahead and 82 behind main; headf0f9a048eis 34 ahead and 82 behind. The merge base is544229a26(17 November 03:50 UTC). The compare is 59 changed files bygit diff(+54,615 / -110), three fewer than the 62 quoted for it.gpu/vk/switches.defandtests/test_switch_table.py.MKWVK_API_VERSIONis 29 on the branch and 33 on main, andmkwvk_initreturns null for any other version. The shared interface gained four versions since the branch forked (vk_api.hchanged by +31/-3 lines), so a rebase has to teach the D3D12 renderer table the four versions of the seam, not just resolve two files.gpu/d3d12/does not exist on main at all: the work is 34 commits wholly outside main. The translator inputs (nx2/) are untouched by the whole branch (two fresh Windows lifts gave equal lift keys for base and head).vk_*.cpp: a new profile flag (hlsl_mesh), a newmesh_output_remapin the runtime info, a warp-in-workgroup emission (+153 lines inemit_spirv_warp.cpp), +174 lines in the emit context, control-flow-depth tracking inemit_spirv.cpp, andOpIAddCarryoutput inemit_spirv_integer.cpp, plus about 60 new switch rows. The D3D12 DLL fills 27 of the interface table's 36 renderer members and leaves 9 null (option,option_set,setting,setting_set,jitter_sample,nvn_program_created,nvn_pool_created,nvn_vmap_changing,nvn_texture_created), which the host tolerates: no overlay, settings or upscaler yet. That is the main reason the second back end fit behind the seam without touching the Vulkan renderer files.11. Suggested next steps, in order
nx2/test_draw_parameters.py,tests/test_mesh_unreachable_outputs.py) so the Vulkan-side checks pass again, and run the head's Vulkan back end in the game at least once on a GPU where it is known good (the commit message says it was not checked).RX_D3D12_DEBUG=3limited to the one frame, around program 4059 and the draws after it in the 960x540 R11G11B10F pass. Two GPUs now stop at the same replay operation, so a debug-layer message is likely to be the same on both.8c6e6f8e..., 10,407,936 bytes, from mesa-dist-win release 26.2.6) inthird_party/mesa-spirv-to-dxil/PROVENANCE.md.12. Limits of this test
longshot_vk.dllroute (it needs a launcher-installed rc.7 exe).13. What we can share
The run folders (log, present trace, bridge pictures, a judge file per run), the crash report, the build receipts with all hashes and the whole-suite comparison are kept by us. Ask and we will attach them.
New on this forge; not opened on GitHub.
Possibly related, for context: