microsoft / microsoft/DirectXShaderCompiler

[SPIR-V] DXC generates invalid SPIRV for multiple entry points

Open
#8,009 3 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug spirv
Dominant language
C++
Stars
3.7k
Forks
900
Avg merge
2d 11h
Merged PRs (30d)
44

Description

Description
DXC generates invalid SPIRV with following error

fatal error: generated SPIR-V is invalid: In Logical addressing, variables can only allocate a storage buffer pointer if the VariablePointersStorageBuffer capability is declared
%Foo = OpVariable %_ptr_Private__ptr_StorageBuffer_type_StructuredBuffer_v4float Private

Steps to Reproduce
https://godbolt.org/z/hhxdPoaGT

Options used : -spirv -T lib_6_6 -fspv-target-env=vulkan1.3
--->

Actual Behavior
The shader seems legal and generates DXIL

The issue seems to be spirv-opt PrivateToLocal will not handle cases like above post inlining with multiple entry points
If DXC adds "VariablePointersStorageBuffer" capability this should end up working

Erroring out such hard to support cases seems fine as well

Environment

  • DXC version libdxcompiler.so: 1.10(dev;1-948629ac); libdxil.so: 1.10
  • Host OS : Windows

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the Godbolt reproduction using -spirv -T lib_6_6 -fspv-target-env=vulkan1.3 and inspect the generated SPIR-V validation error. Investigate the described spirv-opt PrivateToLocal behavior after inlining with multiple entry points. Done means the legal shader produces valid SPIR-V, or the compiler reports a clear unsupported-case error.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp
Domain
compilers, computer-graphics
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.