Skip to content

[SM6.10][Bugfix] Fix Size check for input interpreted vector in MultiplyAdd#8388

Open
hekota wants to merge 1 commit intomicrosoft:mainfrom
hekota:fix-size-check
Open

[SM6.10][Bugfix] Fix Size check for input interpreted vector in MultiplyAdd#8388
hekota wants to merge 1 commit intomicrosoft:mainfrom
hekota:fix-size-check

Conversation

@hekota
Copy link
Copy Markdown
Member

@hekota hekota commented Apr 18, 2026

Fixes vector size check for input interpreted vector.

Adds tests for MultiplyAdd with odd vector and matrix sizes, and with packed input vector.

Fixes #8385

…plyAdd

Fixes vector size check for input interpreted vector.

Adds tests for MultiplyAdd with odd sizes and with packed input vector.

Fixes microsoft#8385
// clang-format off
typename hlsl::enable_if<
InterpretedVector<InputElTy, VecK, InputInterp>::Size == K,
InterpretedVector<InputElTy, VecK, InputInterp>::Size >= K,
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shouldn't this check a range? The min/max would be the same for non-packed components, but would have a range of valid sizes for packed components, accounting for the use of between 1 and 4 components packed into the last scalar.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

But I suppose this change will unblock scenarios for now, since the range check would be significantly more complicated to write.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I should mention that alternatively, converting K to packed scalar size (div by ElementsPerScalar rounded up) and comparing that to VecK, might be simpler than comparing a range.

Copy link
Copy Markdown
Contributor

@tex3d tex3d left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think the right check is for a range, but this will unblock valid scenarios for now, so we should at least get this mitigation in.

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] linalg::MultiplyAdd template: wrong Size check condition for InterpretedVector

2 participants