DirectXShaderCompiler icon indicating copy to clipboard operation
DirectXShaderCompiler copied to clipboard

[SPIR-V] DXC crash

Open jbright282 opened this issue 1 year ago • 2 comments

Description Small shader crashes DXC. Verified with nightlies.

Steps to Reproduce

Commandline: dxc.exe -T cs_6_2 -E csAccumulate -spirv -fspv-target-env="vulkan1.1" -Fo output.spv .\badfile.hlsl

I've got the shader down to:

struct CommonParams
{
 float2 paramA;
};

void ComputeProj(const CommonParams params, out float2 paramA)
{
}

void RectifyHistory( inout float3 fHistoryColor, inout float3 fHistoryWeight)
{
}

CommonParams InitParams(int2 iPxHrPos)
{
 CommonParams params;
 ComputeProj(params, params.paramA);
 return params;
}

void Accumulate(int2 iPxHrPos)
{
 const CommonParams params = InitParams(iPxHrPos);

 float3 fHistoryColor = float3(0, 0, 0);
 float fHistoryWeight = float(0);
 RectifyHistory(fHistoryColor, fHistoryWeight);
}

[numthreads(8, 8, 1)]
void csAccumulate(int2 iDispatchThreadID : SV_DispatchThreadID, int2 iGroupId : SV_GroupID, int2 iGroupThreadId : SV_GroupThreadID, int iGroupThreadIndex : SV_GroupIndex)
{
    Accumulate(iDispatchThreadID);
}

Note the float/float3 mismatch with fHistoryWeight. This throws a warning compiling for DX. SPIRV crashes with no error.

Environment

  • DXC version dxcompiler.dll: 1.8 - 1.8.2403.37 (11e1318c3); dxil.dll: 1.8(101.8.2403.24)
  • Host Operating System: Win10

jbright282 avatar Apr 26 '24 05:04 jbright282

@jbright282 Thanks for reporting, we'll take a look.

sudonatalie avatar May 01 '24 19:05 sudonatalie

Here is a smaller test case that demonstrates the problem: https://godbolt.org/z/hzG9casr1

s-perron avatar Jun 18 '24 19:06 s-perron