Skip to content

[0035] Adding conversion primitives - #819

Merged
Chris B (llvm-beanz) merged 8 commits into
microsoft:mainfrom
llvm-beanz:cbieneman/linalg-conversions
Mar 30, 2026
Merged

[0035] Adding conversion primitives#819
Chris B (llvm-beanz) merged 8 commits into
microsoft:mainfrom
llvm-beanz:cbieneman/linalg-conversions

Conversation

@llvm-beanz

Copy link
Copy Markdown
Collaborator

This provides a different approach to addressing some of the issues around types and conversions. Instead of allowing the arithmetic operations to convert data during the operations it implements a conversion operation that converts data before the operation.

Fixes #786, Fixes #568

This provides a different approach to addressing some of the issues
around types and conversions. Instead of allowing the arithmetic
operations to convert data during the operations it implements a
conversion operation that converts data before the operation.

Fixes microsoft#786, Fixes microsoft#568
@llvm-beanz

Copy link
Copy Markdown
Collaborator Author

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.

Having an explicit Convert like this makes sense to me, but I'm struggling to understand how a conversion to, say, F8_E4M3 is actually supposed to work given that I don't believe we can have a plain vector of that type.

Comment thread proposals/0035-linalg-matrix.md Outdated
Comment thread proposals/0035-linalg-matrix.md

@pow2clk Gregory Roth (pow2clk) left a comment

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 think it would be less confusing to use uint for packed 8-bit floats than the existing uint8_t4_packed native types as the example code uses.

I'd be interested to know what is expected if these native packed types are used for native vectors used in matvec multiplies.

Comment thread proposals/0035-linalg-matrix.md Outdated
Comment thread proposals/0035-linalg-matrix.md
Co-authored-by: Nicolai Hähnle <nhaehnle@gmail.com>
Comment thread proposals/0035-linalg-matrix.md Outdated
@anupamachandra

Copy link
Copy Markdown
Contributor

Will there be a runtime feature check couterpart to check what conversions an implementation supports?

Comment thread proposals/0035-linalg-matrix.md Outdated
@jenatali

Copy link
Copy Markdown
Member

Will there be a runtime feature check couterpart to check what conversions an implementation supports?

I don't see a change to how the PSV0 data structure as part of this, but yes we can make a corresponding change in the caps reporting.

Mostly changes the inlined header to be consistent with itself, other
parts of the spec and other corrections for compilability

Finish update to SIZE_TYPE in header.
Remove unused IsNativeScalar boolean.
These finish the cleanups that microsoft#712 started to fix microsoft#570

Finish update to align mat/vec multiplies with coopvec spec. Finishes

Update mat/vec multiply operations to not take a scope parameter,
limiting them to thread scope Fixes microsoft#797

Remove unused template type for accumulate() methods fixes microsoft#795

Renumbered componenttype enum to be consistent with internal numbers
fixes microsoft#798

Removed latent `p` prefix to overload names of groupshared dxil ops for
consistency. Corrects omission in microsoft#769 fixing microsoft#756

Corrected latent mention of linAlgMatrixMulOp
This responds to API feedback provided offline. I've also fixed some
formatting and other errors introduced in `main`.
@llvm-beanz

Copy link
Copy Markdown
Collaborator Author

I don't see a change to how the PSV0 data structure as part of this, but yes we can make a corresponding change in the caps reporting.

We have two separate PRs now (this and #803) which both need PSV0 changes, so I've filed a separate issue to track getting that done (#826).

Comment thread proposals/0035-linalg-matrix.md Outdated
Comment thread proposals/0035-linalg-matrix.md Outdated
Comment thread proposals/0035-linalg-matrix.md Outdated
Comment thread proposals/0035-linalg-matrix.md
Comment thread proposals/0035-linalg-matrix.md
Comment thread proposals/0035-linalg-matrix.md Outdated
Comment thread proposals/0035-linalg-matrix.md Outdated
Comment thread proposals/0035-linalg-matrix.md Outdated

@tex3d Tex Riddell (tex3d) left a comment

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.

LGTM.

Comment thread proposals/0035-linalg-matrix.md
@llvm-beanz
Chris B (llvm-beanz) merged commit b5d6957 into microsoft:main Mar 30, 2026
4 checks passed
@github-project-automation github-project-automation Bot moved this to Triaged in HLSL Triage Mar 30, 2026
Ashley Coleman (V-FEXrt) added a commit to microsoft/DirectXShaderCompiler that referenced this pull request Mar 31, 2026
microsoft/hlsl-specs#819 Adds a signed output
bool to the VecMul and VecMulAdd ops. This PR reflects that change to
the spec.
Helena Kotas (hekota) added a commit to microsoft/DirectXShaderCompiler that referenced this pull request Apr 1, 2026
Adds `Convert` function to `linalg.h`. This function converts a vector to an `InterpretedVector` of a different component type. It has been added to the spec in microsoft/hlsl-specs#819. It is implemented by calling a built-in function that was added in #8308.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

Status: Triaged

Development

Successfully merging this pull request may close these issues.

[0035] dx.op.linAlgMatVecMulAdd dx.op. doesn't capture the signedness of the input and output vectors [0035] Fill out spec section on conversions

8 participants