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

[SPIR-V] Address space casting via a Generic pointer as an intermediary creates a wrong Generic pointer type #96170

Closed
VyacheslavLevytskyy opened this issue Jun 20, 2024 · 0 comments · Fixed by #96091
Assignees

Comments

@VyacheslavLevytskyy
Copy link
Contributor

When creating a Generic pointer type as an intermediary for address space casting (

bool SPIRVInstructionSelector::selectAddrSpaceCast(Register ResVReg,
) a wrong type is generated. Namely, the source ptr is treated as if it's a pointee type. We must fetch a pointee type instead first, and use it as a base for creation of a new Generic pointer type.

The next is a reproducer:

define spir_kernel void @foo(ptr addrspace(1) %arg) {
entry:
  %p = addrspacecast ptr addrspace(1) %arg to ptr addrspace(3)
  ret void
}

spirv-val complain looks like

error: line 28: Expected input and Result Type to point to the same type: PtrCastToGeneric
  %13 = OpPtrCastToGeneric %_ptr_Generic__ptr_CrossWorkgroup_uchar %12

As we see a new Generic pointer type points to a pointer and that's wrong.

@VyacheslavLevytskyy VyacheslavLevytskyy self-assigned this Jun 20, 2024
AlexisPerry pushed a commit to llvm-project-tlp/llvm-project that referenced this issue Jul 9, 2024
This PR adds SPIR-V extension SPV_KHR_cooperative_matrix that "adds a
new set of types known as "cooperative matrix" types, where the storage
for and computations performed on the matrix are spread across a set of
invocations such as a subgroup" (see
https://github.com/KhronosGroup/SPIRV-Registry/blob/main/extensions/KHR/SPV_KHR_cooperative_matrix.asciidoc).

This PR also fixes llvm#96170, a
new test cases is attached
(llvm/test/CodeGen/SPIRV/transcoding/OpPtrCastToGeneric.ll).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants