Skip to content

[SM6.10][Exec][Bugfix] Add matrix layout conversion helpers, post-execute command list callback, and re-enable OuterProduct test#8606

Open
Icohedron wants to merge 4 commits into
microsoft:mainfrom
Icohedron:matrix-layout-conversion
Open

[SM6.10][Exec][Bugfix] Add matrix layout conversion helpers, post-execute command list callback, and re-enable OuterProduct test#8606
Icohedron wants to merge 4 commits into
microsoft:mainfrom
Icohedron:matrix-layout-conversion

Conversation

@Icohedron

Copy link
Copy Markdown
Collaborator

Addresses the matrix layout conversion requirement of issue #8386

This PR re-enables the OuterProduct smoke test and adds support for matrix layout conversions via new dedicated helper functions in HLSLExecTestUtils.h/.cpp and a new post-execute command list callback in ShaderOpTest.h/.cpp.

  • New helper functions getLinAlgMatrixByteSize, recordLinAlgMatrixConversion, and toLinAlgDataType for querying matrix byte sizes, recording a matrix layout conversion operation to a command list, and converting DXIL component type enums into D3D12 LinAlg datatype enums
  • A new post-execute command list callback is introduced for allowing tests to record commands that run after a dispatch/draw. A separate DIRECT command list is created that runs after the command list containing the dispatch/draw call
    • The rationale for this is that COMPUTE command lists are not allowed to execute the ConvertLinearAlgebraMatrix command. Instead of converting the COMPUTE command list into a DIRECT command list, I opted to create a separate DIRECT command list that runs after the COMPUTE command list to perform the matrix layout conversion. If it is preferrable to simply change the COMPUTE command list into a DIRECT command list and append the ConvertLinearAlgebraMatrix after the dispatch, I am not opposed to it and can change it per reviewers' requests. I am not sure which is the better solution here
  • Re-enable the OuterProduct smoke test with changes made to use the outer-product-optimal layout and uses the new helpers and callback to convert the output back into row-major order for validation

Assisted by: Claude Opus 4.8

@github-actions

This comment was marked as resolved.

Comment thread tools/clang/unittests/HLSLExec/HlslExecTestUtils.h Outdated
Args.c_str());
addUAVBuffer(Op.get(), "Input", InBuffSize, false, "byname");
addUAVBuffer(Op.get(), "Output", OutBufferSize, true);
addUAVBuffer(Op.get(), "Output", OutBufferSize, /*ReadBack=*/false);

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Maybe I'm wrong, but I see you using GetResource on the "Output" buffer, in the code below. Doesn't that mean that this ReadBack bool should remain true?

@Icohedron Icohedron Jul 7, 2026

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.

The "Output" buffer is not being read by the CPU, so the ReadBack bool is false. The "Output" buffer is also in the opaque outer-product-optimal layout, so we shouldn't even try to interpret it without first converting it to a layout we do know how to read.

The GetResource just obtains a handle to be able to refer to the "Output" buffer so that we can record a ConvertLinearAlgebraMatrix command into the command list to tell the GPU to convert it into row-major order and store it into "OutputRowMajor", which the CPU does read back.

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 Exec Tests need to support Matrix Layout Conversion

2 participants