Skip to content

[MLIR][OpenMP] remove now unnecessary getUsedValuesDefinedAbove call from convertTargetOp #72904

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

Merged
merged 1 commit into from
Nov 21, 2023

Conversation

agozillon
Copy link
Contributor

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 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.
@llvmbot
Copy link
Member

llvmbot commented Nov 20, 2023

@llvm/pr-subscribers-mlir-llvm
@llvm/pr-subscribers-mlir
@llvm/pr-subscribers-mlir-openmp

@llvm/pr-subscribers-openmp

Author: None (agozillon)

Changes

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.


Full diff: https://github.com/llvm/llvm-project/pull/72904.diff

1 Files Affected:

  • (modified) mlir/lib/Target/LLVMIR/Dialect/OpenMP/OpenMPToLLVMIRTranslation.cpp (-17)
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));

@agozillon agozillon merged commit 9d26c6b into llvm:main Nov 21, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants