Skip to content

Conversation

@V-FEXrt
Copy link
Collaborator

@V-FEXrt V-FEXrt commented Dec 31, 2025

Similar to #8015 this PR reserved HL opcodes for the HLSL intrinsics required for the LinAlg feature.

The Codegen for each function is set to EmptyLower which raises a not implemented error if the intrinsic is seen.

lib/HLSL/HLOperationLower.cpp and utils/hct/gen_intrin_main.txt are the real changes, the rest is generated code.

@github-actions
Copy link
Contributor

github-actions bot commented Dec 31, 2025

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

You can test this locally with the following command:
git-clang-format --diff 8e2e89998ac12cc346cc00cd119fe5b709139af8 25fd2c81cf8fa5dfd7cececf0ec12ed6178f7ccc -- include/dxc/HlslIntrinsicOp.h lib/HLSL/HLOperationLower.cpp
View the diff from clang-format here.
diff --git a/lib/HLSL/HLOperationLower.cpp b/lib/HLSL/HLOperationLower.cpp
index 774a6bf6..956ac2ca 100644
--- a/lib/HLSL/HLOperationLower.cpp
+++ b/lib/HLSL/HLOperationLower.cpp
@@ -7563,8 +7563,8 @@ constexpr IntrinsicLower gLowerTable[] = {
      DXIL::OpCode::MatrixAccumulate},
     {IntrinsicOp::IOP___builtin_LinAlg_MatrixMatrixMultiply, EmptyLower,
      DXIL::OpCode::MatrixMulOp},
-    {IntrinsicOp::IOP___builtin_LinAlg_MatrixMatrixMultiplyAccumulate, EmptyLower,
-     DXIL::OpCode::MatrixMulOp},
+    {IntrinsicOp::IOP___builtin_LinAlg_MatrixMatrixMultiplyAccumulate,
+     EmptyLower, DXIL::OpCode::MatrixMulOp},
     {IntrinsicOp::IOP___builtin_LinAlg_MatrixQueryAccumulatorLayout, EmptyLower,
      DXIL::OpCode::MatrixQueryAccumulatorLayout},
     {IntrinsicOp::IOP___builtin_LinAlg_MatrixAccumulateToDescriptor, EmptyLower,
  • Check this box to apply formatting changes to this branch.

Copy link
Collaborator

@bob80905 bob80905 left a comment

Choose a reason for hiding this comment

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

LGTM, only thing I can think of is whether or not issues should be made for your todo's.

@V-FEXrt
Copy link
Collaborator Author

V-FEXrt commented Dec 31, 2025

I'm leaning towards no on issues for the TODOs because they essentially already exist!

There is an issue for each intrinsic already filed (#7895 as an example) and in order for all those intrinsic issues to be closed all the todos in this PR would need to be resolved.

Do you think that is good enough or would you still like separate issues?

(also a peak behind the veil, I have already fixed a lot of the TODOs in my local changes)

Copy link

@inbelic inbelic left a comment

Choose a reason for hiding this comment

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

Two little nits, otherwise LGTM

IOP_WorldToObject = 99,
IOP_WorldToObject3x4 = 100,
IOP_WorldToObject4x3 = 101,
IOP___builtin_LinAlg_CopyConvertMatrix = 405,
Copy link

Choose a reason for hiding this comment

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

nit: Is there a required order for these? In the other files they seemed to be sorted by opcode

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Ah yeah, this is an interesting topic. There is some info below but there are a lot of moving parts. Happy to chat more if below is unclear

  • This is generated code, and this is where it was placed by the generator
  • They are actually ordered, but they are ordered alphabetically not by opcode value. The extra __ for __builtin somewhat hides that fact since it's not visually obvious
  • The values here are internal so they can be renumbered without issue but it was decided they shouldn't be

This may raise the question "how is it that 99% of the opcodes have the number that matches their alphabetic order" to which the answer is: until very recently the generator would renumber every opcode any time a new intrinsic was added. This created a lot of ordering churn, large diffs, and merge conflicts and was generally not a good thing to be doing so it was turned off

Copy link

Choose a reason for hiding this comment

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

I see, sounds good

@bob80905
Copy link
Collaborator

I'm leaning towards no on issues for the TODOs because they essentially already exist!

There is an issue for each intrinsic already filed (#7895 as an example) and in order for all those intrinsic issues to be closed all the todos in this PR would need to be resolved.

Do you think that is good enough or would you still like separate issues?

(also a peak behind the veil, I have already fixed a lot of the TODOs in my local changes)

Sounds good enough to me

@V-FEXrt V-FEXrt merged commit b678d82 into main Dec 31, 2025
11 checks passed
@V-FEXrt V-FEXrt deleted the linalg-staging-pr branch December 31, 2025 21:50
@github-project-automation github-project-automation bot moved this from New to Done in HLSL Roadmap Dec 31, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

4 participants