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 3 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 3 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

github-actions Bot commented Jul 6, 2026

Copy link
Copy Markdown
Contributor

⚠️ C/C++ code formatter, clang-format found issues in your code. ⚠️

You can test this locally with the following command:
git-clang-format --diff 3fe4b7da73b485aa692560c329be9148353893ae c5f5a561b8c97a80982f3de0967bbd0556900ed2 -- tools/clang/unittests/HLSLExec/HlslExecTestUtils.cpp tools/clang/unittests/HLSLExec/HlslExecTestUtils.h tools/clang/unittests/HLSLExec/LinAlgTests.cpp tools/clang/unittests/HLSLExec/ShaderOpTest.cpp tools/clang/unittests/HLSLExec/ShaderOpTest.h
View the diff from clang-format here.
diff --git a/tools/clang/unittests/HLSLExec/HlslExecTestUtils.cpp b/tools/clang/unittests/HLSLExec/HlslExecTestUtils.cpp
index 0a08506b..9453eb13 100644
--- a/tools/clang/unittests/HLSLExec/HlslExecTestUtils.cpp
+++ b/tools/clang/unittests/HLSLExec/HlslExecTestUtils.cpp
@@ -839,7 +839,8 @@ void recordLinAlgMatrixConversion(
   Barrier.Transition.pResource = SrcBuffer;
   Barrier.Transition.Subresource = D3D12_RESOURCE_BARRIER_ALL_SUBRESOURCES;
   Barrier.Transition.StateBefore = D3D12_RESOURCE_STATE_UNORDERED_ACCESS;
-  Barrier.Transition.StateAfter = D3D12_RESOURCE_STATE_NON_PIXEL_SHADER_RESOURCE;
+  Barrier.Transition.StateAfter =
+      D3D12_RESOURCE_STATE_NON_PIXEL_SHADER_RESOURCE;
   List->ResourceBarrier(1, &Barrier);
 
   D3D12_LINEAR_ALGEBRA_MATRIX_CONVERSION_INFO Info = {};
  • Check this box to apply formatting changes to this branch.

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

1 participant