Skip to content

[HLSL] Crash when wrong parameter type is used for entry point parameter with SV_GroupThreadID #153303

@bob80905

Description

@bob80905

The compiler crashes with an assertion failure:

Assertion failed: isValidOperands(Vec, Elt, Index) && "Invalid insertelement instruction operands!", file D:/llvm-project/llvm/lib/IR/Instructions.cpp, line 1696
PLEASE submit a bug report to https://github.com/llvm/llvm-project/issues/ and include the crash backtrace, preprocessed source, and associated run script.
Stack dump:
0.      Program arguments: D:\\llvm-project\\build\\bin\\clang-dxc.exe -enable-16bit-types -T cs_6_5 C:\\Users\\jbatista\\Desktop\\hlsl.hlsl
1.      <eof> parser at end of file
2.      C:\Users\jbatista\Desktop\hlsl.hlsl:3:6: LLVM IR generation of declaration 'main'
3.      C:\Users\jbatista\Desktop\hlsl.hlsl:3:6: Generating code for declaration 'main'
Exception Code: 0xC000001D

This failure is reproduced with this minimal shader:

[numthreads(4,1,1)]
void main(uint16_t3 TID : SV_GroupThreadID) {
  uint OutIdx = TID.x * 3;
}

Note that the parameter type for TID, uint16_t3, should really be a 32 bit integer, or an i32. Because it isn't, there's a mismatch when it's compared against the attribute's expected result type. i16 != i32.
Compilation args: -enable-16bit-types -T cs_6_5

Metadata

Metadata

Assignees

No one assigned

    Labels

    HLSLHLSL Language Support

    Type

    Projects

    Status

    Ready

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions