microsoft / microsoft/DirectXShaderCompiler
[Crash] VariablePointers* capabilities not enabled when targeting SPIRV backend
Nobody has claimed this yet.
- Dominant language
- C++
- Stars
- 3.7k
- Forks
- 900
- Avg merge
- 2d 11h
- Merged PRs (30d)
- 44
Description
This stack trace:
FAIL: OffloadTest-vk :: Feature/LocalResources/local_resource_if_else_array_elements.test (302 of 608)
******************** TEST 'OffloadTest-vk :: Feature/LocalResources/local_resource_if_else_array_elements.test' FAILED ********************
Exit Code: 2147500037
Command Output (stdout):
--
# RUN: at line 70
c:\actions-runner\_work\offload-test-suite\offload-test-suite\llvm-project\build\bin\split-file.exe C:\actions-runner\_work\offload-test-suite\offload-test-suite\OffloadTest\test\Feature\LocalResources\local_resource_if_else_array_elements.test C:\actions-runner\_work\offload-test-suite\offload-test-suite\llvm-project\build\tools\OffloadTest\test\vk\Feature\LocalResources\Output\local_resource_if_else_array_elements.test.tmp
# executed command: 'c:\actions-runner\_work\offload-test-suite\offload-test-suite\llvm-project\build\bin\split-file.exe' 'C:\actions-runner\_work\offload-test-suite\offload-test-suite\OffloadTest\test\Feature\LocalResources\local_resource_if_else_array_elements.test' 'C:\actions-runner\_work\offload-test-suite\offload-test-suite\llvm-project\build\tools\OffloadTest\test\vk\Feature\LocalResources\Output\local_resource_if_else_array_elements.test.tmp'
# RUN: at line 71
"C:\actions-runner\_work\offload-test-suite\offload-test-suite\DXC\build\bin\dxc.exe" -spirv -fspv-target-env=vulkan1.3 -T cs_6_0 -Fo C:\actions-runner\_work\offload-test-suite\offload-test-suite\llvm-project\build\tools\OffloadTest\test\vk\Feature\LocalResources\Output\local_resource_if_else_array_elements.test.tmp.o C:\actions-runner\_work\offload-test-suite\offload-test-suite\llvm-project\build\tools\OffloadTest\test\vk\Feature\LocalResources\Output\local_resource_if_else_array_elements.test.tmp/source.hlsl
# executed command: 'C:\actions-runner\_work\offload-test-suite\offload-test-suite\DXC\build\bin\dxc.exe' -spirv -fspv-target-env=vulkan1.3 -T cs_6_0 -Fo 'C:\actions-runner\_work\offload-test-suite\offload-test-suite\llvm-project\build\tools\OffloadTest\test\vk\Feature\LocalResources\Output\local_resource_if_else_array_elements.test.tmp.o' 'C:\actions-runner\_work\offload-test-suite\offload-test-suite\llvm-project\build\tools\OffloadTest\test\vk\Feature\LocalResources\Output\local_resource_if_else_array_elements.test.tmp/source.hlsl'
# .---command stderr------------
# | fatal error: generated SPIR-V is invalid: Using pointers with OpPhi requires capability VariablePointers or VariablePointersStorageBuffer
# | %31 = OpPhi %_ptr_StorageBuffer_type_RWByteAddressBuffer %29 %27 %30 %28
# |
# | note: please file a bug report on https://github.com/Microsoft/DirectXShaderCompiler/issues with source code if possible
# |
# `-----------------------------
# error: command failed with exit status: 0x80004005
--
********************
Results from compiling this HLSL with -T cs_6_0:
RWByteAddressBuffer In : register(u0);
RWByteAddressBuffer OutArr[] : register(u1);
[numthreads(1,1,1)]
void main(uint3 tid : SV_DispatchThreadID) {
RWByteAddressBuffer Out;
if (tid.x == 0) {
Out = OutArr[0];
} else {
Out = OutArr[1];
}
Out.Store(0, In.Load(0));
}
We should not be encountering this spirv codegen error. It appears that we must enable the VariablePointers* capabilities when Targeting SPIRV in DXC.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Reproduce the failure with the provided HLSL and the OffloadTest test Feature/LocalResources/local_resource_if_else_array_elements.test, targeting SPIR-V with -fspv-target-env=vulkan1.3. Trace SPIR-V capability emission for pointer phi nodes and verify that the generated module declares the required VariablePointers capability, then rerun the failing test to confirm valid output.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- cpp
- Domain
- compilers
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Active
- Clarity
- Mostly clear
- Newbie friendliness
- 55/100