Skip to content

Shaders: a buffer's size through a non-uniform handle of its own (AMD compiler crash) - #19

Open
rgroenewoudt wants to merge 1 commit into
KyleS98:mainfrom
rgroenewoudt:fix/amd-size-query-handle
Open

rgroenewoudt wants to merge 1 commit into
KyleS98:mainfrom
rgroenewoudt:fix/amd-size-query-handle

Conversation

@rgroenewoudt

Copy link
Copy Markdown

Problem

On an AMD RX 9070 (driver 32.0.32029.2010) the game crashes about 2 s after start, every run, in AMD's shader compiler:

unhandled exception 0xc0000005 at amdxc64.dll+0x861b9f (read 0x8: nothing mapped there)
  ...
  #38 victory.exe  victory_gpu::pipeline::library::pipeline   (library.rs:593, create())
  #39 victory.exe  victory_gpu::pipeline::host::HostPipeline::new  (host.rs:643, CreateComputePipelineState)

The compiler reads a null pointer when a buffer's size query (getDimensions) uses the same uniform heap handle as the buffer's loads. Changing launch switches makes no difference.

Fix

The size query gets its own heap handle, at the same index as the loads (raw twin included), marked non-uniform. That handle is not counted in nonuniform_handles, because its index is the same in every lane. Textures and waterfall loads stay as they were.

Original fix

This is a port. The fix was written by others:

Testing

  • With play-foxhound.ps1 -SeriesS the game starts and keeps running on the RX 9070. Before this change it crashed on every start.
  • scalar_table_load_uses_the_base_index_and_computed_soffset now expects a second handle at the same slot, as in the trustno1 port.
  • size_tests::the_record_count_of_a_structured_buffer_read_by_index crashes (access violation) on this card with and without this change, and on trustno1 too. It is not caused by this PR. Because that crash stops the test process, the full victory-shader suite did not run to the end. The other 7 size_tests pass.

… compiler crash)

AMD's shader compiler (amdxc64.dll+0x861b9f, RX 9070, driver 32.0.32029.2010) reads a null
pointer in CreateComputePipelineState when a buffer's size query shares the uniform heap
handle the buffer's loads use. The game crashed about 2 s after start on every run.

The size now gets a heap handle of its own (the loads' raw twin index included), marked
non-uniform and not counted in nonuniform_handles.

Port of trustno1-coder/VIctory-NVIDIA 66da8aaa, itself a port of DexNom/VIctory#62
(MrToucann); approach from fxceless/victory-fork#1213 (IxMxAMAR).
@KyleS98

KyleS98 commented Nov 29, 2026

Copy link
Copy Markdown
Owner

Thank you, a crash at start on a whole card family is exactly what is worth fixing first. I have no Radeon, so what I can check is that it costs the other cards nothing. On an RTX 3090 Ti, your branch merged onto main:

  • Every program of the title, offline: 14,247 of 14,247 vertex and pixel programs, 2,677 of 2,682 compute programs and 8,765 of 8,765 mesh programs translate, as on main; the validator passes the same ones as on main (all vertex, pixel and compute; 8,694 mesh, the rest being the validator's output-size limit, not this).
  • cargo test -p victory-shader on the card: 380 passed.
  • In the game it needs a full preload, since the translation of every program that asks a buffer's size changes; that is running now, with the opening, the cell, the first house and the deck after it.

I will merge when those are through and post the numbers. One question meanwhile: is the RX 9070 past the crash with this alone, and how far does it get?

AI-assisted (Claude Code, Claude Fable 5.2).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants