Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

panic during translation .frag -> .spv (validation successful): entered unreachable code #4549

Closed
Vipitis opened this issue Oct 24, 2023 · 3 comments
Labels
area: naga back-end Outputs of naga shader conversion lang: SPIR-V Vulkan's Shading Language naga Shader Translator type: bug Something isn't working

Comments

@Vipitis
Copy link

Vipitis commented Oct 24, 2023

Hey,

I have encountered shader programs that validate but panic during translation to spir-v. While looking for a minimal example, I constructed this shadertoy and it's wsgl.frag varaint (via wgpu-py)

So there might be an issue where validation for glsl doesn't correctly catch some issue in the code (although it's valid originally) and therefore crashes during translation. Full backtrace as follows:

thread 'main' panicked at C:\Users\Jan\.cargo\registry\src\index.crates.io-6f17d22bba15001f\naga-0.13.0\src\back\spv\block.rs:2066:56:
internal error: entered unreachable code: Expression [15] is not cached!
stack backtrace:
   0:     0x7ff7944e2d8a - <unknown>
   1:     0x7ff7944fb47b - <unknown>
   2:     0x7ff7944dfcb1 - <unknown>
   3:     0x7ff7944e2b0a - <unknown>
   4:     0x7ff7944e510a - <unknown>
   5:     0x7ff7944e4d78 - <unknown>
   6:     0x7ff7944e57be - <unknown>
   7:     0x7ff7944e56ad - <unknown>
   8:     0x7ff7944e3779 - <unknown>
   9:     0x7ff7944e53b0 - <unknown>
  10:     0x7ff79451d905 - <unknown>
  11:     0x7ff794400d8d - <unknown>
  12:     0x7ff7944130f1 - <unknown>
  13:     0x7ff79441caef - <unknown>
  14:     0x7ff794421942 - <unknown>
  15:     0x7ff794423384 - <unknown>
  16:     0x7ff79424fa10 - <unknown>
  17:     0x7ff79424d347 - <unknown>
  18:     0x7ff79425ec56 - <unknown>
  19:     0x7ff794266fdc - <unknown>
  20:     0x7ff7944d9d18 - <unknown>
  21:     0x7ff794253bfc - <unknown>
  22:     0x7ff794503438 - <unknown>
  23:     0x7ffcc9db7344 - BaseThreadInitThunk
  24:     0x7ffccb8626b1 - RtlUserThreadStart

potential duplicate of #4540, #4517, #4464

@teoxoy teoxoy added kind: bug lang: SPIR-V Vulkan's Shading Language area: naga back-end Outputs of naga shader conversion labels Oct 24, 2023
@cwfitzgerald cwfitzgerald added the naga Shader Translator label Oct 25, 2023
@cwfitzgerald cwfitzgerald transferred this issue from gfx-rs/naga Oct 25, 2023
@cwfitzgerald cwfitzgerald added type: bug Something isn't working and removed kind: bug labels Oct 25, 2023
@Vipitis
Copy link
Author

Vipitis commented Oct 27, 2023

I installed naga-cli from cargo to get 0.14.0. Issue still persists.

thread 'main' panicked at C:\Users\Jan\.cargo\registry\src\index.crates.io-6f17d22bba15001f\naga-0.14.0\src\back\spv\block.rs:2098:56:
internal error: entered unreachable code: Expression [15] is not cached!

seems to still reference the same line of code.

@teoxoy teoxoy added this to the WebGPU Specification V1 milestone Nov 3, 2023
@fornwall
Copy link
Contributor

fornwall commented Nov 18, 2023

Reduced test case (converting this wgsl to spv panics as described above):

fn func(a: ptr<function, f32>) {}

@fragment 
fn main() {
    var v = vec2(0.0);
    func(&v.x);
}

@jimblandy
Copy link
Member

Looks like a duplicate of #4517.

@teoxoy teoxoy closed this as not planned Won't fix, can't repro, duplicate, stale Feb 6, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area: naga back-end Outputs of naga shader conversion lang: SPIR-V Vulkan's Shading Language naga Shader Translator type: bug Something isn't working
Projects
Status: Done
Development

No branches or pull requests

5 participants