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

[SPIR-V] vk::ext_capability doesn't propagate correctly #6576

Open
nipunG314 opened this issue May 1, 2024 · 1 comment
Open

[SPIR-V] vk::ext_capability doesn't propagate correctly #6576

nipunG314 opened this issue May 1, 2024 · 1 comment
Labels
bug Bug, regression, crash spirv Work related to SPIR-V

Comments

@nipunG314
Copy link

Description

The [[vk::ext_capability(...)]] tag doesn't propagate if it isn't attached to a [[vk::ext_instruction(...)]] tag. It should either work on every method/function or give errors/warnings on the ones its not supposed to work on/will be ignored. Right now, we're forced to create a specialized version of the same templated function if we want to support a capability only on certain types (e.g. PhysicalStorageBufferAddresses for pointers, but not for builtin types like uint32_t)

Steps to Reproduce

https://godbolt.org/z/PjY3TTq1K

The [[vk::ext_capability(/*PhysicalStorageBufferAddresses */ 5347 )]] at line 17 isn't being propagated correctly. If you uncomment line 13, it compiles correctly.

Actual Behavior

fatal error: generated SPIR-V is invalid: Operand 2 of TypePointer requires one of these capabilities: PhysicalStorageBufferAddresses 
  %spirvIntrinsicType = OpTypePointer PhysicalStorageBuffer %uint

note: please file a bug report on https://github.com/Microsoft/DirectXShaderCompiler/issues with source code if possible

Compiler returned: 5

Environment

  • DXC version: DXC (trunk)
  • Host Operating System: Linux Probably?
@nipunG314 nipunG314 added bug Bug, regression, crash needs-triage Awaiting triage spirv Work related to SPIR-V labels May 1, 2024
@sudonatalie
Copy link
Collaborator

Thanks for reporting @nipunG314 !

These are the rules for where vk::ext_capability can be used, but agreed that error messaging should be improved.

  • [[vk::ext_capability(uint _capability_)]]
    • An attribute to specify OpCapability instruction.
    • It can be an attribute of vk::ext_execution_mode(...), vk::ext_execution_mode_id(...), a function declared with vk::ext_instruction(...), or a function declared with [[vk::ext_type_def(...)]]. We can use multiple [[vk::ext_extension(string extension_name)]] for a single function.
    • uint capability must be a constant expression.

https://github.com/microsoft/DirectXShaderCompiler/wiki/GL_EXT_spirv_intrinsics-for-SPIR-V-code-gen

@sudonatalie sudonatalie removed the needs-triage Awaiting triage label May 9, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Bug, regression, crash spirv Work related to SPIR-V
Projects
Status: Triaged
Development

No branches or pull requests

2 participants