-
Notifications
You must be signed in to change notification settings - Fork 14.9k
[Flang][Flang-Driver]Fix to add atomic control options in non-fc1 mode #154638
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
Conversation
@llvm/pr-subscribers-flang-driver @llvm/pr-subscribers-clang-driver Author: Anchu Rajendran S (anchuraj) ChangesFix enables options in non-fc1 mode. The changes, #151579, #150860 enabled it only in fc1 mode. Full diff: https://github.com/llvm/llvm-project/pull/154638.diff 2 Files Affected:
diff --git a/clang/lib/Driver/ToolChains/Flang.cpp b/clang/lib/Driver/ToolChains/Flang.cpp
index 65391033c2b9f..1535f4cebf436 100644
--- a/clang/lib/Driver/ToolChains/Flang.cpp
+++ b/clang/lib/Driver/ToolChains/Flang.cpp
@@ -534,7 +534,14 @@ void Flang::addTargetOptions(const ArgList &Args,
}
Args.addAllArgs(CmdArgs,
- {options::OPT_fverbose_asm, options::OPT_fno_verbose_asm});
+ {options::OPT_fverbose_asm, options::OPT_fno_verbose_asm,
+ options::OPT_fatomic_ignore_denormal_mode,
+ options::OPT_fno_atomic_ignore_denormal_mode,
+ options::OPT_fatomic_fine_grained_memory,
+ options::OPT_fno_atomic_fine_grained_memory,
+ options::OPT_fatomic_remote_memory,
+ options::OPT_fno_atomic_remote_memory,
+ options::OPT_munsafe_fp_atomics});
}
void Flang::addOffloadOptions(Compilation &C, const InputInfoList &Inputs,
diff --git a/flang/test/Driver/atomic-control-options.f90 b/flang/test/Driver/atomic-control-options.f90
index cb382f96a9d5f..3251896033c25 100644
--- a/flang/test/Driver/atomic-control-options.f90
+++ b/flang/test/Driver/atomic-control-options.f90
@@ -1,8 +1,12 @@
! REQUIRES: amdgpu-registered-target
! RUN: %flang_fc1 -emit-llvm -triple amdgcn-amd-amdhsa -fopenmp -fopenmp-is-device -munsafe-fp-atomics %s -o -|FileCheck -check-prefix=UNSAFE-FP-ATOMICS %s
+! RUN: %flang --offload-arch=gfx90a --offload-device-only -fopenmp -emit-llvm -S %s -munsafe-fp-atomics -o -|FileCheck -check-prefix=UNSAFE-FP-ATOMICS %s
! RUN: %flang_fc1 -emit-llvm -triple amdgcn-amd-amdhsa -fopenmp -fopenmp-is-device -fatomic-ignore-denormal-mode %s -o -|FileCheck -check-prefix=IGNORE-DENORMAL-MODE %s
+! RUN: %flang --offload-arch=gfx90a --offload-device-only -fopenmp -emit-llvm -S %s -fatomic-ignore-denormal-mode -o -|FileCheck -check-prefix=IGNORE-DENORMAL-MODE %s
! RUN: %flang_fc1 -emit-llvm -triple amdgcn-amd-amdhsa -fopenmp -fopenmp-is-device -fatomic-fine-grained-memory %s -o -|FileCheck -check-prefix=FINE-GRAINED-MEMORY %s
+! RUN: %flang --offload-arch=gfx90a --offload-device-only -fopenmp -emit-llvm -S %s -fatomic-fine-grained-memory -o -|FileCheck -check-prefix=FINE-GRAINED-MEMORY %s
! RUN: %flang_fc1 -emit-llvm -triple amdgcn-amd-amdhsa -fopenmp -fopenmp-is-device -fatomic-remote-memory %s -o -|FileCheck -check-prefix=REMOTE-MEMORY %s
+! RUN: %flang --offload-arch=gfx90a --offload-device-only -fopenmp -emit-llvm -S %s -fatomic-remote-memory -o -|FileCheck -check-prefix=REMOTE-MEMORY %s
program test
implicit none
integer :: A, threads
|
@llvm/pr-subscribers-clang Author: Anchu Rajendran S (anchuraj) ChangesFix enables options in non-fc1 mode. The changes, #151579, #150860 enabled it only in fc1 mode. Full diff: https://github.com/llvm/llvm-project/pull/154638.diff 2 Files Affected:
diff --git a/clang/lib/Driver/ToolChains/Flang.cpp b/clang/lib/Driver/ToolChains/Flang.cpp
index 65391033c2b9f..1535f4cebf436 100644
--- a/clang/lib/Driver/ToolChains/Flang.cpp
+++ b/clang/lib/Driver/ToolChains/Flang.cpp
@@ -534,7 +534,14 @@ void Flang::addTargetOptions(const ArgList &Args,
}
Args.addAllArgs(CmdArgs,
- {options::OPT_fverbose_asm, options::OPT_fno_verbose_asm});
+ {options::OPT_fverbose_asm, options::OPT_fno_verbose_asm,
+ options::OPT_fatomic_ignore_denormal_mode,
+ options::OPT_fno_atomic_ignore_denormal_mode,
+ options::OPT_fatomic_fine_grained_memory,
+ options::OPT_fno_atomic_fine_grained_memory,
+ options::OPT_fatomic_remote_memory,
+ options::OPT_fno_atomic_remote_memory,
+ options::OPT_munsafe_fp_atomics});
}
void Flang::addOffloadOptions(Compilation &C, const InputInfoList &Inputs,
diff --git a/flang/test/Driver/atomic-control-options.f90 b/flang/test/Driver/atomic-control-options.f90
index cb382f96a9d5f..3251896033c25 100644
--- a/flang/test/Driver/atomic-control-options.f90
+++ b/flang/test/Driver/atomic-control-options.f90
@@ -1,8 +1,12 @@
! REQUIRES: amdgpu-registered-target
! RUN: %flang_fc1 -emit-llvm -triple amdgcn-amd-amdhsa -fopenmp -fopenmp-is-device -munsafe-fp-atomics %s -o -|FileCheck -check-prefix=UNSAFE-FP-ATOMICS %s
+! RUN: %flang --offload-arch=gfx90a --offload-device-only -fopenmp -emit-llvm -S %s -munsafe-fp-atomics -o -|FileCheck -check-prefix=UNSAFE-FP-ATOMICS %s
! RUN: %flang_fc1 -emit-llvm -triple amdgcn-amd-amdhsa -fopenmp -fopenmp-is-device -fatomic-ignore-denormal-mode %s -o -|FileCheck -check-prefix=IGNORE-DENORMAL-MODE %s
+! RUN: %flang --offload-arch=gfx90a --offload-device-only -fopenmp -emit-llvm -S %s -fatomic-ignore-denormal-mode -o -|FileCheck -check-prefix=IGNORE-DENORMAL-MODE %s
! RUN: %flang_fc1 -emit-llvm -triple amdgcn-amd-amdhsa -fopenmp -fopenmp-is-device -fatomic-fine-grained-memory %s -o -|FileCheck -check-prefix=FINE-GRAINED-MEMORY %s
+! RUN: %flang --offload-arch=gfx90a --offload-device-only -fopenmp -emit-llvm -S %s -fatomic-fine-grained-memory -o -|FileCheck -check-prefix=FINE-GRAINED-MEMORY %s
! RUN: %flang_fc1 -emit-llvm -triple amdgcn-amd-amdhsa -fopenmp -fopenmp-is-device -fatomic-remote-memory %s -o -|FileCheck -check-prefix=REMOTE-MEMORY %s
+! RUN: %flang --offload-arch=gfx90a --offload-device-only -fopenmp -emit-llvm -S %s -fatomic-remote-memory -o -|FileCheck -check-prefix=REMOTE-MEMORY %s
program test
implicit none
integer :: A, threads
|
c04807b
to
f8a77d7
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM. Thanks
@anchuraj Our AIX build has the default LLVM_TARGETS_TO_BUILD setting which registered all targets so we can have the extended test coverage. The reason of the failure is that the offload option triggered the call to
Would it be possible to split this test case into two; one for the host and one for the offload? |
|
Fix enables atomic control options in non-fc1 mode. The changes, #151579, #150860 enabled it only in fc1 mode.
The options used are:
-f[no-]atomic-remote-memory
,-f[no-]atomic-fine-grained-memory
,-f[no-]atomic-ignore-denormal-mode
.Legacy option
-m[no-]unsafe-fp-atomics
is aliased to-f[no-]ignore-denormal-mode
.More details can be found in #102569.