[Feature Request] [SPIR-V] `vk::ext_decorate` on return types of Inline SPIR-V Intrinsics or functions In general
Is your feature request related to a problem? Please describe.
In SPIR-V certain Result IDs (immediate SSA values) can be OpDecorated with very useful things like:
-
Uniform/UniformID, basically the reverse ofnonUniformEXT - SPV_EXT_float_control2 decorations allow decorating expressions
Describe the solution you'd like
I'd like to do this https://godbolt.org/z/a1xnsnord
template<typename T>
[[vk::ext_instruction(/*spv::OpCopyObject*/83)]]
[[vk::ext_decorate(/*spv::DecorationUniform*/26)]]
T decorateExpression(T v);
which should be enough to decorate things like FMul and so on.
But this is not sufficient
template<typename T>
[[vk::ext_decorate(/*spv::DecorationUniform*/26)]]
T decorateExpression(T v)
{
return v;
}
because certain decorations need to be applied directly to some SPIR-V instruction like mul,add.
Here's the SPIR-V I'd like to arrive at https://godbolt.org/z/o6z9f6GYc
Describe alternatives you've considered
Ideally I'd love to be able to just decorate a statement.
However I know that even in latest trunk Clang statements cannot have attributes and thats a future C++ proposal https://www.open-std.org/jtc1/sc22/wg21/docs/papers/2024/p3093r0.html