| Issue |
184638
|
| Summary |
[SPIR-V] Vector of pointers are rejected by the backend
|
| Labels |
crash-on-valid,
backend:SPIR-V,
SPIR-V
|
| Assignees |
|
| Reporter |
MrSidims
|
Small reproducer:
```
declare spir_func void @foo(<2 x i64>)
define spir_kernel void @test_ptrtoaddr(<2 x ptr addrspace(1)> %p, <2 x ptr addrspace(1)> %res) {
entry:
%addr = ptrtoint <2 x ptr addrspace(1)> %p to <2 x i64>
call void @foo(<2 x i64> %addr)
ret void
}
```
results in assertion to fire:
llvm/lib/Target/SPIRV/SPIRVGlobalRegistry.cpp:321: llvm::SPIRVTypeInst llvm::SPIRVGlobalRegistry::getOpTypeVector(uint32_t, llvm::SPIRVTypeInst, llvm::MachineIRBuilder&): Assertion `(EleOpc == SPIRV::OpTypeInt || EleOpc == SPIRV::OpTypeFloat || EleOpc == SPIRV::OpTypeBool) && "Invalid vector element type"' failed.
PLEASE submit a bug report to https://github.com/llvm/llvm-project/issues/ and include the crash backtrace and instructions to reproduce the bug
**Details**:
The assertion is legit, as per SPIR-V core specification vector of pointers are not supported. Yet backend should be still able to resolve the unsupported types. I see 2 ways of solving the issue (and both should be implemented)(but may be there are better options):
1. The restriction is lifted off by [SPV_INTEL_masked_gather_scatter](https://github.com/KhronosGroup/SPIRV-Registry/blob/main/extensions/INTEL/SPV_INTEL_masked_gather_scatter.asciidoc) extension, hence `TypeVector` with pointer element type should be emitted if it's enabled. There was a [WIP PR](https://github.com/llvm/llvm-project/pull/131566) for this, but I do not expect any progress on that;
2. If the extension is disabled, still a vector of pointers should be lowered, but now to a chain of scalar instructions. I'm not sure about `GlobalISel`, but `SelectionDAG` is providing `UnrollVectorOp` utility to unroll vectors into scalars.
_______________________________________________
llvm-bugs mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs