You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[SPIR-V] Fails to add linkage capability to module #6738
I'm currently trying to mark a function Export using SPIR-V's Linkage capability.
I get to this compilation error:
fatal error: generated SPIR-V is invalid: Operand 2 of Decorate requires one of these capabilities: Linkage
OpDecorate %eval_sdf LinkageAttributes "eval_sdf" Export
But I can't find a way to add [[vk::ext_capability(/* Linkage */ 5)]] to the right location.
Adding it to the function in question does nothing, decorating the entry point does nothing as well.
Just adding it to the top of my file gives the error error: an attribute list cannot appear here which makes sense, given the rules described here
Am I missing something, or is this just not possible at the moment?
Steps to Reproduce
see this example code. It includes adding the capability to both, the function in question, as well as the entry point.
Actual Behavior
The compiler fails with:
fatal error: generated SPIR-V is invalid: Operand 2 of Decorate requires one of these capabilities: Linkage
OpDecorate %eval_sdf LinkageAttributes "eval_sdf" Export
So the function is already decorated Export, but the Linkage capability is missing.
However, the [[vk::ext_capability(/* Linkage */ 5)]] attribute is meant to be used when you are using other inline spir-v that requires the extension. The linkage capability would be added automatically by the compiler, but at this time it only adds the capability if there are no entry points in the module. This condition should be updated. This is a bug in the compiler that needs to be fixed.
Activity
s-perron commentedon Jul 15, 2024
You can make this work with the latest top of tree: https://godbolt.org/z/9fzdeoGYT. You can add the attribute to the entry point, and use the universal1.5 target env (-fspv-target-env=universal1.5).
However, the
[[vk::ext_capability(/* Linkage */ 5)]]attribute is meant to be used when you are using other inline spir-v that requires the extension. The linkage capability would be added automatically by the compiler, but at this time it only adds the capability if there are no entry points in the module. This condition should be updated. This is a bug in the compiler that needs to be fixed.Add linkage capability based on decorations
Add linkage capability based on decorations (microsoft#6900)
Add linkage capability based on decorations (microsoft#6900)