SPIR-V wishlist
Jasper-Bekkers opened this issue · 5 comments
Tracking issue for features we think are missing or useful in to have in SPIR-V
OpTrap: trigger a breakpoint
Noticed a few comments other things in the codebase yesterday:
- Checked math as native SPIR-V ops could help slightly more optimized checked math routines
rust-gpu/rustc_codegen_spirv/src/builder/builder_methods.rs
Lines 218 to 226 in f79ca6c
- Saturating math ops (already supported by some GPU ISAs - so should be easier to drive adoption for):
rust-gpu/rustc_codegen_spirv/src/builder/mod.rs
Lines 350 to 360 in 17814d6
- Equivalent of
llvm.expect:rust-gpu/rustc_codegen_spirv/src/builder/mod.rs
Lines 386 to 390 in 17814d6
- Equivalent of
llvm.sideeffects:rust-gpu/rustc_codegen_spirv/src/builder/mod.rs
Lines 391 to 395 in 17814d6
- Equivalent of
llvm.assume:rust-gpu/rustc_codegen_spirv/src/builder/mod.rs
Lines 382 to 385 in 17814d6
For the "equivalent of llvm.*", there are a lot of these, those are just the ones that have been hit so far - I've just been JITting them into the codebase. For a reasonably full list, look at this file - for example, llvm.expect.i1 (sym::likely/sym::unlikely), llvm.debugtrap (sym::breakpoint), and so forth. (including llvm.trap (sym::abort), which was already mentioned at the start of this thread)
- Potentially request OpControlBarrier for non-uniform controlflow (useful for #29)
* Potentially request OpControlBarrier for non-uniform controlflow (useful for #29)
To clarify, for #29 the thinking is that OpControlBarrier without undefined behavior may be useful. This would be done by making the behavior a guaranteed hang when it's not executed in uniform control flow...
@khyperia
not only is this legal spir-v, it is unspecified what the return value is (like, it's not specified as undefined, it's unspecified)
%f_ = OpFunction %int None %7
%9 = OpLabel
%x = OpVariable %_ptr_Function_int Function
%12 = OpLoad %int %x
OpReturnValue %12
OpFunctionEnd
can we get this fixed in the spec, please?
this is equivalent to the glsl
int f() {
int x; // explicitly uninitialized
return x;
}