dxil-spirv: read and write 2 to 4 dwords of a byte-address buffer through one untyped pointer (VKD3D_UNTYPED_VEC_SSBO, off by default) #411
No reviewers
Labels
No labels
accessibility
bug
documentation
duplicate
enhancement
good first issue
help wanted
invalid
question
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
github/lobomfz--VIctory-xmem!411
Loading…
Reference in a new issue
No description provided.
Delete branch "github-bot/gh-411"
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?
@CorvetteCole on GitHub · 2026-12-04 01:37 UTC · original
CorvetteCole:vkd3d-untyped-vec-ssbo→main· +224 −0 · 2 files · 1 commits · openWhat
Adds
VKD3D_UNTYPED_VEC_SSBOtopatches/vkd3d.dxil-spirv.patch(the dxil-spirv submodule of vkd3d-proton). Off by default; nothing changes unless it is set.With it set, a DXIL
rawBufferLoadof 2 to 4 dwords (up to 16 bytes) from a storage buffer is emitted as oneOpUntypedAccessChainKHRplus one vectorOpLoad ... Aligned <elem size>(SPV_KHR_untyped_pointers), instead of oneOpAccessChain+OpLoadper live component on auint[]runtime array. Stores of 2 to 4 dwords are handled the same way (VKD3D_UNTYPED_VEC_SSBO=loadsleaves stores alone).Why: RADV compiles the per-component
uint[]loads as separate dword loads when it cannot prove they are adjacent and in range (data-dependent offsets, non-uniform descriptors, robust buffer access), so aLoad4becomes up to fourbuffer_load_b32. A single vector load is one memory instruction. Components that are not read are not loaded; a live range with a gap (for example.xand.wof aLoad4) is loaded as the whole span.Files:
patches/vkd3d.dxil-spirv.patch(the diffgit diff HEADof the dxil-spirv submodule gives, astools/patch.sh vkd3dwrites it; the existingRADV.bvh64hunks are unchanged and the new hunks are inopcodes/dxil/dxil_buffer.cpp) and one row indocs/SETTINGS.md.Measured
RX 7900 XTX (RDNA3 / GFX11), Linux, pinned Mesa 26.3.1 RADV, native 1440p (
VICTORY_RENDER_SCALE=1.0),45591b0,VICTORY_SHADER_OPT=63,VICTORY_WARM=0. A/B/B/A, 85 s per run, frame time is the median of the last 8 per-second samples,drops=0on every run, separate shader and vkd3d caches per arm, same scene.VKD3D_UNTYPED_VEC_SSBO11VICTORY_HW_RT=1 VICTORY_HW_RT_LEAN_BUILDER=1), an ABBA with isolated caches measured33.27 ms(unset) vs33.43 ms(=1, +0.16 ms), confirming the gain above comes primarily from the software BVH builder and ray-walk shaders that hardware RT replaces — another reason to keep this opt-in (off by default).ISA
I checked the effect offline on a gfx1100 (navi31) target: dxil-spirv built from this patch at
b540c8a2, then RADV 26.3.1 withrobustBufferAccessandrobustBufferAccess2enabled, compiled throughVK_KHR_pipeline_executable_properties. Probe (HLSL, SM 6.6, bindless heap, a non-uniform descriptor index and a data-dependent 4-byte-aligned offset, so nothing is provably merged):VKD3D_UNTYPED_VEC_SSBO=1buffer_load_*buffer_load_b32(offsets 0, 12, 68, 72)buffer_load_b128+buffer_load_b64 offset:68A simpler probe with constant offsets and no robustness gave identical ISA both ways (RADV already merges those), so the change only matters where the merge is blocked. I have not diffed the ISA of the game's own shaders for this PR.
Applies to the pinned source
patches/vkd3d.dxil-spirv.patchapplies withgit apply --indexto dxil-spirvb540c8a2(the submodule commit of the vkd3d-proton71cae091thatsetup.shpins), and the build links; this PR's diff applies to currentmain. I did not rebuild a fullsetup.sh vkd3dfrom scratch.Notes
vkd3d-cachewhen you turn it on or off (the docs row says so).SPV_KHR_untyped_pointers(Mesa 26.3.1 RADV does). The extension and capability are only declared in shaders that actually use an untyped load or store.loadsvs1), and other GPUs. I'd expect a smaller effect on cards where RADV already merges, and I have no number for RDNA2 or RDNA4.span * element size <= 16), so 64-bit elements go up to 2 components.github-bot referenced this pull request2026-12-04 01:49:31 +00:00
github-bot referenced this pull request2026-12-04 01:49:34 +00:00
github-bot referenced this pull request2026-12-04 01:49:36 +00:00
@Luxuride on GitHub · 2026-12-04 11:28 UTC · original
The translator change reads right and applies cleanly to dxil-spirv
b540c8a(git apply --checkagainst a pristine archive), and the store path being anelse ifonraw_vec_size == 1keepsindex_idin scalar units — that part needs nothing.Two fixes:
patches/vkd3d.dxil-spirv.patch:38-42parses "anything not unset/empty/0/loads" as loads and stores, soVKD3D_UNTYPED_VEC_SSBO=false,=off,=noand=Loadsall enable the widest mode whiledocs/SETTINGS.md:141advertises only1andloads.=falseis exactly what someone writes to compare runs, and it silently does the opposite. Accept0/off/false/noas off,loadsas loads-only,1/on/true/allas both, warn on anything else.docs/SETTINGS.md:141is inside the "Listed in the menu under Performance" table, but the menu is parsed fromrun.conf.default(crates/victory-core/src/menu.rs:604,:630) and this PR adds no row there — aVKD3D_*variable belongs in "Runtime-only settings" (:144). While there: the switch only exists after./setup.sh vkd3dre-applies the patch and rebuilds, which the "start from an empty cache" note does not say.One risk worth a sentence in the "Effect" cell: the widened load spans lowest-to-highest live component (
patch:97-113), so a straddle across the buffer end now makes the in-range dwords of that span robust-zero too. Narrow, but it is the one behaviour change the row does not mention.View command line instructions
Manual merge helper
Use this merge commit message when completing the merge manually.
Checkout
From your project repository, check out a new branch and test the changes.Merge
Merge the changes and update on Forgejo.