[BUG] Crash when processing SPIR-V module during vkCreateGraphicsPipelines

Hi,

While writing some Vulkan code, I believe I ran into a compiler bug in vkCreateGraphicsPipelines. If this is not a bug in the NVIDIA driver, then it would be a bug in the SPIR-V validation tools/optimizer from Khronos, becausespirv-valreports that my shader bytecode is valid both before and after running the optimizer (spirv-opt).

Minimal code to reproduce the issue + backtrace: backtrace · GitHub

The code above provides both a working vertex shader and one that triggers the error. The only difference between the two of them is that, in the working vertex shader, a 4×4 matrix is stored directly in the push constant interface block interface; in the code that crashes, the matrix is nested inside a struct (struct DrawConstants { mat4 model; int material_id; };).

System information:

  • Driver Version: 550.67
  • NVIDIA GPU: NVIDIA GeForce GTX 1080
  • Operating System: Linux 6.8.1, Arch Linux

After playing around with my SPIR-V generation code, I noticed I can completely get rid of the issue by not emitting debug OpName instructions. Since those instructions can be ignored by the client implementation, I now very much think this has to be a bug in the drivers.