Skip to content
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

[flang][driver] Increase default -fopenmp-version to 52 #170

Merged
merged 3 commits into from
Sep 30, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion flang/include/flang/Tools/CrossToolHelpers.h
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,7 @@ struct OffloadModuleOpts {
bool OpenMPIsTargetDevice = false;
bool OpenMPIsGPU = false;
bool OpenMPForceUSM = false;
uint32_t OpenMPVersion = 11;
uint32_t OpenMPVersion = 52;
std::string OMPHostIRFile = {};
std::vector<llvm::Triple> OMPTargetTriples = {};
bool NoGPULib = false;
Expand Down
4 changes: 2 additions & 2 deletions flang/lib/Frontend/CompilerInvocation.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1015,8 +1015,8 @@ static bool parseOpenMPArgs(CompilerInvocation &res, llvm::opt::ArgList &args,
unsigned numErrorsBefore = diags.getNumErrors();
llvm::Triple t(res.getTargetOpts().triple);

// By default OpenMP is set to 1.1 version
res.getLangOpts().OpenMPVersion = 11;
// By default OpenMP is set to 5.2 version
res.getLangOpts().OpenMPVersion = 52;
res.getFrontendOpts().features.Enable(
Fortran::common::LanguageFeature::OpenMP);
if (int Version = getLastArgIntValue(
Expand Down
2 changes: 1 addition & 1 deletion flang/test/Driver/bbc-openmp-version-macro.f90
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
! RUN: bbc -fopenmp -fopenmp-version=51 -o - %s | FileCheck %s --check-prefix=OPENMP-VERSION-51
! RUN: bbc -fopenmp -fopenmp-version=52 -o - %s | FileCheck %s --check-prefix=OPENMP-VERSION-52

! DEFAULT-OPENMP-VERSION: {{.*}} = arith.constant 199911 : i32
! DEFAULT-OPENMP-VERSION: {{.*}} = arith.constant 202111 : i32
! OPENMP-VERSION-11: {{.*}} = arith.constant 199911 : i32
! OPENMP-VERSION-20: {{.*}} = arith.constant 200011 : i32
! OPENMP-VERSION-25: {{.*}} = arith.constant 200505 : i32
Expand Down
2 changes: 1 addition & 1 deletion flang/test/Driver/flang-openmp-version-macro.f90
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
! RUN: %flang_fc1 -fopenmp -fopenmp-version=51 -cpp -E %s | FileCheck %s --check-prefix=OPENMP-VERSION-51
! RUN: %flang_fc1 -fopenmp -fopenmp-version=52 -cpp -E %s | FileCheck %s --check-prefix=OPENMP-VERSION-52

! DEFAULT-OPENMP-VERSION: integer :: var1 = 199911
! DEFAULT-OPENMP-VERSION: integer :: var1 = 202111
! OPENMP-VERSION-11: integer :: var1 = 199911
! OPENMP-VERSION-20: integer :: var1 = 200011
! OPENMP-VERSION-25: integer :: var1 = 200505
Expand Down
16 changes: 8 additions & 8 deletions flang/test/Lower/OpenMP/rtl-flags.f90
Original file line number Diff line number Diff line change
Expand Up @@ -20,20 +20,20 @@
!RUN: bbc -emit-hlfir -fopenmp -fopenmp-assume-no-nested-parallelism -fopenmp-is-target-device -o - %s | FileCheck %s --check-prefix=NEST-PAR-DEVICE-FIR
!RUN: bbc -emit-hlfir -fopenmp -fopenmp-target-debug=1 -fopenmp-assume-teams-oversubscription -fopenmp-assume-no-nested-parallelism -fopenmp-assume-threads-oversubscription -fopenmp-assume-no-thread-state -fopenmp-is-target-device -o - %s | FileCheck %s --check-prefix=ALL-DEVICE-FIR

!DEFAULT-DEVICE-FIR: module attributes {{{.*}}omp.flags = #omp.flags<openmp_device_version = 11>
!DEFAULT-DEVICE-FIR: module attributes {{{.*}}omp.flags = #omp.flags<openmp_device_version = 52>
!DEFAULT-DEVICE-FIR-SAME: omp.is_target_device = true
!DEFAULT-DEVICE-FIR-VERSION: module attributes {{{.*}}omp.flags = #omp.flags<openmp_device_version = 45>
!DEFAULT-DEVICE-FIR-VERSION-SAME: omp.is_target_device = true
!DEFAULT-DEVICE-FIR-VERSION-SAME: omp.version = #omp.version<version = 45>
!DEFAULT-HOST-FIR: module attributes {{{.*}}omp.is_target_device = false{{.*}}
!DEFAULT-HOST-FIR-VERSION: module attributes {{{.*}}omp.is_target_device = false
!DEFAULT-HOST-FIR-VERSION-SAME: omp.version = #omp.version<version = 45>
!DBG-DEVICE-FIR: module attributes {{{.*}}omp.flags = #omp.flags<debug_kind = 1, openmp_device_version = 11>
!DBG-EQ-DEVICE-FIR: module attributes {{{.*}}omp.flags = #omp.flags<debug_kind = 111, openmp_device_version = 11>
!TEAMS-OSUB-DEVICE-FIR: module attributes {{{.*}}omp.flags = #omp.flags<assume_teams_oversubscription = true, openmp_device_version = 11>
!THREAD-OSUB-DEVICE-FIR: module attributes {{{.*}}omp.flags = #omp.flags<assume_threads_oversubscription = true, openmp_device_version = 11>
!THREAD-STATE-DEVICE-FIR: module attributes {{{.*}}omp.flags = #omp.flags<assume_no_thread_state = true, openmp_device_version = 11>
!NEST-PAR-DEVICE-FIR: module attributes {{{.*}}omp.flags = #omp.flags<assume_no_nested_parallelism = true, openmp_device_version = 11>
!ALL-DEVICE-FIR: module attributes {{{.*}}omp.flags = #omp.flags<debug_kind = 1, assume_teams_oversubscription = true, assume_threads_oversubscription = true, assume_no_thread_state = true, assume_no_nested_parallelism = true, openmp_device_version = 11>
!DBG-DEVICE-FIR: module attributes {{{.*}}omp.flags = #omp.flags<debug_kind = 1, openmp_device_version = 52>
!DBG-EQ-DEVICE-FIR: module attributes {{{.*}}omp.flags = #omp.flags<debug_kind = 111, openmp_device_version = 52>
!TEAMS-OSUB-DEVICE-FIR: module attributes {{{.*}}omp.flags = #omp.flags<assume_teams_oversubscription = true, openmp_device_version = 52>
!THREAD-OSUB-DEVICE-FIR: module attributes {{{.*}}omp.flags = #omp.flags<assume_threads_oversubscription = true, openmp_device_version = 52>
!THREAD-STATE-DEVICE-FIR: module attributes {{{.*}}omp.flags = #omp.flags<assume_no_thread_state = true, openmp_device_version = 52>
!NEST-PAR-DEVICE-FIR: module attributes {{{.*}}omp.flags = #omp.flags<assume_no_nested_parallelism = true, openmp_device_version = 52>
!ALL-DEVICE-FIR: module attributes {{{.*}}omp.flags = #omp.flags<debug_kind = 1, assume_teams_oversubscription = true, assume_threads_oversubscription = true, assume_no_thread_state = true, assume_no_nested_parallelism = true, openmp_device_version = 52>
subroutine omp_subroutine()
end subroutine omp_subroutine
2 changes: 1 addition & 1 deletion flang/tools/bbc/bbc.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,7 @@ static llvm::cl::list<std::string> targetTriplesOpenMP(
static llvm::cl::opt<uint32_t>
setOpenMPVersion("fopenmp-version",
llvm::cl::desc("OpenMP standard version"),
llvm::cl::init(11));
llvm::cl::init(52));

static llvm::cl::opt<uint32_t> setOpenMPTargetDebug(
"fopenmp-target-debug",
Expand Down