Crash on Nsight Graphics when loading a compute shader compiled from Slang within a performance capture

(Edited the post by mistake and cleared it, if you can revert, please do). rewriting it and reuploading files.

Hi. When testing slang as a new target for a vulkan application, i found that shaders compiled with it that use the internal spirv generator create shaders that will crash nsight when trying to display the spirv, such as trying to check samples or open dissassembly. When the shader is generated with the glslang backend on slang, this error does not happen. No amount of config settings or passing the g

enerated spirv through spirv-opt or spirv-val can fix anything. The spirv passes spirv validation, works on renderdoc, and has no issue on the validation layers.

To replicate, open the attached capture and click the first compute shader in the frame.
SlangCrashNsightProject.zip (2.1 KB)

The culprit shader is in this zip. scatter_write_i32.comp is the original glsl shader, scatter_write_i32.slang is the slang shader, and scatter_write_i32.slanginternal.spv is the spirv shader that crashes.
shaders.zip (2.6 KB)

Hi victor.blanco95,

Thank you for using Nsight Graphics and providing your feedback. We are sorry for any inconvenience you have encountered. Could you please provide a simple example that would allow us to reproduce the issue? Maybe you can try to launch the sample with Frame Debug activity, and share us the serialization result (click ‘Export as C++ Capture’ after launch)? By launch the serialized capture, it might be possible for us to repro your crash.

Thanks
An

Here is a cpp capture that replicates the issue reliably. To crash nsight, try to look at the samples and/or shader of the first non-nsight vkCmdDispatch of a frame, which is using slang.

slangbug.zip (19.1 MB)

Hi victor.blanco95,

Thanks for sharing it to us. I just tried to build and launch it with Nsight Graphics, unfortunately, I can’t repro the crash. Here is my step, could you check whether I missed anything?

  • Launch the app, select the first vkCmdDispatch event in Events view
  • Goto Api Inspector view, select CS stage, click the link named ‘View Source’

I tried all vkCmdDispatch events within the slangbug.zip, no crash happen. I also tried some old version of Nsight Graphics, still see no crash.

Thanks
An

Ive updated the gpu drivers just in case. Im on a 4070 super and on latest public drivers. Windows 10, latest vulkan SDK

Clicking where the mouse shows here to open the shader will crash it. The capture here is recorded from the cpp capture from the lat post.

In case it might help you, this is the minidump generated from nsight after i clicked it
crash.zip (35.1 KB)

Hi victor.blanco95,

Thanks for sharing your dmp and screen shot. Unfortunately, I still can’t repro the crash, I am sure I select the same vkCmdDispatch, and click the comp.10000.spv as your screen shot, no crash happen on my machine.

What’s your Nsight Graphics detail version? Could you share the screen shot of Help->About?

Thanks
An

Thats prety strange that you cant replicate it. Ive heard of other people having the same issue with slang generated shaders too.

This is the version of nsight
image

Nvidia gpu drivers
image

Vulkan SDK is 1.3.280.0

GPU is a RTX 4070Ti Super

Windows
image

Hi victor.blanco95,

I think I find the key here is using some public build, it’s fine on my machine since I am using some internal build. OK, I will create some internal case to track this. Thanks again to share this to us.

Thanks
An

Hi victor.blanco95,

The crash has been fixed; the next release of Nsight Graphics should pick that.

Thanks
An