A buffer's size can be asked through a handle of its own (VICTORY_SIZE_OWN_HANDLE=1): AMD's compiler makes the pipelines it crashed on #339
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/Belobug--VIctory-Belobug-AMD!339
Loading…
Reference in a new issue
No description provided.
Delete branch "github-bot/gh-339"
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?
@thejacte on GitHub · 2026-11-26 20:48 UTC · original
thejacte:claude/rx9070xt-size-own-handle→rx9070xt· +240 −1 · 5 files · 3 commits · openOn an RX 9070 XT, the driver's compiler crashes on any pipeline that both reads a raw buffer view from the heap and asks that view for its size, through the same handle. The order of use in the source does not matter, nor the index or the loaded type, and it happens with our DXIL and with plain HLSL compiled by dxc alike. Two things avoid the crash:
This PR does the second, behind a switch. With
VICTORY_SIZE_OWN_HANDLE=1, the size query of a buffer read from a heap table gets that second handle, except:It is off by default in the code;
play.ps1turns it on (commit 3). The shader cache key includes the switch only when it is on, asVICTORY_PORT_CBVdoes, so existing caches keep their keys. With the switch off, the translation is unchanged.Notes from the review:
waterfall.loads, so it would not be excluded. No code path was found that produces this: the console compiler's own form for it goes throughoffset_at, which does fillloads. Excluding sites whose base value is inwaterfall.readswould close it, as a follow-up if you want it.Measured (Windows 11, RX 9070 XT, driver 32.0.32029.2010, Ryzen 7 9800X3D, 64 GB).
rx9070xtatcd8dfc0, diagnostics build, same save and place:play.ps1as the README has it)VICTORY_WARM_BAD=0warm-bad.txtWith the switch on, every pipeline the compiler used to crash on gets made. In the warm pass, none of the 25 crashes, and the run above refused none. In game, some of the texture, model and shadow flicker went away: those pipelines' work is no longer dropped each frame. The rest of the flicker is still there.
One thing to know: the pipeline keys do not change with the switch, so a key already on
warm-bad.txtis still skipped with the switch on. Clear those lines, or run once withVICTORY_WARM_BAD=0. If you like, a follow-up can put the switch into the key, or drop the list's entries when the switch is on.This replaces #252, which was cut from
rx9070xtbefore it was rebuilt.Commits
play.ps1turns the switch on (-More @{VICTORY_SIZE_OWN_HANDLE='0'}turns it off), as in #252.Tests (
crates/victory-shader/src/emit/size_tests.rs):The existing
emit::size_tests::the_record_count_of_a_structured_buffer_read_by_indexruns with the switch off. It still crashes the test process on this card, as it does onrx9070xttoday: that is the crash this switch avoids.Checked:
cargo clippy --workspace --all-targets --locked -- -D warningsand the same with--all-features: no new warnings. Todayrx9070xtfails both on two lints inhost/panel.rsandtexture.rs; the clippy PR fixes those.cargo test --workspace --locked: passes, except the AMD crash in the test named above.cargo xtask policy: passes.Written with Claude Code; reviewed by Codex (
/reviewagainstupstream/rx9070xt).So that AMD's compiler makes the compute pipelines it crashed on (see the commit before). In a run here (RX 9070 XT, the same place of the same save) the compiler crashed on 35 pipelines with it off, on none with it on, and the draws left out for want of a pipeline went from 3.5-4.3 % to 2.0 %. `-More @{VICTORY_SIZE_OWN_HANDLE='0'}` turns it off. Co-Authored-By: Claude Opus 5.5 <[email protected]>@thejacte on GitHub · 2026-11-26 20:55 UTC · original
This replaces #252.
rx9070xtwas rebuilt on avatarmanz's fork (cd8dfc0), so #252, cut from the old branch tip, no longer merges.Compared with #252:
cd8dfc0. One change from review: the shader cache key includes the switch only when it is on, asVICTORY_PORT_CBVdoes, so existing caches keep their keys.a_pixel_shader_asks_the_size_without_a_first_lane_read. It builds one program as a compute shader and as a pixel shader, with the switch on. The compute shader uses wave operations for the size's own handle; the pixel shader uses none. With the pixel guard taken out, the test fails.play.ps1turns the switch on, as #252 did.-More @{VICTORY_SIZE_OWN_HANDLE='0'}turns it off.Results reported on #252, carried over here:
cd8dfc0.Thank you both.
@MamaLeVrai on GitHub · 2026-11-26 22:31 UTC · original
Tested on an RX 6950 XT 16 GB (RDNA 2), driver 32.0.21045.29003, Windows 11 build 26300, Rust 1.98.1, release, at
7518bc3:victory-shader305 passed, 0 failed, 4 ignored;victory-gpu386 passed, 1 failed, 34 ignored. The one failure,descriptor::host::tests::views_are_made_beside_the_heap_and_copied_in, fails the same way oncd8dfc0on this card (#288 fixes it).AI-assisted (Claude Code); no game data.
@VlREX on GitHub · 2026-11-27 00:47 UTC · original
RX 9070 GRE / Windows 10 hardware validation — VIREX Test Studio
Without the workaround: reproducible crash inside CreateComputePipelineState, amdxc64.dll, exception 0xC0000005, offset 0x861B9F.
With the #339 workaround:
Validation commit:
github.com/VlREX/VIctory-Belobug-AMD@8d291ff08dTested the #339 source changes combined with #360 and #418. This confirms the targeted workaround on another RDNA4 GPU under Windows 10. Full workspace and in-game performance are not yet validated.
Thanks for the fix!
AI-assisted validation by VIREX.
@adrianmjim on GitHub · 2026-11-27 06:26 UTC · original
Tested on RX 7900 XT (RDNA 3), driver 32.0.32029.2010, Windows 11 26300, Rust 1.98.1, release builds. Heads: PR head
7518bc3(basecd8dfc0), and #339 merged locally onto a-publier4eb6cfd.Merge onto
4eb6cfd: the Rust merges cleanly. Onlyscripts/play.ps1conflicts, with #327. The conflict is textual: both change lines next to each other.Whole-archive translation (
translate --validate --list, all of shaders.rpf, default wave):cd8dfc0. The same holds on4eb6cfd.CS_RaytracingResolveand the 4 bvh_skinning TreeAnim.play.ps1turning the switch on, about half of the archive is retranslated, not only the crash family.4eb6cfd):CS_RaytracingResolve(all ped_; these are every ped_ resolve #324 changes), 3 VS and 3 MS.CS_RaytracingResolve, 13 InstanceCulling*_BatchCull*, and 1 water_micro_geom_rendererCS_SurfacePrimitives.GPU, RDNA 3:
emit::size_tests::the_record_count_of_a_structured_buffer_read_by_index(one handle, switch off) passes on hardware and WARP, 6 of 6 runs on each binary. On this card it does not kill the process.emit::size_tests::passes 11/11 on the head and on the merge.descriptor::host::tests::views_are_made_beside_the_heap_and_copied_inpasses at7518bc3on this card, without #288.translate --validate --pipelinesover the containers the switch changes, with wave and RDNA taken from the adapter:cd8dfc0(switch off), the head (on),4eb6cfdand the merge (on). None refused, no process died. Under wave64 the switch changes all 2337 emitted programs here too.4eb6cfdand on the merge with the switch on. The switch changes all 10317 emitted programs. None refused, no process died. The same 71 MS fail validation on both.With
VICTORY_SIZE_OWN_HANDLE=1set in the environment, 6 existing victory-shader lib tests fail, on both the head and the merge:emit::lower::tests::waterfall_loops_over_descriptors_joined_per_lane_sample_with_each_lanes_ownemit::waterfall_tests::lanes_load_from_the_buffer_their_nested_arms_choseemit::waterfall_tests::lanes_sample_the_entry_their_offset_names_in_the_console_waterfallemit::waterfall_tests::lanes_sample_the_texture_their_arm_loaded_or_pickedemit::waterfall_tests::lanes_sample_the_texture_their_if_else_arm_choseemit::waterfall_tests::lanes_sample_their_own_texture_in_a_waterfall_narrowed_by_v_cmpxAll 6 fail on
assert!(!wave_ops):waterfall.loads.waterfall_testsGPU tests give the expected values on hardware and WARP.TEST_SIZE_OWN_HANDLEtoSome(false)in those tests would make them independent of it.#422 (a-publier) makes the same change without a switch: the size query's handle at
WaveReadLaneFirst(index), withTRANSLATOR_VERSION3. It skips any program with a waterfall loop rather than per load, which covers the 6 waterfall tests above, and it does not skip pixel shaders. The crashing "second handle at the same heap index" row in #422 has noWaveReadLaneFirst; the form here matches its "WaveReadLaneFirst(index): made, correct" row. The two PRs conflict inemit/lower.rsat the same call site.Not tested:
The AMD driver shader cache was left on.
By reading only: on
4eb6cfd,warm-bad.txtis scoped by fingerprint (#294), and the switch is part of the fingerprint. So entries taggedfp=that were written without the switch should be retried with it on. Bare-key lines, such as those written by cd8dfc0-era binaries, still apply whatever the fingerprint, so those are still skipped.View command line instructions
Checkout
From your project repository, check out a new branch and test the changes.Merge
Merge the changes and update on Forgejo.