fix(shader): emit the fault record function without DontInline #7942

Closed
erm14254 wants to merge 1 commit from upstream-pr/7942 into main
erm14254 commented 2026-10-19 15:16:23 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by erm14254 on 2026-10-19T15:16:23Z.


What

NVIDIA driver 597.16 (RTX PRO 6000 Blackwell, Windows) crashes in its compiler at nvgpucomp64.dll+0x28072a1 while creating a compute pipeline of Code Violet. spirv-reduce, kept to that crash offset, leaves a selection steered by a ballot whose one arm calls record_bda_fault, a DontInline function, and whose other arm holds another ballot. The reduced module and the full one compile once the function is declared without the control or with Inline, so the function is emitted without DontInline and the driver inlines or calls it as it sees fit. The other DontInline helpers keep the control. The debt entry in docs/dev/debt/shader.md and the NVIDIA note in docs/user/USAGE.md record the finding; the test in agc_shader_memory now expects the fault function without the control.

Tested

On main 00d7e611e, where record_bda_fault is still declared DontInline: Windows 11 (10.0.22631), RTX PRO 6000 Blackwell Workstation Edition, NVIDIA 597.16: agc_shader_memory, agc_driver_bda_device, agc_driver_bda_span_reads, agc_driver_guarded_null_pointer, agc_driver_image_table, agc_device_fault and agc_formatted_buffer_once pass.

Before the rebase, on d92a8dad3 with the same GPU and driver, the reduced module and the full compute module compile through agc_compute_pipeline_replay with this, and Code Violet (PPSA26528) no longer stops in nvgpucomp64.dll; on Linux, lavapipe, the same seven tests pass. Plain main 0615cd2b8 still stopped at nvgpucomp64.dll+0x28072a1 on 2026-10-16 (#6257). The title has not been run on the rebased branch yet; I'll add that result in a comment.

The reduced SPIR-V module is attached below.

pr4-reduced-module.zip

Checklist

  • Based on current main; no other open PR implements the same functions
  • One topic per PR; follow-ups go in a new PR
  • No comments in code except technical debt
  • Unimplemented paths throw (NotImplemented_nid_no_patch); silent stubs are listed under Silent stubs in their library's technical debt file
  • No notes, investigation .md files or images added to the repository (attach them to this PR)
  • New third-party code is a submodule built from source
  • Generic behaviour, not specific to one title
  • Depends on: none
  • Unblocks: PPSA26528 #6256
  • GPUs tested: NVIDIA RTX PRO 6000 Blackwell Workstation Edition, driver 597.16, Windows 11; lavapipe on Linux
  • AI-assisted: yes

🤖 Generated with Claude Code

<!-- greyfinch-sync:boykopovar/AnyPS5:issue:4923219245 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/7942). Originally posted by [erm14254](https://github.com/erm14254) on 2026-10-19T15:16:23Z. --- ### What NVIDIA driver 597.16 (RTX PRO 6000 Blackwell, Windows) crashes in its compiler at `nvgpucomp64.dll+0x28072a1` while creating a compute pipeline of Code Violet. spirv-reduce, kept to that crash offset, leaves a selection steered by a ballot whose one arm calls `record_bda_fault`, a `DontInline` function, and whose other arm holds another ballot. The reduced module and the full one compile once the function is declared without the control or with `Inline`, so the function is emitted without `DontInline` and the driver inlines or calls it as it sees fit. The other `DontInline` helpers keep the control. The debt entry in `docs/dev/debt/shader.md` and the NVIDIA note in `docs/user/USAGE.md` record the finding; the test in `agc_shader_memory` now expects the fault function without the control. ### Tested On `main` 00d7e611e, where `record_bda_fault` is still declared `DontInline`: Windows 11 (10.0.22631), RTX PRO 6000 Blackwell Workstation Edition, NVIDIA 597.16: `agc_shader_memory`, `agc_driver_bda_device`, `agc_driver_bda_span_reads`, `agc_driver_guarded_null_pointer`, `agc_driver_image_table`, `agc_device_fault` and `agc_formatted_buffer_once` pass. Before the rebase, on d92a8dad3 with the same GPU and driver, the reduced module and the full compute module compile through `agc_compute_pipeline_replay` with this, and Code Violet (PPSA26528) no longer stops in `nvgpucomp64.dll`; on Linux, lavapipe, the same seven tests pass. Plain `main` 0615cd2b8 still stopped at `nvgpucomp64.dll+0x28072a1` on 2026-10-16 (#6257). The title has not been run on the rebased branch yet; I'll add that result in a comment. The reduced SPIR-V module is attached below. [pr4-reduced-module.zip](https://github.com/user-attachments/files/33673100/pr4-reduced-module.zip) ### Checklist <!-- Rules behind each item: https://github.com/boykopovar/AnyPS5/blob/main/CONTRIBUTING.md --> - [x] Based on current `main`; no other open PR implements the same functions - [x] One topic per PR; follow-ups go in a new PR - [x] No comments in code except [technical debt](https://github.com/boykopovar/AnyPS5/blob/main/docs/dev/CONVENTIONS.md) - [x] Unimplemented paths throw (`NotImplemented_nid_no_patch`); silent stubs are listed under Silent stubs in their library's [technical debt](https://github.com/boykopovar/AnyPS5/tree/main/docs/dev/debt) file - [x] No notes, investigation `.md` files or images added to the repository (attach them to this PR) - [x] New third-party code is a submodule built from source - [x] Generic behaviour, not specific to one title - [x] Depends on: none - [x] Unblocks: PPSA26528 #6256 - [x] GPUs tested: NVIDIA RTX PRO 6000 Blackwell Workstation Edition, driver 597.16, Windows 11; lavapipe on Linux - [x] AI-assisted: yes 🤖 Generated with [Claude Code](https://claude.com/claude-code)
erm14254 commented 2026-10-19 15:52:45 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by erm14254 on 2026-10-19T15:52:45Z.


Manual overlap review for the list above, against each pull request's current head. None of them changes the lines this PR changes.

No overlap, no Depends on.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6271353953 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/7942#issuecomment-6271353953). Originally posted by [erm14254](https://github.com/erm14254) on 2026-10-19T15:52:45Z. --- Manual overlap review for the list above, against each pull request's current head. None of them changes the lines this PR changes. - Applied to `main`, the shared-file changes of #1341, #5021, #6171, #6612, #6645, #6679, #6788, #6946, #6947, #6977, #7332, #7395, #7417, #7484, #7800 and #7922 merge cleanly with this PR. - #5371, #6235, #6924, #7392 and #7642 merge cleanly in some shared files and conflict with `main` in the others; #5426, #5500, #5925, #5941, #6009, #6177, #6280, #6290, #6604, #6683, #7085 and #7223 conflict with `main` in all of them. Where a PR conflicts with `main`, its hunks still neither change nor border this PR's lines. - #7392 is the only one in `SpirvBdaFault.cpp`: it adds the faulted-flag helpers after `ReturnBdaFailureIf` and a branch in `StopBdaInvocationIf`, about 70 lines below the `record_bda_fault` declaration this PR changes, and leaves that declaration alone. No overlap, no `Depends on`.
DavidAmsellem commented 2026-10-19 18:23:59 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by DavidAmsellem on 2026-10-19T18:23:59Z.


First AMD-on-Linux (RADV) run of this PR. Merged onto main 8d5d4df96 (clean merge), built in full and compared with the same main, on the same machine.

AMD Radeon RX 7900 XT (RADV NAVI31, gfx1100), Mesa 25.2.8, Linux Mint 22.3 (Ubuntu 24.04 base), kernel 7.0.0-38, GCC 13.3, Release.

Full suite (ANYPS5_REQUIRE_VULKAN=1 ctest -j8) at 6474695df: 1638/1640 with this PR, against 1638/1640 on main. The two failures are the same on both, so this PR adds none: agc_driver_image_table_vouched_lookups (#7766, fixed by #7916) and agc_driver_guest_memory_lifetime (#7784).

Comparing the JUnit output with main: this PR adds no ctest entry, and none is skipped or removed.

This checks correctness only; I did not measure performance.

GPUs tested: AMD Radeon RX 7900 XT (RADV NAVI31, gfx1100), Mesa 25.2.8, Linux Mint 22.3 / kernel 7.0.0-38

AI-assisted: yes

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6274237307 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/7942#issuecomment-6274237307). Originally posted by [DavidAmsellem](https://github.com/DavidAmsellem) on 2026-10-19T18:23:59Z. --- First AMD-on-Linux (RADV) run of this PR. Merged onto `main` `8d5d4df96` (clean merge), built in full and compared with the same `main`, on the same machine. AMD Radeon RX 7900 XT (RADV NAVI31, gfx1100), Mesa 25.2.8, Linux Mint 22.3 (Ubuntu 24.04 base), kernel 7.0.0-38, GCC 13.3, Release. Full suite (`ANYPS5_REQUIRE_VULKAN=1 ctest -j8`) at `6474695df`: **1638/1640 with this PR**, against 1638/1640 on `main`. The two failures are the same on both, so this PR adds none: `agc_driver_image_table_vouched_lookups` (#7766, fixed by #7916) and `agc_driver_guest_memory_lifetime` (#7784). Comparing the JUnit output with `main`: this PR adds no ctest entry, and none is skipped or removed. This checks correctness only; I did not measure performance. GPUs tested: AMD Radeon RX 7900 XT (RADV NAVI31, gfx1100), Mesa 25.2.8, Linux Mint 22.3 / kernel 7.0.0-38 AI-assisted: yes
oneandonlydean commented 2026-10-20 22:08:17 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by oneandonlydean on 2026-10-20T22:08:17Z.


@erm14254 DontInline on record_bda_fault came from f7d4fbab9 (#1043) as a pipeline-creation fix: with the fault recording copied into every read site, one compute program reached about a million SPIR-V words and ~95 s in vkCreateComputePipelines (PPSA26344's ~835k-word variants took 45 s each). Without the hint the module stays small, but any driver may now inline the function at every call site, which is the cost that change was avoiding. The change also applies to every driver, not only 597.16. Could you add the vkCreateComputePipelines time of a large BDA program before and after (for example through agc_compute_pipeline_replay) on NVIDIA and on AMD, or limit the change to the driver that crashes, as the other driver workarounds do?

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6302871519 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/7942#issuecomment-6302871519). Originally posted by [oneandonlydean](https://github.com/oneandonlydean) on 2026-10-20T22:08:17Z. --- @erm14254 `DontInline` on `record_bda_fault` came from f7d4fbab9 (#1043) as a pipeline-creation fix: with the fault recording copied into every read site, one compute program reached about a million SPIR-V words and ~95 s in `vkCreateComputePipelines` (PPSA26344's ~835k-word variants took 45 s each). Without the hint the module stays small, but any driver may now inline the function at every call site, which is the cost that change was avoiding. The change also applies to every driver, not only 597.16. Could you add the `vkCreateComputePipelines` time of a large BDA program before and after (for example through `agc_compute_pipeline_replay`) on NVIDIA and on AMD, or limit the change to the driver that crashes, as the other driver workarounds do?

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
boykopovar/AnyPS5!7942
No description provided.