Skip to content

[SM6.10][Bugfix] MultiplyAdd - Convert Bias vector to output vector type#8394

Open
hekota wants to merge 3 commits intomicrosoft:mainfrom
hekota:muladd-convert-in-header
Open

[SM6.10][Bugfix] MultiplyAdd - Convert Bias vector to output vector type#8394
hekota wants to merge 3 commits intomicrosoft:mainfrom
hekota:muladd-convert-in-header

Conversation

@hekota
Copy link
Copy Markdown
Member

@hekota hekota commented Apr 21, 2026

If the Bias vector type/interpretation on MultiplytAdd differs from the output vector type, convert it first to the output vector type before passing it into the __builtin_LinAlg_MatrixVectorMultiplyAdd built-in function (translared to dx.op.linAlgMatVecMulAdd op). The bias vector interpretation is always going to be the same as the output vector interpretation on the call.

To accommodate this, each MultiplyAdd now has two SFINAE-constrained variants:

  1. If the bias interpretation matches the output vector interpretation, no conversion is necessary and the function calls built-in/dxil op directly.
  2. If types don't match, the bias vector is first converted to the output vector type before passing it into the built-in/dxil op.

Adds hlsl::__detail::TypeTraits struct to enable mapping of HLSL scalar types to component type enum values.

Fixes #8390

If the Bias vector type on MultiplytAdd is different than the output vector type, convert it first to the output vector type before calling `dx.op.linAlgMatVecMulAdd` op. The interpretation for the bias vector is always going to be set to the output vector interpretation on the op.

To accommodate this, MultiplyAdd functions have been split into two variants -
one where bias interpretation matches the output vector interpretation and no conversion is necessary, and second where the types don't match and the bias vector is first converted to the output vector type before passing it into the __builtin_LinAlg_MatrixVectorMultiplyAdd.

Adds`hlsl::__detail::TypeTraits` struct to enable mapping of HLSL scalar types to component type enum values.

Fixes microsoft#8390
@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Apr 21, 2026

✅ With the latest revision this PR passed the C/C++ code formatter.

@hekota hekota requested a review from llvm-beanz April 21, 2026 02:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: New

Development

Successfully merging this pull request may close these issues.

[SM6.10] MultiplyAdd should convert Bias to output type

1 participant