Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve matrices translation with SPV_KHR_untyped_pointers #2857

Open
wants to merge 4 commits into
base: main
Choose a base branch
from

Conversation

vmaksimo
Copy link
Contributor

Ensure that we do correct translation of matrices (SPV_KHR_cooperative_matrix and SPV_INTEL_joint_matrix extensions) when untyped pointers are enabled.
This mainly fixes mangling issues in reverse translation for the untyped pointer.
Also added handling for typed and untyped SPIR-V friendly access chain instructions in forward translation (a point to review and discuss).

@vmaksimo vmaksimo changed the title Fix matrices translation with SPV_KHR_untyped_pointers Improve matrices translation with SPV_KHR_untyped_pointers Nov 13, 2024
; CHECK-SPIRV: UntypedAccessChainKHR [[#TypePtr]] [[#Res:]] [[#TypeMatrix]] [[#VarMatrixPtr]] [[#Const1]]
; CHECK-SPIRV: Store [[#Res]] [[#Const42]]

; CHECK-LLVM: %0 = alloca target("spirv.CooperativeMatrixKHR", i32, 3, 12, 12, 0)
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
; CHECK-LLVM: %0 = alloca target("spirv.CooperativeMatrixKHR", i32, 3, 12, 12, 0)
; CHECK-LLVM: %[[#Matrix:]] = alloca target("spirv.CooperativeMatrixKHR", i32, 3, 12, 12, 0)

and so on

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It's basically just a copy of access_store.ll test :) do we need these checks there too?

else if (RetTy->isVectorTy())
Ty = cast<VectorType>(RetTy)->getElementType();
else
Ty = RetTy;
Copy link
Contributor

Choose a reason for hiding this comment

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

So for store pointer parameter would be considered as void *? If so it doesn't feel right, can we instead query type of the value operand of the store?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Sorry, I don't get this at all. Don't we already query the type from the llvm instructions? Or do you mean specific SPIR-V opcode in mind?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants