aboutsummaryrefslogtreecommitdiff
path: root/flang
diff options
context:
space:
mode:
authorKiran Chandramohan <kiran.chandramohan@arm.com>2025-07-24 21:54:26 +0100
committerGitHub <noreply@github.com>2025-07-24 21:54:26 +0100
commitefe1aa8904ea3ad8b19ab2aa5660e27a08c7d694 (patch)
tree1d235588d796d1c332cb8898f1e79f2cb237b96d /flang
parented9a1027a482d18b3cf063e8bcc6e31a4c7dc024 (diff)
downloadllvm-efe1aa8904ea3ad8b19ab2aa5660e27a08c7d694.zip
llvm-efe1aa8904ea3ad8b19ab2aa5660e27a08c7d694.tar.gz
llvm-efe1aa8904ea3ad8b19ab2aa5660e27a08c7d694.tar.bz2
Revert "[flang][flang-driver][mlir][OpenMP] atomic control support" (#150504)
Reverts llvm/llvm-project#143441 Reverting due to CI failure https://lab.llvm.org/buildbot/#/builders/53/builds/18055.
Diffstat (limited to 'flang')
-rw-r--r--flang/include/flang/Frontend/TargetOptions.h5
-rw-r--r--flang/include/flang/Optimizer/Dialect/Support/FIRContext.h19
-rw-r--r--flang/lib/Frontend/CompilerInvocation.cpp10
-rw-r--r--flang/lib/Lower/Bridge.cpp4
-rw-r--r--flang/lib/Lower/OpenMP/Atomic.cpp9
-rw-r--r--flang/lib/Optimizer/Dialect/Support/FIRContext.cpp51
-rw-r--r--flang/test/Lower/OpenMP/atomic-control-options.f9037
7 files changed, 1 insertions, 134 deletions
diff --git a/flang/include/flang/Frontend/TargetOptions.h b/flang/include/flang/Frontend/TargetOptions.h
index f6e5634..002d8d1 100644
--- a/flang/include/flang/Frontend/TargetOptions.h
+++ b/flang/include/flang/Frontend/TargetOptions.h
@@ -53,11 +53,6 @@ public:
/// Print verbose assembly
bool asmVerbose = false;
-
- /// Atomic control options
- bool atomicIgnoreDenormalMode = false;
- bool atomicRemoteMemory = false;
- bool atomicFineGrainedMemory = false;
};
} // end namespace Fortran::frontend
diff --git a/flang/include/flang/Optimizer/Dialect/Support/FIRContext.h b/flang/include/flang/Optimizer/Dialect/Support/FIRContext.h
index c0c0b74..2df14f8 100644
--- a/flang/include/flang/Optimizer/Dialect/Support/FIRContext.h
+++ b/flang/include/flang/Optimizer/Dialect/Support/FIRContext.h
@@ -58,25 +58,6 @@ void setTargetCPU(mlir::ModuleOp mod, llvm::StringRef cpu);
/// Get the target CPU string from the Module or return a null reference.
llvm::StringRef getTargetCPU(mlir::ModuleOp mod);
-/// Sets whether Denormal Mode can be ignored or not for lowering of floating
-/// point atomic operations.
-void setAtomicIgnoreDenormalMode(mlir::ModuleOp mod, bool value);
-/// Gets whether Denormal Mode can be ignored or not for lowering of floating
-/// point atomic operations.
-bool getAtomicIgnoreDenormalMode(mlir::ModuleOp mod);
-/// Sets whether fine grained memory can be used or not for lowering of atomic
-/// operations.
-void setAtomicFineGrainedMemory(mlir::ModuleOp mod, bool value);
-/// Gets whether fine grained memory can be used or not for lowering of atomic
-/// operations.
-bool getAtomicFineGrainedMemory(mlir::ModuleOp mod);
-/// Sets whether remote memory can be used or not for lowering of atomic
-/// operations.
-void setAtomicRemoteMemory(mlir::ModuleOp mod, bool value);
-/// Gets whether remote memory can be used or not for lowering of atomic
-/// operations.
-bool getAtomicRemoteMemory(mlir::ModuleOp mod);
-
/// Set the tune CPU for the module. `cpu` must not be deallocated while
/// module `mod` is still live.
void setTuneCPU(mlir::ModuleOp mod, llvm::StringRef cpu);
diff --git a/flang/lib/Frontend/CompilerInvocation.cpp b/flang/lib/Frontend/CompilerInvocation.cpp
index 111c5aa4..f55d866 100644
--- a/flang/lib/Frontend/CompilerInvocation.cpp
+++ b/flang/lib/Frontend/CompilerInvocation.cpp
@@ -512,16 +512,6 @@ static void parseTargetArgs(TargetOptions &opts, llvm::opt::ArgList &args) {
args.getLastArg(clang::driver::options::OPT_triple))
opts.triple = a->getValue();
- opts.atomicIgnoreDenormalMode = args.hasFlag(
- clang::driver::options::OPT_fatomic_ignore_denormal_mode,
- clang::driver::options::OPT_fno_atomic_ignore_denormal_mode, false);
- opts.atomicFineGrainedMemory = args.hasFlag(
- clang::driver::options::OPT_fatomic_fine_grained_memory,
- clang::driver::options::OPT_fno_atomic_fine_grained_memory, false);
- opts.atomicRemoteMemory =
- args.hasFlag(clang::driver::options::OPT_fatomic_remote_memory,
- clang::driver::options::OPT_fno_atomic_remote_memory, false);
-
if (const llvm::opt::Arg *a =
args.getLastArg(clang::driver::options::OPT_target_cpu))
opts.cpu = a->getValue();
diff --git a/flang/lib/Lower/Bridge.cpp b/flang/lib/Lower/Bridge.cpp
index ac3669c..92aae79 100644
--- a/flang/lib/Lower/Bridge.cpp
+++ b/flang/lib/Lower/Bridge.cpp
@@ -6733,10 +6733,6 @@ Fortran::lower::LoweringBridge::LoweringBridge(
fir::setKindMapping(*module, kindMap);
fir::setTargetCPU(*module, targetMachine.getTargetCPU());
fir::setTuneCPU(*module, targetOpts.cpuToTuneFor);
- fir::setAtomicIgnoreDenormalMode(*module,
- targetOpts.atomicIgnoreDenormalMode);
- fir::setAtomicFineGrainedMemory(*module, targetOpts.atomicFineGrainedMemory);
- fir::setAtomicRemoteMemory(*module, targetOpts.atomicRemoteMemory);
fir::setTargetFeatures(*module, targetMachine.getTargetFeatureString());
fir::support::setMLIRDataLayout(*module, targetMachine.createDataLayout());
fir::setIdent(*module, Fortran::common::getFlangFullVersion());
diff --git a/flang/lib/Lower/OpenMP/Atomic.cpp b/flang/lib/Lower/OpenMP/Atomic.cpp
index d4f83f5..9a233d2 100644
--- a/flang/lib/Lower/OpenMP/Atomic.cpp
+++ b/flang/lib/Lower/OpenMP/Atomic.cpp
@@ -635,16 +635,9 @@ genAtomicUpdate(lower::AbstractConverter &converter,
}
}
- mlir::ModuleOp module = builder.getModule();
- mlir::omp::AtomicControlAttr atomicControlAttr =
- mlir::omp::AtomicControlAttr::get(
- builder.getContext(), fir::getAtomicIgnoreDenormalMode(module),
- fir::getAtomicFineGrainedMemory(module),
- fir::getAtomicRemoteMemory(module));
builder.restoreInsertionPoint(atomicAt);
auto updateOp = mlir::omp::AtomicUpdateOp::create(
- builder, loc, atomAddr, atomicControlAttr, hint,
- makeMemOrderAttr(converter, memOrder));
+ builder, loc, atomAddr, hint, makeMemOrderAttr(converter, memOrder));
mlir::Region &region = updateOp->getRegion(0);
mlir::Block *block = builder.createBlock(&region, {}, {atomType}, {loc});
diff --git a/flang/lib/Optimizer/Dialect/Support/FIRContext.cpp b/flang/lib/Optimizer/Dialect/Support/FIRContext.cpp
index c2e0afe1..01c0be6 100644
--- a/flang/lib/Optimizer/Dialect/Support/FIRContext.cpp
+++ b/flang/lib/Optimizer/Dialect/Support/FIRContext.cpp
@@ -88,57 +88,6 @@ void fir::setTuneCPU(mlir::ModuleOp mod, llvm::StringRef cpu) {
mod->setAttr(tuneCpuName, mlir::StringAttr::get(ctx, cpu));
}
-static constexpr const char *atomicIgnoreDenormalModeName =
- "fir.atomic_ignore_denormal_mode";
-
-void fir::setAtomicIgnoreDenormalMode(mlir::ModuleOp mod, bool value) {
- if (value) {
- auto *ctx = mod.getContext();
- mod->setAttr(atomicIgnoreDenormalModeName, mlir::UnitAttr::get(ctx));
- } else {
- if (mod->hasAttr(atomicIgnoreDenormalModeName))
- mod->removeAttr(atomicIgnoreDenormalModeName);
- }
-}
-
-bool fir::getAtomicIgnoreDenormalMode(mlir::ModuleOp mod) {
- return mod->hasAttr(atomicIgnoreDenormalModeName);
-}
-
-static constexpr const char *atomicFineGrainedMemoryName =
- "fir.atomic_fine_grained_memory";
-
-void fir::setAtomicFineGrainedMemory(mlir::ModuleOp mod, bool value) {
- if (value) {
- auto *ctx = mod.getContext();
- mod->setAttr(atomicFineGrainedMemoryName, mlir::UnitAttr::get(ctx));
- } else {
- if (mod->hasAttr(atomicFineGrainedMemoryName))
- mod->removeAttr(atomicFineGrainedMemoryName);
- }
-}
-
-bool fir::getAtomicFineGrainedMemory(mlir::ModuleOp mod) {
- return mod->hasAttr(atomicFineGrainedMemoryName);
-}
-
-static constexpr const char *atomicRemoteMemoryName =
- "fir.atomic_remote_memory";
-
-void fir::setAtomicRemoteMemory(mlir::ModuleOp mod, bool value) {
- if (value) {
- auto *ctx = mod.getContext();
- mod->setAttr(atomicRemoteMemoryName, mlir::UnitAttr::get(ctx));
- } else {
- if (mod->hasAttr(atomicRemoteMemoryName))
- mod->removeAttr(atomicRemoteMemoryName);
- }
-}
-
-bool fir::getAtomicRemoteMemory(mlir::ModuleOp mod) {
- return mod->hasAttr(atomicRemoteMemoryName);
-}
-
llvm::StringRef fir::getTuneCPU(mlir::ModuleOp mod) {
if (auto attr = mod->getAttrOfType<mlir::StringAttr>(tuneCpuName))
return attr.getValue();
diff --git a/flang/test/Lower/OpenMP/atomic-control-options.f90 b/flang/test/Lower/OpenMP/atomic-control-options.f90
deleted file mode 100644
index 8f86a15..0000000
--- a/flang/test/Lower/OpenMP/atomic-control-options.f90
+++ /dev/null
@@ -1,37 +0,0 @@
-! RUN: %flang_fc1 -emit-hlfir -triple amdgcn-amd-amdhsa -fopenmp -fopenmp-is-device -munsafe-fp-atomics %s -o - | FileCheck -check-prefix=UNSAFE-FP-ATOMICS %s
-! RUN: %flang_fc1 -emit-hlfir -triple amdgcn-amd-amdhsa -fopenmp -fopenmp-is-device -fatomic-ignore-denormal-mode %s -o - | FileCheck -check-prefix=IGNORE-DENORMAL %s
-! RUN: %flang_fc1 -emit-hlfir -triple amdgcn-amd-amdhsa -fopenmp -fopenmp-is-device -fatomic-fine-grained-memory %s -o - | FileCheck -check-prefix=FINE-GRAINED-MEMORY %s
-! RUN: %flang_fc1 -emit-hlfir -triple amdgcn-amd-amdhsa -fopenmp -fopenmp-is-device -fatomic-remote-memory %s -o - | FileCheck -check-prefix=REMOTE-MEMORY %s
-program test
- implicit none
- integer :: A, B, threads
- threads = 128
- A = 0
- B = 0
- !UNSAFE-FP-ATOMICS: omp.atomic.update %{{.*}} : !fir.ref<i32> {
- !UNSAFE-FP-ATOMICS: } {atomic_control = #omp.atomic_control<ignore_denormal_mode = true>}
- !IGNORE-DENORMAL: omp.atomic.update %{{.*}} : !fir.ref<i32> {
- !IGNORE-DENORMAL: } {atomic_control = #omp.atomic_control<ignore_denormal_mode = true>}
- !FINE-GRAINED-MEMORY: omp.atomic.update %{{.*}} : !fir.ref<i32> {
- !FINE-GRAINED-MEMORY: } {atomic_control = #omp.atomic_control<fine_grained_memory = true>}
- !REMOTE-MEMORY: omp.atomic.update %{{.*}} : !fir.ref<i32> {
- !REMOTE-MEMORY: } {atomic_control = #omp.atomic_control<remote_memory = true>}
- !$omp target parallel num_threads(threads)
- !$omp atomic
- A = A + 1
- !$omp end target parallel
- !UNSAFE-FP-ATOMICS: omp.atomic.update %{{.*}} : !fir.ref<i32> {
- !UNSAFE-FP-ATOMICS: } {atomic_control = #omp.atomic_control<ignore_denormal_mode = true>}
- !IGNORE-DENORMAL: omp.atomic.update %{{.*}} : !fir.ref<i32> {
- !IGNORE-DENORMAL: } {atomic_control = #omp.atomic_control<ignore_denormal_mode = true>}
- !FINE-GRAINED-MEMORY: omp.atomic.update %{{.*}} : !fir.ref<i32> {
- !FINE-GRAINED-MEMORY: } {atomic_control = #omp.atomic_control<fine_grained_memory = true>}
- !REMOTE-MEMORY: omp.atomic.update %{{.*}} : !fir.ref<i32> {
- !REMOTE-MEMORY: } {atomic_control = #omp.atomic_control<remote_memory = true>}
- !$omp target parallel num_threads(threads)
- !$omp atomic capture
- A = A + B
- B = A
- !$omp end atomic
- !$omp end target parallel
-end program test