Skip to content

[SPIR-V] DXC crash - make [[vk::ext_literal]] be able to take const static as a well as a literal. #6586

@AlexSabourinDev

Description

@AlexSabourinDev

Description
Hello,

DXC crashes when compiling a shader that uses inline SPIRV to expose OpGroupNonUniformBallotBitCount.

Specifically, the use of a static const uint for the Group Operation.

Steps to Reproduce

This simple shader will reproduce the issue:

static uint const ReduceOperation = 0;

[[vk::ext_instruction(/* OpGroupNonUniformBallotBitCount */ 342)]]
uint OpGroupNonUniformBallotBitCount(uint scope, [[vk::ext_literal]] uint groupOperation, uint4 ballot);

[numthreads(1, 1, 1)]
void CS()
{
	OpGroupNonUniformBallotBitCount(vk::SubgroupScope, ReduceOperation, 0);
}

Issue does not occur when using either an enum or a macro for the ReduceOperation constant.

Godbolt link: https://godbolt.org/z/vcWzGeEG9

Command line: -T cs_6_6 -E CS -spirv -fspv-target-env=vulkan1.3

Actual Behavior

Using the DXC C++ API, I get this crash with no output log from DXC:

Exception thrown at 0x00007FFC468C6552 (dxcompiler.dll) in Samples.exe: 0xC0000005: Access violation writing location 0x0000000000000070.

Compiler explorer simply outputs:

Program terminated with signal: SIGSEGV

Environment

  • DXC versions:
    • libdxcompiler.so: 1.8(dev;1-af955d60)
    • dxcompiler.dll: 1.7 - 1.7.2308.7 (69e54e2); dxil.dll: 1.7(101.7.2308.12)
  • Host Operating System: Windows 10

Metadata

Metadata

Assignees

Labels

bugBug, regression, crashspirvWork related to SPIR-V

Type

No type

Projects

Status

Triaged

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions