[Mlir-commits] [mlir] [MLIR][OpenMP] remove now unnecessary getUsedValuesDefinedAbove call from convertTargetOp (PR #72904)

llvmlistbot at llvm.org llvmlistbot at llvm.org
Mon Nov 20 11:22:13 PST 2023


https://github.com/agozillon created https://github.com/llvm/llvm-project/pull/72904

This block of code was here to create pseudo handling of implicit captures in target regions to prevent gfortran test regressions and allow certain pieces of code to function, however, with the introduction of the IFA patch which adds proper handling of implicits by adding them to the map operands list alongside explicit mappings at the initial Fortran -> MLIR generation phase this should no longer be required and may cause some adverse affects at worse in the future.

>From 972f29bc44564a2b603117476c10cae79e276dd8 Mon Sep 17 00:00:00 2001
From: Andrew Gozillon <Andrew.Gozillon at amd.com>
Date: Mon, 20 Nov 2023 12:24:48 -0600
Subject: [PATCH] [MLIR][OpenMP] remove now unneccesary
 getUsedValuesDefinedAbove call from convertTargetOp

This block of code was here to create pseudo
handling of implicit captures in target regions
to prevent gfortran test regressions and allow
certain pieces of code to function, however,
with the introduction of the IFA patch which
adds Fortran level handling of these and adds
them to the map operands this is no longer
required.
---
 .../OpenMP/OpenMPToLLVMIRTranslation.cpp        | 17 -----------------
 1 file changed, 17 deletions(-)

diff --git a/mlir/lib/Target/LLVMIR/Dialect/OpenMP/OpenMPToLLVMIRTranslation.cpp b/mlir/lib/Target/LLVMIR/Dialect/OpenMP/OpenMPToLLVMIRTranslation.cpp
index ae13a745196c42d..b1305201166a035 100644
--- a/mlir/lib/Target/LLVMIR/Dialect/OpenMP/OpenMPToLLVMIRTranslation.cpp
+++ b/mlir/lib/Target/LLVMIR/Dialect/OpenMP/OpenMPToLLVMIRTranslation.cpp
@@ -2445,23 +2445,6 @@ convertOmpTarget(Operation &opInst, llvm::IRBuilderBase &builder,
       kernelInput.push_back(mapData.OriginalValue[i]);
   }
 
-  // Do some very basic handling of implicit captures that are caught
-  // by use in the target region.
-  // TODO/FIXME: Remove on addition of IsolatedFromAbove patch series
-  // as this will become redundant and perhaps erroneous in cases
-  // where more complex implicit capture semantics are required.
-  llvm::SetVector<Value> uses;
-  getUsedValuesDefinedAbove(targetRegion, uses);
-
-  for (mlir::Value use : uses) {
-    llvm::Value *useValue = moduleTranslation.lookupValue(use);
-    if (useValue &&
-        !std::any_of(
-            mapData.OriginalValue.begin(), mapData.OriginalValue.end(),
-            [&](llvm::Value *mapValue) { return mapValue == useValue; }))
-      kernelInput.push_back(useValue);
-  }
-
   builder.restoreIP(moduleTranslation.getOpenMPBuilder()->createTarget(
       ompLoc, allocaIP, builder.saveIP(), entryInfo, defaultValTeams,
       defaultValThreads, kernelInput, genMapInfoCB, bodyCB, argAccessorCB));



More information about the Mlir-commits mailing list