Skip to content

[HLSL][SPIRV] The clang-dxc enables SPV extension not allowed in Vulkan #147717

Open
@s-perron

Description

@s-perron

When the -fspv-extension is not on the command line it is suppose to enable "all" SPIR-V extensions. This is implemented in Clang by passing the -spv-ext=all to the SPIR-V backend. In the DXC context, this did not require any qualifications because if an extension was not used in Vulkan, it was not part of the compiler. However, the SPIR-V backend in Clang generates code for OpenCL as well, and uses extensions that are not allowed in Vulkan.

See https://godbolt.org/z/E1484Pqan for an example. The SPV_KHR_no_integer_wrap_decoration extension is generated, but it is not legal.

RWBuffer<int> sb;

[numthreads(1,1,1)]
void main() {
 sb[0] = -sb[1];
}

This needs to be fixed. I see two options based on whose responsibility it is to limit "all" extensions to just those allowed in Vulkan.

  1. The SPIR-V backend will have separate lists for each environment:

  1. The clang-dxc driver should explicitly list only the extensions that it wants to allow.

I have a preference for option.

Metadata

Metadata

Assignees

Labels

Type

Projects

Status

Planning

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions