Skip to content

[SM6.10][Exec] Implement Remaining LinAlg Smoke Tests#8366

Open
V-FEXrt wants to merge 20 commits intomicrosoft:mainfrom
V-FEXrt:linalg-ops-smoke-test
Open

[SM6.10][Exec] Implement Remaining LinAlg Smoke Tests#8366
V-FEXrt wants to merge 20 commits intomicrosoft:mainfrom
V-FEXrt:linalg-ops-smoke-test

Conversation

@V-FEXrt
Copy link
Copy Markdown
Collaborator

@V-FEXrt V-FEXrt commented Apr 10, 2026

Implements the remaining smoke tests for the LinAlg DXIL ops

Fixes #8126

Co-authored-by: Copilot 223556219+Copilot@users.noreply.github.com

@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Apr 10, 2026

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

Comment thread tools/clang/unittests/HLSLExec/LinAlgTests.cpp Outdated
Comment thread tools/clang/unittests/HLSLExec/LinAlgTests.cpp Outdated
@azure-pipelines
Copy link
Copy Markdown

Azure Pipelines:
Successfully started running 1 pipeline(s).

@azure-pipelines
Copy link
Copy Markdown

Azure Pipelines:
Successfully started running 1 pipeline(s).

@azure-pipelines
Copy link
Copy Markdown

Azure Pipelines:
Successfully started running 1 pipeline(s).

@azure-pipelines
Copy link
Copy Markdown

Azure Pipelines:
Successfully started running 1 pipeline(s).

@azure-pipelines
Copy link
Copy Markdown

Azure Pipelines:
Successfully started running 1 pipeline(s).

@azure-pipelines
Copy link
Copy Markdown

Azure Pipelines:
Successfully started running 1 pipeline(s).

@azure-pipelines
Copy link
Copy Markdown

Azure Pipelines:
Successfully started running 1 pipeline(s).

@azure-pipelines
Copy link
Copy Markdown

Azure Pipelines:
Successfully started running 1 pipeline(s).

@V-FEXrt V-FEXrt changed the title [SM6.10][Exec] Implement Remaining Smoke Tests [SM6.10][Exec] Implement Remaining LinAlg Smoke Tests Apr 15, 2026
@V-FEXrt V-FEXrt marked this pull request as ready for review April 15, 2026 00:45
@azure-pipelines
Copy link
Copy Markdown

Azure Pipelines:
Successfully started running 1 pipeline(s).

Comment thread tools/clang/unittests/HLSLExec/HlslExecTestUtils.cpp Outdated
Copy link
Copy Markdown
Member

@damyanp damyanp left a comment

Choose a reason for hiding this comment

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

I haven't carefully reviewed every test, but overall shape etc. LGTM.

Comment thread tools/clang/unittests/HLSLExec/HlslExecTestUtils.cpp Outdated
Comment thread tools/clang/unittests/HLSLExec/LinAlgTests.cpp Outdated
@azure-pipelines
Copy link
Copy Markdown

Azure Pipelines:
Successfully started running 1 pipeline(s).

Comment on lines +581 to +584
addUAVBuffer(Op.get(), "Input", BufferSize, false, "byname");
addUAVBuffer(Op.get(), "Output", BufferSize, true);
addRootUAV(Op.get(), 0, "Input");
addRootUAV(Op.get(), 1, "Output");
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.

This says addUAVBuffer and addRootUAV for "Input" when it actually should be an SRV, not a UAV.

Same issue for MatVecMul and MatVecMulAdd

Copy link
Copy Markdown
Contributor

@tex3d tex3d Apr 16, 2026

Choose a reason for hiding this comment

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

It looks like the it could be done properly as an SRV by adding another utility function addSRVBuffer which would set the TransitionTo state to D3D12_RESOURCE_STATE_NON_PIXEL_SHADER_RESOURCE | D3D12_RESOURCE_STATE_PIXEL_SHADER_RESOURCE instead of D3D12_RESOURCE_STATE_UNORDERED_ACCESS. (both because an SRV accessible to both can have both flags, according to docs, and we wouldn't want a general addSRVBuffer function to deny PS access).

D3D12_RESOURCE_STATE_NON_PIXEL_SHADER_RESOURCE is used by ShaderOpTest::SetRootValues to determine that this should be an SRV rather than a UAV.

Then you'd probably also want to rename addRootUAV to addRootResourceView or something like that, since it could map CBV, SRV, or UAV, depending on the TransitionTo property in the resource structure.

It might make little difference, but the current code results in a call to SetGraphicsRootUnorderedAccessView instead of SetGraphicsRootShaderResourceView on the command list.

__builtin_LinAlg_MatrixLoadFromDescriptor(
Mat, Input, 0, STRIDE, LAYOUT, 128);

vector<ELEM_TYPE, M_DIM> InVec;
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.

Minor: This uses M_DIM for input vector size instead of N_DIM. For this smoke test, M_DIM == N_DIM, so it doesn't really make a difference, but decoupling it might lead to fewer incorrect assumptions based on this example in the future.

Same for MatVecMulAdd.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

I was looking at the spec and I had the impression it would always be M_DIM since its a Column wise multiply?

From context, I'm guessing that changing to ColMajor inverts it to N_DIM?

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.

It's always an A Matrix, which is MxK. The N_DIM is actually K. For this operation the vector dimension matches the K dim and the output dimension and bias dimension matches M.

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.

Create Basic LinAlg Matrix HLKs

4 participants