microsoft / microsoft/DirectXShaderCompiler

Validation fails when linking to amplification shader target

Open
#5,686 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

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

Description

Description
When using dxc -link with an amplification shader target ( -Tas_6_6) I get a validation error message:

Link failed:
error: validation errors
Function: main: error: For amplification shader with entry 'main', payload size 8 is greater than declared size of 4 bytes.
note: at 'call void @dx.op.dispatchMesh.struct.payloadStruct(i32 173, i32 1, i32 1, i32 1, %struct.payloadStruct addrspace(3)* nonnull @"\01?p@@3UpayloadStruct@@A")' in block '#0' of function 'main'.
Validation failed.

If I compile the same shader directly to an amplification shader it works correctly.

Steps to Reproduce

> cat as.hlsl
struct payloadStruct
{
    uint myArbitraryData;
};

groupshared payloadStruct p;

[shader("amplification")]
[RootSignature("")]
[numthreads(1,1,1)]
void main(in uint3 groupID : SV_GroupID)
{
    p.myArbitraryData = groupID.z;
    DispatchMesh(1,1,1,p);
}

> dxc /Tas_6_6 as.hlsl
... outputs an amplification shader as expected ...
> dxc /Tlib_6_x /Fo as.lib as.hlsl
> dxc.exe /Tas_6_6 -link as.lib
Link failed:
error: validation errors
Function: main: error: For amplification shader with entry 'main', payload size 8 is greater than declared size of 4 bytes.
note: at 'call void @dx.op.dispatchMesh.struct.payloadStruct(i32 173, i32 1, i32 1, i32 1, %struct.payloadStruct addrspace(3)* nonnull @"\01?p@@3UpayloadStruct@@A")' in block '#0' of function 'main'.
Validation failed.

Actual Behavior

Link failed:
error: validation errors
Function: main: error: For amplification shader with entry 'main', payload size 8 is greater than declared size of 4 bytes.
note: at 'call void @dx.op.dispatchMesh.struct.payloadStruct(i32 173, i32 1, i32 1, i32 1, %struct.payloadStruct addrspace(3)* nonnull @"\01?p@@3UpayloadStruct@@A")' in block '#0' of function 'main'.
Validation failed.

Environment

  • DXC version dxcompiler.dll: 1.7 - 1.7.0.14071 (main, 9a0768d66); dxil.dll: 1.6(101.6.2104.33))
  • Host Operating System Windows 11

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

Use the provided as.hlsl and the dxc commands to reproduce the difference between direct amplification-shader compilation and library linking. Compare the validation results for both paths; done means the linked shader validates successfully without the payload-size error.

Written by the indexing model from the issue text.

Assessment

Domain
compilers
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.