fix(shaders,gpu): skip 191ecaed66eea3b1 replacement on NVIDIA 616.x to avoid compiler OOM (#249) #452

Manually merged
github merged 1 commit from github-bot/gh-452 into gh-pr/452/base 2026-12-06 01:38:56 +00:00 AGit
Owner

@⁠ZerefDragnee1l on GitHub · 2026-12-06 01:01 UTC · original
ZerefDragnee1l:fix/nvidia-616-shadow-shader-oom → main · +51 −0 · 2 files · 1 commits · merged 2026-12-06 01:05 UTC

Fixes #249 (NVIDIA 616.56 / 616.64 driver compiler OOM on 191ecaed66eea3b1 CS_ShadowRenderTiledCascades).

Root Cause

Compiling replacement shader 191ecaed66eea3b1.compute.hlsl with DXC -O3 produces a flat 2,425-block / 5,182-PHI SSA DAG in main(), triggering pathological memory growth (40–139 GB private commit / 0x8007000E / system reboots) inside NVIDIA driver 616.56 / 616.64 (ptxas), while drivers 621.47+, older drivers, Wine/vkd3d-proton, and AMD GPUs are unaffected.

Rather than forcing unoptimized -Od DXIL onto all GPUs and drivers (as an alternative to or complement for #421), this guards 191ecaed66eea3b1 specifically on affected Windows NVIDIA driver versions at runtime and cleanly falls back to the already-working translated shader (confirmed in #249 to complete startup at normal memory usage).

Changes

  • crates/larp-gpu/src/host.rs: Added Host::nvidia_driver_version(&self) -> Option<u32> using IDXGIAdapter::CheckInterfaceSupport(&IDXGIDevice::IID) on native Windows NVIDIA adapters (VendorId == 0x10de && !on_wine()), decoding (c % 10) * 10_000 + d (e.g., 61656 for 616.56, 61664 for 616.64).
  • crates/larp-gpu/src/shader_replace.rs: In apply(), skips compute replacement 191ecaed66eea3b1 when nvidia_driver_version() falls in 616.00..621.00, logging a warning and falling back to the translated shader (overrideable via LARP_NVIDIA_SHADOW_REPLACE=1 or 0). Unaffected drivers and AMD/Linux continue using -O3 DXIL with zero GPU cost penalty, and existing PSO caches automatically key on translated vs replacement DXIL.

Verification

  • Ran cargo check -p larp on this branch (exited 0, 0 errors, 0 warnings in modified files).
**@⁠ZerefDragnee1l** on GitHub · 2026-12-06 01:01 UTC · [original](https://github.com/gamingwithhomie/larp/pull/452) `ZerefDragnee1l:fix/nvidia-616-shadow-shader-oom` → `main` · +51 −0 · 2 files · 1 commits · merged 2026-12-06 01:05 UTC Fixes #249 (NVIDIA 616.56 / 616.64 driver compiler OOM on `191ecaed66eea3b1` `CS_ShadowRenderTiledCascades`). ## Root Cause Compiling replacement shader `191ecaed66eea3b1.compute.hlsl` with DXC `-O3` produces a flat 2,425-block / 5,182-PHI SSA DAG in `main()`, triggering pathological memory growth (40–139 GB private commit / `0x8007000E` / system reboots) inside NVIDIA driver `616.56` / `616.64` (`ptxas`), while drivers `621.47+`, older drivers, Wine/vkd3d-proton, and AMD GPUs are unaffected. Rather than forcing unoptimized `-Od` DXIL onto all GPUs and drivers (as an alternative to or complement for #421), this guards `191ecaed66eea3b1` specifically on affected Windows NVIDIA driver versions at runtime and cleanly falls back to the already-working translated shader (confirmed in #249 to complete startup at normal memory usage). ## Changes - **`crates/larp-gpu/src/host.rs`:** Added `Host::nvidia_driver_version(&self) -> Option<u32>` using `IDXGIAdapter::CheckInterfaceSupport(&IDXGIDevice::IID)` on native Windows NVIDIA adapters (`VendorId == 0x10de && !on_wine()`), decoding `(c % 10) * 10_000 + d` (e.g., `61656` for `616.56`, `61664` for `616.64`). - **`crates/larp-gpu/src/shader_replace.rs`:** In `apply()`, skips `compute` replacement `191ecaed66eea3b1` when `nvidia_driver_version()` falls in `616.00..621.00`, logging a warning and falling back to the translated shader (overrideable via `LARP_NVIDIA_SHADOW_REPLACE=1` or `0`). Unaffected drivers and AMD/Linux continue using `-O3` DXIL with zero GPU cost penalty, and existing PSO caches automatically key on translated vs replacement DXIL. ## Verification - Ran `cargo check -p larp` on this branch (exited `0`, 0 errors, 0 warnings in modified files).
github-bot locked as GitHub sync and limited conversation to collaborators 2026-12-06 01:02:51 +00:00
github-bot changed target branch from main to gh-pr/452/base 2026-12-06 01:11:30 +00:00
github manually merged commit 3df749625d into gh-pr/452/base 2026-12-06 01:38:56 +00:00
This discussion has been locked. Commenting is limited to contributors.
No description provided.