-
Notifications
You must be signed in to change notification settings - Fork 245
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
DebugPrintf
prevents panics' infinite loops from being (unsoundly) optimized away.
#1048
Comments
Yes, that's the intended behavior from the infinite loop, that a panic hangs. If you want a more useful panic behavior (which, for the record, I fully agree we need to improve this), maybe open an issue about making the We've been blocked on an (the hardest part is forcing the user to provide some way to report the panic, if their code can ever panic) |
Hmmm, this just returns if out of bounds:
But adding back the print keeps the loop:
Silently continuing is problematic since then you can end up with uninitialized / uncomputed outputs. Hanging is preferable but it would be nice to exit execution with an error to the runtime. In particular, it would be useful to identify which shader failed, at least for dev because otherwise it can be hard to track down. If the runtime could catch the panic it could report a helpful error, as well as a backtrace. |
You can try This is a well-known problem with low-level IRs, LLVM had this Rust unsoundness until relatively recently, and ofc SPIR-V did the worst possible thing and copied the bad LLVM behavior that LLVM had already been trying to resolve. (EDIT: are you on Discord or Zulip? it's much easier to dig into something like this in real-time) |
DebugPrintf
prevents panics' infinite loops from being (unsoundly) optimized away.
Rust-GPU panic has significantly changed in these PRs:
By now there should not be anything remotely like infinite loops left around (and while there is a way to get |
#768
See https://github.com/charles-r-earp/rust-gpu/tree/debug_printf_panic.
A minimal example that prints and panics.
This causes a crash or hang when running the shader.
The text was updated successfully, but these errors were encountered: