DirectXShaderCompiler icon indicating copy to clipboard operation
DirectXShaderCompiler copied to clipboard

Allows Vulkan spec constants as attribute arguments.

Open danbrown-amd opened this issue 8 months ago • 5 comments

Fixes #3092

danbrown-amd avatar May 08 '25 03:05 danbrown-amd

:white_check_mark: With the latest revision this PR passed the C/C++ code formatter.

github-actions[bot] avatar May 08 '25 03:05 github-actions[bot]

Why was SpirvEmitter::addDerivativeGroupExecutionMode() written that way? It seems to me that it wouldn't be that difficult to provide enough context to find the original attribute in the AST so the method wouldn't need to scan the previously emitted instructions.

Of course, since there's no access to specializations at compile time, there's no way to ensure the best choice of execution mode with spec constants anyway. However, in some cases partial information would be sufficient to rule out one of them. If both are possible, maybe pick one and issue a warning?

danbrown-amd avatar Jun 17 '25 04:06 danbrown-amd

Why was SpirvEmitter::addDerivativeGroupExecutionMode() written that way?

It was implemented that way because that was the HLSL spec implemented for DXIL. See Thread Groups and Quads. I don't mind if we diverge from it when there are specialization constants. We just need to document it.

If both are possible, maybe pick one and issue a warning?

That is a reasonable idea. Longer term, we could try to add explicit attribute that apply to the entry point that would override the guess.

s-perron avatar Jul 07 '25 13:07 s-perron

/AzurePipelines run

s-perron avatar Nov 05 '25 15:11 s-perron

Azure Pipelines successfully started running 1 pipeline(s).

azure-pipelines[bot] avatar Nov 05 '25 15:11 azure-pipelines[bot]