Shaders: query a descriptor's level count only when word 3 is read #259

Closed
desplmfao wants to merge 2 commits from upstream-pr/259 into main
desplmfao commented 2026-11-24 01:53:14 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by desplmfao on 2026-11-24T01:53:14Z.


Problem

On NVIDIA under Wine with vkd3d-proton (#144), loading into the world ends the process inside the driver: vkCreateComputePipelines Exception 0xc0000005 in Unix call, with no crashes.log entry. On current vkd3d-proton (3.2.0) and with #177 applied, the remaining crashing compute shaders here were 9938c251a313fe28, ef05293f6107fc99, a3d1a26ad0c8c2cd and b80cd30e37e3fa05.

When a program reads an image descriptor as data, descriptor_data rebuilds the descriptor words from getDimensions and always extracts the level count for word 3. vkd3d-proton turns that into OpImageQueryLevels. On a 3D image inside a loop, NVIDIA's Vulkan compiler crashes on it. These shaders load the whole descriptor (s_load_dwordx8) in a loop but never read word 3 as data.

How it was found

  • Dumped the SPIR-V vkd3d-proton generates for these shaders (VKD3D_SHADER_DUMP_PATH). It passes spirv-val. Creating a pipeline from it in a small native Linux Vulkan program (no Wine, no vkd3d-proton) segfaults the NVIDIA driver too.
  • spirv-reduce against that native crash leaves a module of a few blocks. It crashes only with all three: OpImageQueryLevels, a 3D image, and the query inside a loop. OpImageQuerySizeLod instead, a 2D image, or the query moved out of the loop all build.
  • In all four crashing shaders, every 3D-image query sits inside a loop. In 25 compute shaders that build fine, none does.

Change

descriptor_data extracts the level count only when some instruction or phi reads word 3's register as data, not as the resource operand of a memory instruction, which takes the descriptor whole. Otherwise the level count is not queried; word 3's value is then unused. Programs that do read word 3 are unchanged.

Testing

  • RTX 5080, driver 615.71.09, CachyOS, proton-cachyos 11.0 (20260703), Series X 1.0.2.1, release build cross-compiled from Linux.
  • victory translate <dir> --pipelines on the four shaders: all crashed before, all create their pipeline after.
  • In game: all four now create their host pipelines and loading continues past the point where it crashed before.
  • cargo test -p victory-shader passes.
  • Not tested on Windows or on AMD; the change only skips a query whose result was unused.

What else this was run with

These are separate, and this PR does not include them:

  • #177: fixes the invalid float-handle atomics (5d113aa6830760b6 and the pixel shaders that crashed in vkCreateGraphicsPipelines).
  • #151: 16 MiB default thread stack. It removed stack overflows I saw, but not these crashes.
  • vkd3d-proton 3.2.0 (d3d12.dll, d3d12core.dll from Proton Experimental 11.0-20261112) next to victory.exe. Older vkd3d-proton builds crash on other shaders (8bb272e763f76148, 4e296b1885c37b29, 6a62009bc6a4146e); see #144.

Related: #144.

🤖 Generated with Claude Code

<!-- greyfinch-sync:Marvisak/VIctory:issue:6572805503 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/259). Originally posted by [desplmfao](https://github.com/desplmfao) on 2026-11-24T01:53:14Z. --- ### Problem On NVIDIA under Wine with vkd3d-proton (#144), loading into the world ends the process inside the driver: `vkCreateComputePipelines Exception 0xc0000005 in Unix call`, with no `crashes.log` entry. On current vkd3d-proton (3.2.0) and with #177 applied, the remaining crashing compute shaders here were `9938c251a313fe28`, `ef05293f6107fc99`, `a3d1a26ad0c8c2cd` and `b80cd30e37e3fa05`. When a program reads an image descriptor as data, `descriptor_data` rebuilds the descriptor words from `getDimensions` and always extracts the level count for word 3. vkd3d-proton turns that into `OpImageQueryLevels`. On a 3D image inside a loop, NVIDIA's Vulkan compiler crashes on it. These shaders load the whole descriptor (`s_load_dwordx8`) in a loop but never read word 3 as data. ### How it was found - Dumped the SPIR-V vkd3d-proton generates for these shaders (`VKD3D_SHADER_DUMP_PATH`). It passes `spirv-val`. Creating a pipeline from it in a small native Linux Vulkan program (no Wine, no vkd3d-proton) segfaults the NVIDIA driver too. - `spirv-reduce` against that native crash leaves a module of a few blocks. It crashes only with all three: `OpImageQueryLevels`, a 3D image, and the query inside a loop. `OpImageQuerySizeLod` instead, a 2D image, or the query moved out of the loop all build. - In all four crashing shaders, every 3D-image query sits inside a loop. In 25 compute shaders that build fine, none does. ### Change `descriptor_data` extracts the level count only when some instruction or phi reads word 3's register as data, not as the resource operand of a memory instruction, which takes the descriptor whole. Otherwise the level count is not queried; word 3's value is then unused. Programs that do read word 3 are unchanged. ### Testing - RTX 5080, driver 615.71.09, CachyOS, proton-cachyos 11.0 (20260703), Series X 1.0.2.1, release build cross-compiled from Linux. - `victory translate <dir> --pipelines` on the four shaders: all crashed before, all create their pipeline after. - In game: all four now create their host pipelines and loading continues past the point where it crashed before. - `cargo test -p victory-shader` passes. - Not tested on Windows or on AMD; the change only skips a query whose result was unused. ### What else this was run with These are separate, and this PR does not include them: - #177: fixes the invalid float-handle atomics (`5d113aa6830760b6` and the pixel shaders that crashed in `vkCreateGraphicsPipelines`). - #151: 16 MiB default thread stack. It removed stack overflows I saw, but not these crashes. - vkd3d-proton 3.2.0 (`d3d12.dll`, `d3d12core.dll` from Proton Experimental 11.0-20261112) next to `victory.exe`. Older vkd3d-proton builds crash on other shaders (`8bb272e763f76148`, `4e296b1885c37b29`, `6a62009bc6a4146e`); see #144. Related: #144. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
MisaXz commented 2026-11-24 06:55:07 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by MisaXz on 2026-11-24T02:08:55Z.


Test report on Windows, which the description lists as not tested.

Tested

  • NVIDIA GeForce RTX 5080, driver 621.14; Ryzen 7 9800X3D; Windows 11 Pro 26300 (native D3D12, no Wine); Rust 1.98.1; debug
  • This PR at e232d3d (base d2a4bae): cargo test --workspace --no-fail-fast: 264 passed, 0 failed, 4 ignored. Same counts as main d2a4bae on this machine.

Not tested

  • The title itself (no game files used), so not the world load this fixes under vkd3d-proton; this only shows the suite is unchanged on native Windows.
  • The GPU diff tests skip here (no VICTORY_CONSOLE_DXC). Release build, AMD.

AI use

  • Claude Code (Claude Fable 5.2) ran the tests and wrote this report from their output.
<!-- greyfinch-sync:Marvisak/VIctory:comment:7119803607 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/259#issuecomment-7119803607). Originally posted by [MisaXz](https://github.com/MisaXz) on 2026-11-24T02:08:55Z. --- Test report on Windows, which the description lists as not tested. **Tested** - NVIDIA GeForce RTX 5080, driver 621.14; Ryzen 7 9800X3D; Windows 11 Pro 26300 (native D3D12, no Wine); Rust 1.98.1; debug - This PR at `e232d3d` (base `d2a4bae`): `cargo test --workspace --no-fail-fast`: 264 passed, 0 failed, 4 ignored. Same counts as `main` `d2a4bae` on this machine. **Not tested** - The title itself (no game files used), so not the world load this fixes under vkd3d-proton; this only shows the suite is unchanged on native Windows. - The GPU diff tests skip here (no `VICTORY_CONSOLE_DXC`). Release build, AMD. **AI use** - Claude Code (Claude Fable 5.2) ran the tests and wrote this report from their output.
mercuryVM commented 2026-11-24 08:08:21 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by mercuryVM on 2026-11-24T08:08:21Z.

Review: APPROVED


Tested e232d3d on Windows 11, RTX 5070, MSVC: cargo test --workspace --no-fail-fast passes (264 passed, 0 failed). victory translate <title exe> --validate --pipelines gives the same counts before and after: 12 of 12 programs emitted, 12 validated, 12 pipelines. Not tested under Wine or vkd3d-proton.

  • The rebuilt word 3 is only observable when some SGPR written by this load at descriptor word 3 is read as data. When nothing reads it, putting one there instead of querying the level count can't change any result, and it removes the getDimensions level query that vkd3d-proton turns into OpImageQueryLevels.
  • read_as_data errs the safe way. A phi use counts as a data read, so a word that flows through a loop still gets the real level count, and only direct resource operands of image, buffer and SMEM instructions are exempt. The worst case is the old behaviour.
  • The reduction story (3D image, query inside a loop, and OpImageQueryLevels all needed for the crash) is well isolated. This narrows the trigger without changing the semantics of shaders that do read word 3. Those can still hit the driver bug, which is outside our control.

No issues found.

AI-assisted (Claude Code).

<!-- greyfinch-sync:Marvisak/VIctory:review:6035682642 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/259#pullrequestreview-6035682642). Originally posted by [mercuryVM](https://github.com/mercuryVM) on 2026-11-24T08:08:21Z. **Review:** APPROVED --- Tested e232d3d on Windows 11, RTX 5070, MSVC: `cargo test --workspace --no-fail-fast` passes (264 passed, 0 failed). `victory translate <title exe> --validate --pipelines` gives the same counts before and after: 12 of 12 programs emitted, 12 validated, 12 pipelines. Not tested under Wine or vkd3d-proton. - The rebuilt word 3 is only observable when some SGPR written by this load at descriptor word 3 is read as data. When nothing reads it, putting `one` there instead of querying the level count can't change any result, and it removes the `getDimensions` level query that vkd3d-proton turns into `OpImageQueryLevels`. - `read_as_data` errs the safe way. A phi use counts as a data read, so a word that flows through a loop still gets the real level count, and only direct resource operands of image, buffer and SMEM instructions are exempt. The worst case is the old behaviour. - The reduction story (3D image, query inside a loop, and `OpImageQueryLevels` all needed for the crash) is well isolated. This narrows the trigger without changing the semantics of shaders that do read word 3. Those can still hit the driver bug, which is outside our control. No issues found. AI-assisted (Claude Code).
Mumogg commented 2026-11-24 12:04:40 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by Mumogg on 2026-11-24T11:51:00Z.


Test report on NVIDIA 615.78.08, where #177 alone did not get past the compile crash (my rows in #144).

Setup: RTX 5070 Ti, driver 615.78.08, Nobara 44 (kernel 7.3.4), Wine 11.21 Staging, vkd3d-proton and DXVK dxgi.dll from GE-Proton11-14, diag build cross-compiled on Linux. Tree: ffe310e + #454 (d2c93fa) + #177 (ce945d6), then the same with this PR (e232d3d) merged on top; it merges cleanly there. Series X 1.0.2.1, network off. VKD3D_DISABLE_EXTENSIONS=VK_NV_raw_access_chains, VICTORY_NO_WATCHDOG=1.

Offline: victory translate shaders.rpf --pipelines --jobs 1 (with a local print of each shader before its pipeline, to name the one the driver dies on)

without this PR with this PR
d1dd30f425ea54d4 75aa1158d1443760 b80cd30e37e3fa05 29dc558346584906 9c15f00bc28065f6 dafaedf3b3cf3c09 ab8bd5a9904baf76 20ab5ea44cad8dca 7398df71d31fc190 each one ends the process: vkCreateComputePipelines Exception 0xc0000005 in Unix call 9 of 9: pipeline created

Those nine are the ones I found before stopping the search (one per pass, skipping the previous ones), so there may be more on this driver; b80cd30e37e3fa05 is also in your list.

The same cause, checked independently. For d1dd30f425ea54d4: the SPIR-V from VKD3D_SHADER_DUMP_PATH passes spirv-val, and a small native Vulkan program (no Wine) that creates a compute pipeline from it segfaults in libnvidia-gpucomp.so.615.78.08. spirv-reduce against that crash left 119 lines with one instruction of substance: OpImageQueryLevels on a 3D image in a loop header, faulting at the same address in the driver as the full shader. (My reducer run replaced the image operand by an OpUndef, so by itself it is weaker evidence than yours; it agrees with it.)

In the title, one run each:

without this PR with this PR
end vkCreateComputePipelines Exception 0xc0000005 at frame 1425, about 64 s in no driver exception; last new pipeline bound at frame 1542
host pipelines created 57 372
then – Xid 109 … CTX SWITCH TIMEOUT from title-main in the kernel log; the process ended (exit 137) 158 s in

So on this driver the PR removes the compile crash, and the run then reaches the Xid 109 stop that #71 and #144 describe on 620.73.04. With this PR, 76 compute pipelines were refused with Invalid parameter (0x80070057) in that run; I have not looked into those.

Not tested: Windows, AMD, cargo test (I only built and ran), more than one title run per tree.

AI-assisted (Claude Code): it built the trees, ran the tests and wrote this report from the logs. No game data attached.

<!-- greyfinch-sync:Marvisak/VIctory:comment:7130631673 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/259#issuecomment-7130631673). Originally posted by [Mumogg](https://github.com/Mumogg) on 2026-11-24T11:51:00Z. --- Test report on NVIDIA **615.78.08**, where #177 alone did not get past the compile crash (my rows in #144). **Setup:** RTX 5070 Ti, driver 615.78.08, Nobara 44 (kernel 7.3.4), Wine 11.21 Staging, vkd3d-proton and DXVK `dxgi.dll` from GE-Proton11-14, diag build cross-compiled on Linux. Tree: `ffe310e` + #454 (`d2c93fa`) + #177 (`ce945d6`), then the same with this PR (`e232d3d`) merged on top; it merges cleanly there. Series X 1.0.2.1, network off. `VKD3D_DISABLE_EXTENSIONS=VK_NV_raw_access_chains`, `VICTORY_NO_WATCHDOG=1`. **Offline: `victory translate shaders.rpf --pipelines --jobs 1`** (with a local print of each shader before its pipeline, to name the one the driver dies on) | | without this PR | with this PR | |---|---|---| | `d1dd30f425ea54d4` `75aa1158d1443760` `b80cd30e37e3fa05` `29dc558346584906` `9c15f00bc28065f6` `dafaedf3b3cf3c09` `ab8bd5a9904baf76` `20ab5ea44cad8dca` `7398df71d31fc190` | each one ends the process: `vkCreateComputePipelines Exception 0xc0000005 in Unix call` | 9 of 9: pipeline created | Those nine are the ones I found before stopping the search (one per pass, skipping the previous ones), so there may be more on this driver; `b80cd30e37e3fa05` is also in your list. **The same cause, checked independently.** For `d1dd30f425ea54d4`: the SPIR-V from `VKD3D_SHADER_DUMP_PATH` passes `spirv-val`, and a small native Vulkan program (no Wine) that creates a compute pipeline from it segfaults in `libnvidia-gpucomp.so.615.78.08`. `spirv-reduce` against that crash left 119 lines with one instruction of substance: `OpImageQueryLevels` on a 3D image in a loop header, faulting at the same address in the driver as the full shader. (My reducer run replaced the image operand by an `OpUndef`, so by itself it is weaker evidence than yours; it agrees with it.) **In the title, one run each:** | | without this PR | with this PR | |---|---|---| | end | `vkCreateComputePipelines Exception 0xc0000005` at frame 1425, about 64 s in | no driver exception; last new pipeline bound at frame 1542 | | host pipelines created | 57 | 372 | | then | – | `Xid 109 … CTX SWITCH TIMEOUT` from `title-main` in the kernel log; the process ended (exit 137) 158 s in | So on this driver the PR removes the compile crash, and the run then reaches the Xid 109 stop that #71 and #144 describe on 620.73.04. With this PR, 76 compute pipelines were refused with `Invalid parameter (0x80070057)` in that run; I have not looked into those. **Not tested:** Windows, AMD, `cargo test` (I only built and ran), more than one title run per tree. AI-assisted (Claude Code): it built the trees, ran the tests and wrote this report from the logs. No game data attached.
hh-ze commented 2026-11-24 16:05:20 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by hh-ze on 2026-11-24T15:41:41Z.


Verified #259 on an RTX 5060 Ti with NVIDIA driver 595.99.02. All five compute pipelines that had crashed during my testing compiled after applying this PR. Story Mode also created all five in-game with VICTORY_SKIP_PIPELINES unset and reached the “Vice City, two years ago” title card.

Setup

  • Ubuntu 24.04.5 LTS, kernel 7.0.0-43-generic, Ryzen 5 7600
  • GE-Proton 11-13, Wine 11.0 (Staging), vkd3d-proton 3.2.0 build cae8353ed7959c4
  • VIctory ffe310e with #177, the #439 Wave64 stack, and #190. Cherry-picked #259 at e232d3d as local commit 40d3abd.
  • Rust 1.98.1, cross-built for x86_64-pc-windows-gnu with the diag profile, diagnostics enabled, and a 16 MiB thread stack
  • Series X 1.0.2.1, with VKD3D_DISABLE_EXTENSIONS=VK_NV_raw_access_chains

Results for #259

All five passed a compile-only victory translate --pipelines --jobs 1 --list run and subsequently logged successful host pipeline creation in Story Mode:

8b9483919d8d5e99  CS_CloudMultiScatteringCache
9938c251a313fe28
a3d1a26ad0c8c2cd
ede59e0c382bd4d9  CS_Gather_Classified_30
ef05293f6107fc99

ede59e0c382bd4d9 reproduced vkCreateComputePipelines Exception 0xc0000005 on its own before the patch. With #259, its generated SPIR-V went from 46 OpImageQueryLevels instructions to zero. All five patched modules passed spirv-val for Vulkan 1.3. The native victory-shader suite reported 100 passed and 1 ignored.

Other PRs I tested

PR Result on this setup
#177 Fixed all 39 invalid atomic-result modules in my offline SPIR-V comparison. The NVIDIA compiler exception still occurred in later runs.
#189 and an earlier #233-only build My local trials still left the seven Wave64 cases I was tracking without host pipelines.
#439 stack Created all nine pipelines in that test batch, up from two on the earlier build. All four synthetic Wave64 GPU tests passed.
#190 Fixed Wine’s indirect-argument clamp compilation failure. Pipeline creation and both GPU readback tests passed. Story Mode still hit the separate compute-pipeline exception before #259.
#680, #336, and #566 Already present in the base. The texture-upload, descriptor-slot, and five per-lane shader tests passed.

The world was still running at roughly 0.1–0.3 fps, with buffer copies taking several seconds per frame. During teardown, the log printed free(): corrupted unsorted chunks after the nested display connection closed. The desktop and GPU stayed responsive, and the kernel logged no NVIDIA Xid during the run. Playable gameplay remains unverified.

AI-assisted testing and log analysis. Shader hashes and test results only.

<!-- greyfinch-sync:Marvisak/VIctory:comment:7136455413 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/259#issuecomment-7136455413). Originally posted by [hh-ze](https://github.com/hh-ze) on 2026-11-24T15:41:41Z. --- Verified #259 on an **RTX 5060 Ti with NVIDIA driver 595.99.02**. All five compute pipelines that had crashed during my testing compiled after applying this PR. Story Mode also created all five in-game with `VICTORY_SKIP_PIPELINES` unset and reached the **“Vice City, two years ago”** title card. ### Setup - Ubuntu 24.04.5 LTS, kernel `7.0.0-43-generic`, Ryzen 5 7600 - GE-Proton 11-13, Wine `11.0 (Staging)`, vkd3d-proton 3.2.0 build `cae8353ed7959c4` - VIctory `ffe310e` with #177, the #439 Wave64 stack, and #190. Cherry-picked #259 at `e232d3d` as local commit `40d3abd`. - Rust `1.98.1`, cross-built for `x86_64-pc-windows-gnu` with the `diag` profile, diagnostics enabled, and a 16 MiB thread stack - Series X `1.0.2.1`, with `VKD3D_DISABLE_EXTENSIONS=VK_NV_raw_access_chains` ### Results for #259 All five passed a compile-only `victory translate --pipelines --jobs 1 --list` run and subsequently logged successful host pipeline creation in Story Mode: ```text 8b9483919d8d5e99 CS_CloudMultiScatteringCache 9938c251a313fe28 a3d1a26ad0c8c2cd ede59e0c382bd4d9 CS_Gather_Classified_30 ef05293f6107fc99 ``` `ede59e0c382bd4d9` reproduced `vkCreateComputePipelines Exception 0xc0000005` on its own before the patch. With #259, its generated SPIR-V went from **46 `OpImageQueryLevels` instructions to zero**. All five patched modules passed `spirv-val` for Vulkan 1.3. The native `victory-shader` suite reported 100 passed and 1 ignored. ### Other PRs I tested | PR | Result on this setup | | --- | --- | | #177 | Fixed all 39 invalid atomic-result modules in my offline SPIR-V comparison. The NVIDIA compiler exception still occurred in later runs. | | #189 and an earlier #233-only build | My local trials still left the seven Wave64 cases I was tracking without host pipelines. | | #439 stack | Created all nine pipelines in that test batch, up from two on the earlier build. All four synthetic Wave64 GPU tests passed. | | #190 | Fixed Wine’s indirect-argument clamp compilation failure. Pipeline creation and both GPU readback tests passed. Story Mode still hit the separate compute-pipeline exception before #259. | | #680, #336, and #566 | Already present in the base. The texture-upload, descriptor-slot, and five per-lane shader tests passed. | The world was still running at roughly **0.1–0.3 fps**, with buffer copies taking several seconds per frame. During teardown, the log printed `free(): corrupted unsorted chunks` after the nested display connection closed. The desktop and GPU stayed responsive, and the kernel logged no NVIDIA Xid during the run. Playable gameplay remains unverified. AI-assisted testing and log analysis. Shader hashes and test results only.
Yaekai commented 2026-11-24 17:04:37 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by Yaekai on 2026-11-24T16:37:55Z.


Independent verification on Windows 11 + NVIDIA RTX 3070 (Rust 1.98.1) at head e232d3d:

  • cargo test -p victory-shader --lib -- --skip valu_tests --skip waterfall_tests: 62 passed, 0 failed.
  • cargo clippy -p victory-shader -- -D warnings: 0 warnings.
  • Live GTA VI (1.0.2.1, --console series-s, 19-min world run): no regressions. Ready to merge once rebased on main!
<!-- greyfinch-sync:Marvisak/VIctory:comment:7137967055 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/259#issuecomment-7137967055). Originally posted by [Yaekai](https://github.com/Yaekai) on 2026-11-24T16:37:55Z. --- Independent verification on Windows 11 + NVIDIA RTX 3070 (Rust 1.98.1) at head `e232d3d`: - `cargo test -p victory-shader --lib -- --skip valu_tests --skip waterfall_tests`: 62 passed, 0 failed. - `cargo clippy -p victory-shader -- -D warnings`: 0 warnings. - Live GTA VI (`1.0.2.1`, `--console series-s`, 19-min world run): no regressions. Ready to merge once rebased on `main`!
Marvisak commented 2026-11-25 01:07:44 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by Marvisak on 2026-11-25T00:24:10Z.


Automated triage for the maintainers.

Merge candidate. In Lower::descriptor_data (crates/victory-shader/src/emit/lower.rs), an image descriptor rebuilt from getDimensions now extracts the level count (field 3) only when the program reads word 3's register as data, through the new Lower::read_as_data. Phis count as data reads; image, buffer and scalar-memory operands, which take the whole descriptor, do not. Otherwise word 3 is built with one level. I checked that levels feeds only d3, so when no instruction or phi reads word 3 the generated value is never used, and programs that do read it are unchanged. The evidence for the driver crash is concrete (a spirv-reduce reduction to OpImageQueryLevels on a 3D image in a loop, reproduced natively and on several driver versions in the comments). The merge commit keeps main's new scalar-load functions unchanged.

Thanks for the merge with main. It now merges cleanly against 940d32f, and the conflict resolution in lower.rs keeps both sides as you describe.

CI: passing (check).


Generated by Claude Code

<!-- greyfinch-sync:Marvisak/VIctory:comment:7148472009 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/259#issuecomment-7148472009). Originally posted by [Marvisak](https://github.com/Marvisak) on 2026-11-25T00:24:10Z. --- <!-- victory-triage v1 head=31a61376488bacc037b3bbf881ba4104114fdeb4 verdict=merge-candidate at=2026-11-25T06:23:04Z --> Automated triage for the maintainers. **Merge candidate.** In `Lower::descriptor_data` (`crates/victory-shader/src/emit/lower.rs`), an image descriptor rebuilt from `getDimensions` now extracts the level count (field 3) only when the program reads word 3's register as data, through the new `Lower::read_as_data`. Phis count as data reads; image, buffer and scalar-memory operands, which take the whole descriptor, do not. Otherwise word 3 is built with one level. I checked that `levels` feeds only `d3`, so when no instruction or phi reads word 3 the generated value is never used, and programs that do read it are unchanged. The evidence for the driver crash is concrete (a `spirv-reduce` reduction to `OpImageQueryLevels` on a 3D image in a loop, reproduced natively and on several driver versions in the comments). The merge commit keeps main's new scalar-load functions unchanged. Thanks for the merge with main. It now merges cleanly against `940d32f`, and the conflict resolution in `lower.rs` keeps both sides as you describe. CI: passing (`check`). --- _Generated by [Claude Code](https://claude.ai/code)_
desplmfao commented 2026-11-25 05:06:17 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by desplmfao on 2026-11-25T04:22:18Z.


Rebased for the triage's "needs rebase": 31a6137 merges current main (940d32f) into the branch as a new commit, so the history above stays as it was. The only conflict was in emit/lower.rs, where main added new scalar-load functions (user_data_smem, memory_smem, add64 and others) next to this PR's read_as_data. Both are kept unchanged. GitHub shows the PR as mergeable again.

Checked on an RTX 5080 (Linux, proton-cachyos 11.0, vkd3d-proton 3.2.0), victory-shader tests with --test-threads 1: 241 passed, 6 failed. Plain main gives exactly the same result, with the same six tests failing, so the merge adds no failures. The six are NVIDIA/Wine issues covered elsewhere (#2037, #1994, #1777/#1779), or they only happen under Wine.

<!-- greyfinch-sync:Marvisak/VIctory:comment:7152781371 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/259#issuecomment-7152781371). Originally posted by [desplmfao](https://github.com/desplmfao) on 2026-11-25T04:22:18Z. --- Rebased for the triage's "needs rebase": `31a6137` merges current `main` (`940d32f`) into the branch as a new commit, so the history above stays as it was. The only conflict was in `emit/lower.rs`, where `main` added new scalar-load functions (`user_data_smem`, `memory_smem`, `add64` and others) next to this PR's `read_as_data`. Both are kept unchanged. GitHub shows the PR as mergeable again. Checked on an RTX 5080 (Linux, proton-cachyos 11.0, vkd3d-proton 3.2.0), `victory-shader` tests with `--test-threads 1`: 241 passed, 6 failed. Plain `main` gives exactly the same result, with the same six tests failing, so the merge adds no failures. The six are NVIDIA/Wine issues covered elsewhere (#2037, #1994, #1777/#1779), or they only happen under Wine.
upstream-sync closed this pull request 2026-11-25 22:02:37 +00:00
Marvisak commented 2026-11-25 22:04:39 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by Marvisak on 2026-11-25T21:58:30Z.


Automated triage for the maintainers, second look (a review against current main, with builds and tests where they could change the verdict).

Closing because main already does this in a more general form. Since 286a00e9 the DXIL writer leaves out everything no live instruction reads, so when nothing reads descriptor word 3 the level-count extract and the arithmetic built on it are not emitted at all. That also covers cases this change would still query (a word carried through a phi, a dead read). The test reports here predate that commit; if the crash still shows on current main, please open an issue with the shader hash.

If this is mistaken, reply here with what was missed and it will be looked at again. Thank you for the contribution.

<!-- greyfinch-sync:Marvisak/VIctory:comment:7175776955 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/259#issuecomment-7175776955). Originally posted by [Marvisak](https://github.com/Marvisak) on 2026-11-25T21:58:30Z. --- Automated triage for the maintainers, second look (a review against current `main`, with builds and tests where they could change the verdict). Closing because `main` already does this in a more general form. Since 286a00e9 the DXIL writer leaves out everything no live instruction reads, so when nothing reads descriptor word 3 the level-count extract and the arithmetic built on it are not emitted at all. That also covers cases this change would still query (a word carried through a phi, a dead read). The test reports here predate that commit; if the crash still shows on current `main`, please open an issue with the shader hash. If this is mistaken, reply here with what was missed and it will be looked at again. Thank you for the contribution.

Pull request closed

Sign in to join this conversation.
No reviewers
No labels
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Reference
Marvisak/VIctory!259
No description provided.