microsoft / microsoft/DirectXShaderCompiler

[SPIR-V] `-Gis` flag causing invalid SPIR-V to be generated for `mad` for 32 bit integers

Open
#7,706 2 comments 0 reactions 1 assignee View on GitHub

@luciechoi is already working on this.

Since Aug 21, 2025.

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

Description

https://godbolt.org/z/1q18evbx7

Compiling this code with the -Gis flag enabled

// RUN: %dxc -spirv -fspv-target-env=vulkan1.3 -Gis -HV 202x -T cs_6_5 %s

StructuredBuffer<int4> M1 : register(t3);
StructuredBuffer<int4> A1 : register(t4);
StructuredBuffer<int4> B1 : register(t5);
RWStructuredBuffer<int4> Out1 : register(u10);

[numthreads(1,1,1)]
void main() {
  Out1[0] = mad(M1[0], A1[0], B1[0]);
}

is producing this error:

# .---command stderr------------
# | fatal error: generated SPIR-V is invalid: ID '30' decorated with NoContraction multiple times is not allowed.
# |   %30 = OpIMul %v4int %152 %154
# | 
# `-----------------------------
# error: command failed with exit status: 0x80004005

The same error occurs when using uint as well.

-Gis should only impact floating point operations, so there's likely a bug in DXC causing it to add floating point flags to an integer operation.

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.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.