[Mlir-commits] [mlir] Skip address space checks for memrefs between launchOp and kernel func (PR #102925)
Petr Kurapov
llvmlistbot at llvm.org
Mon Aug 12 10:11:20 PDT 2024
================
@@ -401,8 +401,29 @@ LogicalResult GPUDialect::verifyOperationAttribute(Operation *op,
<< expectedNumArguments;
auto functionType = kernelGPUFunction.getFunctionType();
+ auto typesMatch = [&](Type launchOpArgType, Type gpuFuncArgType) {
+ auto launchOpMemref = dyn_cast<MemRefType>(launchOpArgType);
+ auto kernelMemref = dyn_cast<MemRefType>(gpuFuncArgType);
+ // Allow address space incompatibility for OpenCL kernels: `gpu.launch`'s
+ // argument memref without address space attribute will match a kernel
+ // function's memref argument with address space `Global`.
+ if (launchOpMemref && kernelMemref) {
+ auto launchAS = llvm::dyn_cast_or_null<gpu::AddressSpaceAttr>(
+ launchOpMemref.getMemorySpace());
+ auto kernelAS = llvm::dyn_cast_or_null<gpu::AddressSpaceAttr>(
+ kernelMemref.getMemorySpace());
+ if (!launchAS && kernelAS &&
+ kernelAS.getValue() == gpu::AddressSpace::Global)
----------------
kurapov-peter wrote:
> Can't you also pass a pointer to workgroup (aka local, shared) memory here from the host?
Not sure, what would it mean? I.e. what's the expected behavior?
https://github.com/llvm/llvm-project/pull/102925
More information about the Mlir-commits
mailing list