microsoft / microsoft/DirectXShaderCompiler

[SM6.10][LinAlg] dx::linalg::Multiply takes the vector interpretation from the matrix type

Open
#8,933 0 comments 0 reactions 1 assignee View on GitHub

@V-FEXrt is already working on this.

Since Sep 17, 2026.

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

Description

Description

1.Fp16 vector × Fp16 matrix → Fp16 vector case.

This Multiply overload passes MatrixDT as the input interpretation operand of LinAlgMatVecMul.

https://github.com/microsoft/DirectXShaderCompiler/blob/397ffb2264b4650c97b2418ec9a0f07228719317/tools/clang/lib/Headers/hlsl/dx/linalg.h#L516-L527

But all 4 MultiplyAdd overloads derive the input interpretation from the vector — two from the vector's element type via TypeTraits<InputElTy>::CompType, two from InterpVec.Interpretation. None of them uses MatrixDT.

Is this Multiply's use of MatrixDT intentional, or an oversight?

2.Fp16 vector × Fp8 matrix → Fp16 vector case.
HLSL:
typedef Matrix<ComponentType::F8_E4M3FN, 4, 8, MatrixUse::A, MatrixScope::Thread> matrixType;
matrixType fp8Mat = matrixType::Load<MatrixLayout::MulOptimal>(buffer, 0, 0);

vector<float16_t, 8> vecIn = Inputs.Load<vector<float16_t, 8> >(tid * 16);

vector<float16_t, 4> vecOut =
      Multiply<float16_t>(fp8Mat, MakeInterpretedVector<ComponentType::F16>(vecIn));

DXIL:
  %11 = call <4 x half> @dx.op.linAlgMatVecMul.v4f16.mC21M4N8U0S0.v8f16(
            i32 -2147483623,
            %dx.types.LinAlgMatrixC21M4N8U0S0 %6,
            i1 true,
            <8 x half> %10,
            i32 8)                                  ; interpretation = F16

In DXIL, this interpretation operand (8=F16) doesn't carry the actual input interpretation type, which has to be parsed from the matrix(C21=F8_E4M3FN). Is that reasonable and clear?

Actual Behavior

Environment

  • DXC version
  • Host Operating System <!--- Host operating system and version --->

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.