d3d12: Xbox device slots 70/71 write buffer views from a buffer description and its address (RT-TITLE-BUFFER-VIEWS) #1160
Closed
leonida/mandy
iFeyz wants to merge 0 commits from
feat/title-buffer-views into main
pull from: feat/title-buffer-views
merge into: leonida:main
leonida:main
leonida:github-pr/3295
leonida:beta
leonida:docs/changelog-3483-3500
leonida:github-pr/3294
leonida:github-pr/2975
leonida:github-pr/2815
leonida:feat/gate-driver-start
leonida:feat/skip-pipelines-release
leonida:perf/lazy-compare
leonida:perf/mwaitx-wait
leonida:test/prio-ceiling-main
leonida:fix/ab-cpu-stdout
leonida:fix/gate-old-crashes
leonida:diag/ab-cpu
leonida:test/main-0312
leonida:github-pr/3291
leonida:diag/indirect-clamp-census
leonida:feat/barrier-enhanced
leonida:perf/texture-frame-ceiling
leonida:perf/dstorage-threads
leonida:fix/console-queue-dma-tables
leonida:fix/port-descriptors-record-parts
leonida:fix/frame-waits-fence
leonida:fix/console-sampler-words
leonida:fix/graphics-userdata-spill
leonida:fix/xg-reserved-layout-rotation
leonida:fix/barrier-console-flags
leonida:fix/switches-wait-test-child
leonida:test/list-value-waits
leonida:test/lot-gxdk-0412
leonida:fix/bvh-compacted-size
leonida:docs/i18n-quickstarts
leonida:feat/native-pipeline-slots
leonida:fix/clippy-leonida-gpu
leonida:fix/list-value-producers
leonida:fix/descriptor-page-straddle
leonida:fix/xmem-low-window
leonida:fix/ffx-jitter-never-zero
leonida:fix/run-stdout-closed
leonida:github-pr/2892
leonida:github-pr/2896
leonida:feat/warm-save-every
leonida:github-pr/2980
leonida:github-pr/2994
leonida:github-pr/3005
leonida:github-pr/3010
leonida:github-pr/3136
leonida:github-pr/3303
leonida:github-pr/3220
leonida:github-pr/3143
leonida:github-pr/3330
leonida:github-pr/3226
leonida:github-pr/3187
leonida:carry/3395
leonida:github-pr/2946
leonida:github-pr/2947
leonida:github-pr/2945
leonida:github-pr/2983
leonida:github-pr/3001
leonida:github-pr/3372
leonida:github-pr/3128
leonida:github-pr/3296
leonida:github-pr/2588
leonida:github-pr/3119
leonida:github-pr/3378
leonida:fix/crash-diagnostics
leonida:feat/dlss-mip-bias
leonida:fix/retired-out-of-order
leonida:fix/dxr-postbuild-barrier
leonida:fix/amd-relay-default
leonida:fix/removed-report-wait
leonida:feat/heap-twin
leonida:feat/vram-margin
leonida:github-pr/2472
leonida:github-pr/3123
leonida:github-pr/3088
leonida:assets/annonce-v1
leonida:github-pr/2794
leonida:github-pr/3300
leonida:github-pr/3304
leonida:github-pr/3308
leonida:github-pr/3367
leonida:github-pr/3369
leonida:fix/launcher-dlss-diagnostics
leonida:github-pr/3269
leonida:github-pr/2957
leonida:github-pr/3205
leonida:fix/crash-zero-guard
leonida:github-pr/3185
leonida:github-pr/3099
leonida:github-pr/3104
leonida:github-pr/3348
leonida:github-pr/3379
leonida:github-pr/3377
leonida:perf/darner-title-priority-ceiling
leonida:github-pr/3376
leonida:gh-readonly-queue/main/pr-3311-b5c45b663dbc5a9c3532bb3f307e5f81b32faefa
leonida:gh-readonly-queue/main/pr-3088-af22e7847ff5808f72d1a1881c24be2fafd20b54
leonida:gh-readonly-queue/main/pr-3123-7f3fa026a94c6646e89244f28e1ce22290361867
leonida:github-pr/3373
leonida:github-pr/3368
leonida:github-pr/3198
leonida:gh-readonly-queue/main/pr-3354-637baa0b77ba47222e7280b17c1a59c6a1781d57
leonida:gh-readonly-queue/main/pr-3365-d7a0e0196a43834813014b4bd3aa5502a8263b14
leonida:gh-readonly-queue/main/pr-3361-5dfe8bbd05ed12fb2f2e1718d9af77a7c5f46fd8
leonida:gh-readonly-queue/main/pr-3366-8da9148204e9d12c585efa9ac2b7cc1ab08c7682
leonida:github-pr/3346
leonida:github-pr/3375
leonida:github-pr/2958
leonida:github-pr/3151
leonida:github-pr/3307
leonida:github-pr/3278
leonida:github-pr/3374
leonida:fix/runtime-test-conservative-fixtures
leonida:github-pr/3366
leonida:ci/shard-semantic-linux
leonida:github-pr/3354
leonida:docs/fg-limit-fps-switch
leonida:github-pr/3365
leonida:fix/read-file-hard-link
leonida:github-pr/3364
leonida:fix/book-slot-heap-never-read
leonida:github-pr/3361
leonida:github-pr/3263
leonida:github-pr/3360
leonida:github-pr/3353
leonida:github-pr/3331
leonida:fix/alias-later-queued-submissions
leonida:github-pr/3352
leonida:github-pr/3228
leonida:github-pr/3349
leonida:claude/gallant-sagan-aamatr
leonida:github-pr/3200
leonida:github-pr/3132
leonida:github-pr/3323
leonida:github-pr/3332
leonida:github-pr/3340
leonida:github-pr/3311
leonida:github-pr/3334
leonida:github-pr/3297
leonida:github-pr/3256
leonida:github-pr/2567
leonida:github-pr/2851
leonida:d3d12/agility-sdk-621
leonida:github-pr/3164
leonida:github-pr/3114
leonida:github-pr/3050
leonida:github-pr/3113
leonida:github-pr/3326
leonida:github-pr/3144
leonida:github-pr/2642
leonida:github-pr/3072
leonida:github-pr/2789
leonida:github-pr/2643
leonida:github-pr/3009
leonida:github-pr/3035
leonida:github-pr/3031
leonida:github-pr/2686
leonida:github-pr/2834
leonida:github-pr/3321
leonida:github-pr/3325
leonida:github-pr/3290
leonida:github-pr/3324
leonida:github-pr/3130
leonida:claude/fervent-curie-m19lnr
leonida:github-pr/3309
leonida:github-pr/3305
leonida:github-pr/3306
leonida:github-pr/3302
leonida:github-pr/3301
leonida:github-pr/3345
leonida:github-pr/3211
leonida:github-pr/3027
leonida:github-pr/3286
leonida:github-pr/3235
leonida:github-pr/3265
leonida:github-pr/3275
leonida:codex/skip-no-hit-ray-passes
leonida:github-pr/2823
leonida:github-pr/2911
leonida:github-pr/3262
leonida:github-pr/3125
leonida:github-pr/3206
leonida:github-pr/3250
leonida:github-pr/3238
leonida:github-pr/3188
leonida:github-pr/2952
leonida:github-pr/3217
leonida:github-pr/3168
leonida:t3/preserve-fsr-sdk-restart-path
leonida:t3/propagate-host-failure-hresult
leonida:github-pr/3209
leonida:t3/launcher-custom-parameters
leonida:github-pr/3207
leonida:github-pr/3183
leonida:github-pr/3160
leonida:github-pr/3201
leonida:ci/less-to-run
leonida:github-pr/2930
leonida:github-pr/2797
leonida:github-pr/2999
leonida:perf/native-compute-shader-forms
leonida:github-pr/3191
leonida:github-pr/3011
leonida:github-pr/3019
leonida:github-pr/2996
leonida:gh-readonly-queue/main/pr-2789-45dc41f95c1cd0dcc29c2c50582e0e9af8a77259
leonida:claude/blissful-franklin-ukp7ag
leonida:github-pr/3141
leonida:github-pr/3156
leonida:github-pr/3150
leonida:github-pr/3153
leonida:github-pr/3163
leonida:github-pr/3142
leonida:github-pr/3139
leonida:github-pr/2841
leonida:github-pr/3069
leonida:github-pr/3098
leonida:github-pr/3107
leonida:github-pr/3071
leonida:github-pr/2774
leonida:github-pr/2889
leonida:github-pr/3075
leonida:github-pr/2661
leonida:github-pr/3064
leonida:github-pr/3054
leonida:github-pr/3049
leonida:github-pr/2855
leonida:github-pr/2943
leonida:github-pr/3016
leonida:github-pr/2887
leonida:github-pr/3006
leonida:github-pr/3003
leonida:github-pr/2993
leonida:notes/card-time-and-plant-flicker
leonida:github-pr/2989
leonida:feat/vulkan-rs
leonida:github-pr/2985
leonida:github-pr/2951
leonida:github-pr/2982
leonida:github-pr/752
leonida:github-pr/792
leonida:github-pr/2877
leonida:github-pr/2654
leonida:github-pr/2893
leonida:github-pr/2948
leonida:github-pr/2944
leonida:github-pr/2919
leonida:github-pr/2915
leonida:archive/ci/less-to-run/20261202T1121Z
leonida:github-pr/2800
leonida:github-pr/2822
leonida:github-pr/2833
leonida:github-pr/2840
leonida:github-pr/2831
leonida:github-pr/2832
leonida:github-pr/2801
leonida:github-pr/2890
leonida:github-pr/2891
leonida:github-pr/2664
leonida:github-pr/2807
leonida:rt-call-trace
leonida:github-pr/2755
leonida:perf/ahead-split
leonida:github-pr/2587
leonida:github-pr/2698
leonida:github-pr/2609
leonida:github-pr/3219
leonida:docs/readme-runtime-proposal
leonida:github-pr/2017
leonida:github-pr/1741
leonida:github-pr/1667
leonida:codex/coord-claim-check-20261124-7e48
No reviewers
Assignees
Clear assignees
No assignees
Labels
Clear labels
bug
Something isn't working
dependencies
Pull requests that update a dependency file
documentation
Improvements or additions to documentation
enhancement
New feature or request
missing claim
Needs a claim in #14
needs rebase
Conflicts with the base branch: rebase it on main
needs-triage
Needs maintainer evaluation before the next triage state
question
Further information is requested
ready-for-agent
Fully specified and ready for an AFK agent
submodules
Pull requests that update submodules code
No labels
bug
dependencies
documentation
enhancement
missing claim
needs rebase
needs-triage
question
ready-for-agent
submodules
Projects
Clear projects
No items
No project
Milestone
Clear milestone
No items
No milestone
Dependencies
No dependencies set
Notifications
1 participant
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".
No due date set.
Reference
leonida/mandy!1160
Loading…
Reference in a new issue
No description provided.
Delete branch "feat/title-buffer-views"
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?
Pull request closed
This pull request cannot be reopened because the branch was deleted.
Claimed in the coordination issue as: RT-TITLE-BUFFER-VIEWS (https://github.com/ubiquitarianism/leonida/issues/14#issuecomment-7141517462)
Depends on: #1079 (this branch is built on it; its last commit is this pull request)
What and why
@DadaCap measured that Xbox device slots 70 (SRV) and 71 (UAV) also make buffer views, and that the missing ones are a cause of the world-phase GPU fault: with the null descriptor, the instance-culling dispatches read leftover memory as a V# and the device is lost (issue #14, comment 7140195321). #1079 resolves the texture half of the same two slots; this is the buffer half, on top of it.
runtime/shims/d3d12_xs_device.cpp: a buffer description now reaches the placed-view handler too, not onlyTEXTURE1D..3D.runtime/shims/d3d12_vulkan_device.cpp,write_placed_view: a buffer description writes the V# of a buffer view of the description'sWidthbytes at the address (dwords 10–11 of the view words). The address is taken as a GPU address, asCreateConstantBufferViewtakesBufferLocation. The V# is built by the same code asCreateShaderResourceView/CreateUnorderedAccessViewfor a buffer resource, factored out aswrite_buffer_srv_at/write_buffer_uav_at(address and size in, no resource object), so raw, structured and typed views and their bounds checks are the PC methods' and are not copied.0x20004) needs no masking: onlyALLOW_UNORDERED_ACCESS(0x4) is read.docs/d3d12_vulkan.md, next to #1079's paragraph on slots 70/71.Not measured here: whether the title's addresses for these buffers are ones the layer can read on every stack. They are used the way a CBV's address already is.
When stacked with DadaCap's
boot-prototype(or anything that addsarena_va()): the slot's address belongs to the same family as a CBV's or a vertex view's there, so translate it witharena_va()once inwrite_placed_viewbefore the two helpers are called. Takingwrite_buffer_srv_atwhole from this PR drops that call (DesertGamer's review, which re-ran with it kept).Retail result so far (DesertGamer, RTX 5070, with
arena_va()kept): the instance-culling device loss is still there at 83.4 s, so the null buffer views were at most one of its causes.Tested
d3d12_set0_compute_test(RX 9070 XT): through the real slot 70/71 entry points, with a buffer description carrying the retail flags0x20004, six views give exactly the descriptor the PC method writes for the same buffer: typedR32_UINT, structured stride 16 and 32 (UAVs); raw, structured, typed (SRVs). Three controls give the null descriptor: past the buffer's end, a counter offset, and a UAV of a description withoutALLOW_UNORDERED_ACCESS.99176da10):xs_proxy_mock*(6),d3d12_set0_compute,d3d12_placed_texture_uav_off: 8 of 8 pass,xs_proxy_mock_env_slots_invalidincluded now that #1079 routes its example away from slot 71.ctest303 of 308 pass. The 5 failures fail the same way without this commit:xs_proxy_mock_env_slots_invalidon #1079's previous head (passes on the current one, above), and the 4 already onmainhere (d3d12_clear,d3d12_execute_indirect_validation,d3d12_texture_tiles,d3d12_pipeline_library_host, reported in #14).tests/test_docs_links.py,scripts/check_no_game_data.pyon every changed file.GPUs tested: AMD Radeon RX 9070 XT, AMD Adrenalin 26.11.2 (Vulkan 1.4.359), Windows 11
AI-assisted: yes
Checklist
mainand merges cleanly (a conflicting pull request is labeledneeds rebase).docs/design.md, with how it was confirmed.Reviewed and verified. Vital breakthrough for title instance culling and crash resolution (RT-TITLE-BUFFER-VIEWS, Issue #14). Extends Xbox device slots 70 (SRV) and 71 (UAV) to construct raw, structured, and typed buffer views from a buffer description Width and GPU address via write_buffer_srv_at / write_buffer_uav_at. Prevents device-loss crash on instance-culling dispatches. Verified in runtime/test/d3d12_set0_compute_test.cpp and xs_proxy_mock_test.cpp. 100% clean-room.
Tested
d04e78e2bon Arch Linux + Wine 11.22 + NVIDIA RTX 3060 Ti (clang-cl + xwin cross-build):ctest --test-dir runtime/build/win -R "^(xs_proxy_mock.*|d3d12_set0_compute|d3d12_placed_texture_uav_off|d3d12_title_buffer.*)$" --output-on-failure:d3d12_set0_compute: Passed (5.53 s)d3d12_placed_texture_uav_off: Passed (5.57 s)xs_proxy_mock,_no_reserve,_no_protect,_no_handler,_env_slots: Passed (5/5)xs_proxy_mock_env_slots_invalid: Failed (5.35 s) —[rt] d3d12_xs: device slot 71 routed to placed view UAV->xs_proxy_mock line 1073: hr_of(raw(device, 71)) == S_OK && mock->calls[71] == 1(sameslot 71failure seen on currentmain)7 passed, 1 failed (88%).
AI-assisted: yes
measurement on the retail boot, #1160 on top of #1079 + #980 + #1028 (+ #1021 translated shaders, DadaCap prototype + #968): RTX 5070, Windows 11, NVIDIA 617.14
write_buffer_srv_atis given and post what they are.AI-assisted: yes (Claude Code, Sonnet 5.5)
correction, please disregard the measurement above as a statement about #1160: my stack was wrong, not the PR.
On my stack the buffer views go through
arena_va()(a buffer's GPU address is turned into its arena address); #1160 was written on a base without that, so its factoredwrite_buffer_srv_atwritesbase_va + byte_offas is. When I merged #1160 onto my stack I took its function whole and lost thearena_va()call in the three buffer cases, so the invalid addresses in the fault reports (0x21bcc41f000 here, 0x3233d5e0000 without #1160) and the earlier loss at 29 s say nothing about #1160 itself. The "reading" in my comment (a null descriptor became a real V# with a non-GPU address) was a guess made before I had looked at that line.I am re-running with the
arena_va()kept inwrite_buffer_srv_atand will post that result here. Whoever lands #1160 together with the change that introducedarena_va()in the buffer SRV path will hit the same textual conflict in that function, so it is worth knowing before both are merged.AI-assisted: yes (Claude Code, Sonnet 5.5)
result with
arena_va()kept inwrite_buffer_srv_at(the correction above), same stack as before: #1160 on #1079 + #980 + #1028, #1021 translated shaders, DadaCap prototype + #968, RTX 5070, Windows 11, NVIDIA 617.14, retail boot.The checkpoint output comes from
LEONIDA_CHECKPOINTS=1(RT-VK-CHECKPOINTS, claimed above); I can post the marker lines for the last few commands if useful.AI-assisted: yes (Claude Code, Sonnet 5.5)
Also tested
d04e78e2b(which carries #1079) stacked with #1028 (RT-DEVICE-FAULT-INFO) and #974 (00fc23b9a) onorigin/main(6293c1c4f, Arch Linux + Wine 11.22 + NVIDIA RTX 3060 Ti, retail 1.0.2.1):device slot 70is hit and routed toplaced view SRV(args 0xbb8764f810 0xbb8764f7d0 0xbbb4fe0220 0x0 0x0).VK_ERROR_DEVICE_LOST/VK_EXT_device_faultlines.mainbase (without our separateexp/stack-385frame-loop stack), the boot stops earlier at0x14247af2d: int3right afterdevice slot 127(dimension=3) anddevice slot 20.AI-assisted: yes
@madhyn @DesertGamer thank you both, that is exactly the check this needed.
arena_va(): it exists on DadaCap'sboot-prototype(d3d12_com.h, used for root views and vertex/index views there), not onmain. This pull request is written againstmain, where a constant-buffer view'sBufferLocationis used as is, sowrite_buffer_srv_at/write_buffer_uav_attake the slot's address the same way. On a stack that hasarena_va(), the slot's address belongs to the same family as a CBV's or a vertex view's. Translating it once inwrite_placed_viewbefore the two calls (or inside both helpers, as DesertGamer did) is the right merge. I will say so in the description so whoever stacks the two does not lose it.The culling loss: DesertGamer's run says #1160 alone does not remove it on that stack (lost at 83.4 s in an instance-culling dispatch, read of
0xf042c31e8000). So the null buffer views were at most one cause. That address does not look like an arena address. Whether it comes from a buffer view these slots write or from somewhere else is what the checkpoint markers (RT-VK-CHECKPOINTS) could show. If you post the last markers' bindings, I can check them against what #1160 writes.Recommendation: [WAIT]
Reasoning: Xbox device slots 70/71 now write buffer SRV/UAV views from a buffer description and address. This targets a world-phase device-loss cause, a significant runtime change (+453/-113). The branch is built on #1079, which must land first. The retail-boot measurements from DesertGamer and madhyn depend on DadaCap's out-of-tree
arena_va()stack, which isn't on main. Merge after #1079, once someone shows the device-loss improvement on main's own address path. CI (label, change-scope, no-game-data and the Runtime jobs) is still queued awaiting maintainer workflow approval, so nothing has run in CI yet; GitHub reports no merge conflict withmain.Impact level: 7/10
Ran this on Linux under Wine and Proton, as part of VERIFY-WINE-PROTON-GPU in #14. Your branch at c4afec17e as is, against its base #1079 at 99176da10: both now conflict with main (
d3d12_xs_device.h/.cppslot 70/74,xs_proxy_mock_test.cppmain), so I did not merge into main.d3d12_set0_computeline 159: expected != Words{} && got == expected,line 176: same(uav, true) == 0,line 325: check_placed_buffer_views(device.p) == 0d3d12_placed_texture_uav_offxs_proxy_mockand its five variantsThe same results on each host: WineHQ 11.22 (winewayland) and GE-Proton11-14 (winex11, with
d3d12,d3d12coreanddxgiset to native) on an RTX 3090 (NVIDIA 590.48.01), and GE-Proton on the Radeon iGPU of a Ryzen 5 7600 (RADV, Mesa 26.0.8) for the twod3d12_set0_computeregistrations. So the new buffer-view checks fail without your change and pass with it.These tests are Windows-only, so nothing ran natively. Built with clang-cl and xwin in a container; not run on Windows or with the retail game. It will need a rebase onto main after #1079's.
AI-assisted (Claude).
Hi @iFeyz, thanks for this pull request. It currently conflicts with
main(conflicting file(s):runtime/CMakeLists.txt,runtime/shims/d3d12_com_object.h,runtime/shims/d3d12_vulkan_device.cpp,runtime/shims/d3d12_xs_device.cpp,runtime/shims/d3d12_xs_device.h,runtime/test/xs_proxy_mock_test.cpp), so it carries theneeds rebaselabel. CONTRIBUTING.md asks authors to rebase their branch onmain; once it merges cleanly the label goes within the hour, and reviews start with the pull requests that do. Could you update the branch when you have a moment? If you no longer plan to continue with it, please say so here.AI-assisted (Claude Code, Claude Opus 5.5).
Closing this PR because the legacy C++ Vulkan runtime (and legacy Python shader compiler) is now considered deprecated in favor of the new Rust Vulkan runtime (in progress) and the Rust DX12 runtime (
d3d12/) available now. Thank you for the contribution! If you believe this PR was closed by mistake (for example, if it still applies to active tools,d3d12/, or general docs), please feel free to reopen it.