Skip to content

GPU path tracer: NVIDIA's Vulkan compiler crashes (nvgpucomp64.dll) or floods memory on the path shader; minimal trigger found #6705

Closed

Description

@plexi32

Actual behavior

On Windows 11 with an RTX 4060 Ti (driver 610.88, nvgpucomp64.dll 32.0.16.1088), creating the
GPU path tracer's main compute pipeline (path::Executor::new) never succeeds:

  • unchanged shader (main a1b9ca1): ~25 min single-threaded in nvgpucomp64.dll at ~1.5 GB, then the
    process dies with EXCEPTION_ACCESS_VIOLATION at nvgpucomp64.dll+0x2D564B1 (same offset in
    every run, from the Event Viewer; a larger thread stack doesn't help).
    render_workspace::tests::progressive_image_controls_route_to_the_registered_host dies this way.
  • with the crash worked around (below), the same compiler phase instead allocates ~1 GB/s
    (>12 GB within seconds, still growing when stopped).

The Render workspace runs the same compile when it opens, so this probably also explains
#6583/#6596 (crash in nvgpucomp64.dll between commands) and #6561 (memory flood while
"compiling shaders" on Linux NVIDIA). I haven't verified that in the app.

Reproduction (seconds, not minutes)

The shader's own test entry points boundary_reference, lens_reference and
refracted_corner_reference crash the compiler in 4–5 s. Compile one of them from the concatenated
SHADER with create_compute_pipeline(entry_point: Some("boundary_reference")) on a Vulkan device
(a 40-line program with wgpu + pollster is enough). Reduced trigger, appended to the same shader:

@compute @workgroup_size(1)
fn mini() {
    let a = trace(u.eye.xyz, u.back.xyz, false);
    if a.triangle == 0xffffffffu { accumulation[0] = vec4<f32>(0.0); return; }
    let p = surface_point(triangle(0u), a.bary);
    accumulation[0] = vec4<f32>(p, 1.0);
}

It compiles in <1 s without the early return, with bary from the uniform instead of the hit, or with
surface_point's let b=(a+1u)%3u; let c=(a+2u)%3u; written as
let b=select(a+1u,0u,a==2u); let c=select(a+2u,a-1u,a>0u); (also in surface_point_precise and
surface_ray_depth). With that rewrite all three entry points compile in <1 s.

Memory flood: what it depends on

With the select rewrite, the late compile phase still floods memory, depending on how much
traversal code is inlined into main:

main variant (with select rewrite) result
no shadow rays, sample_path called once compiles: 91 s, 2.6 GB peak
no shadow rays, three sample_path calls (as today) >7 GB at 67 s
with shadow rays, called once >12 GB at ~160 s
full shader >12 GB after ~30 min

Not the cause: the shadow loop's 64-step bound (4 steps, or a runtime bound, also flood), the
32-entry traversal stack (8 also floods), the precise traversal for shadow rays.
main inlines sample_path three times (one per branch). Computing it once before the branches is an
easy saving, but it isn't enough alone.

Expected behavior

The path pipeline compiles in bounded time and memory on NVIDIA. If the driver can't compile it,
GPU raytracing reports itself unavailable and the app doesn't crash.

Suggestions

  • Avoid the %3u index pattern after traversal (driver crash).
  • Keep main under the driver's limit: one sample_path call site, fewer inlined traversal copies
    (one traversal call per bounce shared by camera/bounce and shadow rays, or separate passes).
  • Since a driver crash can't be caught in-process, consider a compile time/memory budget or compiling
    the path pipeline in a child process before advertising GPU raytrace.

Environment

Windows 11 Pro 26300, NVIDIA GeForce RTX 4060 Ti, driver 610.88 (32.0.16.1088), Vulkan 1.4.341,
wgpu 30, Rust 1.99.1 x86_64-pc-windows-msvc, main a1b9ca1. No RTSS/OBS Vulkan layers.

Activity

  1. added
    area:render
    bug
    needs-triage
    in progress
    on Oct 25, 2026
  2. github-actions commented on Oct 25, 2026

    @github-actions
    Contributor

    Claimed by @bluecmd through #6800. The claim lapses after 14 days without pushes.

  3. vdirienzo commented on Oct 26, 2026

    @vdirienzo
    Contributor

    The same shader fails on a second driver here, with a different signature, and it changes what the fix in #6850 has to prove.

    On Mesa 26.1.6 (ANV/BRW, Intel iGPU) path::Executor::new never returns. It is not a crash and not NVIDIA's ~1 GB/s flood: the compile sits in the driver's liveness analysis, holding one core at 100%, with a memory curve that plateaus and then resumes:

    anv_shader_compile                        src/intel/vulkan/anv_shader_compile.c:1270
    └─ brw_compile_cs                         src/intel/compiler/brw/brw_compile_cs.cpp:75
       └─ brw_optimize                        src/intel/compiler/brw/brw_opt.cpp:80
          └─ brw_opt_dead_code_eliminate       src/intel/compiler/brw/brw_analysis.h:152
             └─ brw_live_variables::compute_live_variables   src/intel/compiler/brw/brw_analysis_liveness.cpp:183
    
    t=  1.0s rss=1022 MB
    t=  3.0s rss=3663 MB
    t=  3.0s .. 35.0s  rss=3666 MB   (plateau)
    t= 37.1s rss=4757 MB
    t= 37.5s rss=6385 MB   (watchdog stopped the probe)
    

    @bluecmd measured "the linked e5bedec9 shader alone exceeded the 4 GiB probe budget after 33.1 s" on NVIDIA; the plateau here is at 33 s and 3.6 GB. It looks like the same pathology in two different compilers, which suggests the driver-side limit is a function of the inlined traversal code, exactly as the table in this issue concludes.

    One thing that does not work, in case it looks tempting: splitting the module per entry point. Reducing the shipped 21 @compute entry points to one (main only, all helper functions kept) leaves the compile unfinished and still needs more than 6 GB for that single 81 KB entry point. A trivial 169-byte control shader compiles in 16 ms on the same device, so the driver is healthy and the module is the input. The lever is the size of main, not the number of entry points.

    That means #6850's reduction from 33 to 5 inlined BVH walks is the right direction, but it needs the same measurement on this driver before it can be called fixed. A probe that reproduces it in seconds is attached to #7291; the full probe is a single-file example that opens a device with the app's own limits, builds the app's seven-binding layout, creates the same pipeline and stops itself at a memory cap.

    Two follow-ups:

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    area:renderbugin progressneeds-triage

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions