Skip to content

[SM6.10] Invalid codegen when LinAlgMatrix type is used in a class #8279

@hekota

Description

@hekota

Description
The compiler fails to generate correct IR when a struct or class contains a LinAlgMatrix attributed type.

Steps to Reproduce

class MyMatrix {
  using MyHandleT = __builtin_LinAlgMatrix [[__LinAlgMatrix_Attributes(9, 4, 4, 0, 1)]];
  MyHandleT handle;

  static MyMatrix Splat(float Val) {
    MyMatrix Result;
    __builtin_LinAlg_FillMatrix(Result.handle, Val);
    return Result;
  }
};

[numthreads(4, 4, 4)]
void main() {
  MyMatrix MatA = MyMatrix::Splat(1.0f);
}

https://godbolt.org/z/KKnfKzsc5

Actual Behavior

define void @main() {
  call void @llvm.dbg.value(metadata float 1.000000e+00, i64 0, metadata !32, metadata !33), !dbg !34 ; var:"Val" !DIExpression() func:"Splat"
  %1 = call %dx.types.LinAlgMatrixC9M4N4U0S1 @dx.op.linAlgFillMatrix.mC9M4N4U0S1.f32(i32 -2147483636, float 1.000000e+00), !dbg !36 ; line:8 col:5  ; LinAlgFillMatrix(value)
  call void @llvm.trap(), !dbg !36 ; line:8 col:5
  unreachable
}

Environment

  • DXC version main as of 3/19/26

Metadata

Metadata

Assignees

Labels

bugBug, regression, crashneeds-triageAwaiting triage

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions