microsoft / microsoft/DirectXShaderCompiler

dxc internal error; invalid GEP with initialization of matrix in a struct

Open
#6,723 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

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

Description

DXC throws an internal error when compiling this compute shader:

struct a {
  float b;
  float2x4 c;
};
struct d {
  a c;
};
struct e {
  d c[1];
  d f[1];
};

static e g = (e)0;

[numthreads(1, 1, 1)]
void main() {
  d h = g.f[0];
  return;
}

Steps to Reproduce

godbolt link

Actual Behavior

From the command line:

$ dxc -T cs_6_0 x.hlsl
error: cast<X>() argument of incompatible type!

Environment

  • DXC version commit: 45018c752daf6dd0ad2d1a9b736e346268966279 (top of tree June 18 2024)
  • Host Operating System: Linux

Initial investigation resulted in #6710 but that doesn't get to root cause.

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

Reproduce the failure with the shader shown in the issue using dxc -T cs_6_0 x.hlsl, then read the initial investigation in #6710 and trace the invalid cast<X>() diagnostic. Done means the reproduced shader no longer triggers the internal error when compiled with the stated DXC configuration.

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.