[Mlir-commits] [mlir] [MLIR][OpenMP] Fix the assertion failure for VariableCaptureKind::ByCopy (PR #72424)
Akash Banerjee
llvmlistbot at llvm.org
Wed Nov 15 10:25:44 PST 2023
https://github.com/TIFitis created https://github.com/llvm/llvm-project/pull/72424
None
>From 396b1e4dacee3f3299df14cc24b664adfffe9772 Mon Sep 17 00:00:00 2001
From: Akash Banerjee <Akash.Banerjee at amd.com>
Date: Wed, 15 Nov 2023 18:20:45 +0000
Subject: [PATCH] [MLIR][OpenMP] Fix the assertion failure for
VariableCaptureKind::ByCopy
---
.../OpenMP/OpenMPToLLVMIRTranslation.cpp | 19 +++----------------
1 file changed, 3 insertions(+), 16 deletions(-)
diff --git a/mlir/lib/Target/LLVMIR/Dialect/OpenMP/OpenMPToLLVMIRTranslation.cpp b/mlir/lib/Target/LLVMIR/Dialect/OpenMP/OpenMPToLLVMIRTranslation.cpp
index ae13a745196c42d..c1bc9d42bed75e6 100644
--- a/mlir/lib/Target/LLVMIR/Dialect/OpenMP/OpenMPToLLVMIRTranslation.cpp
+++ b/mlir/lib/Target/LLVMIR/Dialect/OpenMP/OpenMPToLLVMIRTranslation.cpp
@@ -2202,16 +2202,11 @@ createDeviceArgumentAccessor(MapInfoData &mapData, llvm::Argument &arg,
ompBuilder.M.getDataLayout().getProgramAddressSpace();
// Create the alloca for the argument the current point.
- llvm::Value *v =
- builder.CreateAlloca(arg.getType()->isPointerTy()
- ? arg.getType()
- : llvm::Type::getInt64Ty(builder.getContext()),
- ompBuilder.M.getDataLayout().getAllocaAddrSpace());
+ llvm::Value *v = builder.CreateAlloca(arg.getType(), allocaAS);
- if (allocaAS != defaultAS && arg.getType()->isPointerTy()) {
+ if (allocaAS != defaultAS && arg.getType()->isPointerTy())
v = builder.CreatePointerBitCastOrAddrSpaceCast(
v, arg.getType()->getPointerTo(defaultAS));
- }
builder.CreateStore(&arg, v);
@@ -2219,15 +2214,7 @@ createDeviceArgumentAccessor(MapInfoData &mapData, llvm::Argument &arg,
switch (capture) {
case mlir::omp::VariableCaptureKind::ByCopy: {
- // RHS of || aims to ignore conversions like int -> uint, but further
- // extension of this path must be implemented for the moment it'll fall
- // through to the assert.
- if (inputType->isPointerTy() || v->getType() == inputType->getPointerTo()) {
- retVal = v;
- return builder.saveIP();
- }
-
- assert(false && "Currently unsupported OMPTargetVarCaptureByCopy Type");
+ retVal = v;
break;
}
case mlir::omp::VariableCaptureKind::ByRef: {
More information about the Mlir-commits
mailing list