diff options
author | Andrew Gozillon <Andrew.Gozillon@amd.com> | 2023-07-18 15:08:58 -0500 |
---|---|---|
committer | Andrew Gozillon <Andrew.Gozillon@amd.com> | 2023-07-18 15:18:35 -0500 |
commit | 64f5a7642a05fc13f1931197c8a474d244179a83 (patch) | |
tree | ac46922c33e63aae6ba83afb9f5dc09cb553ba0b /flang | |
parent | 5bba1763663b29cacdae253825b5955a014ef022 (diff) | |
download | llvm-64f5a7642a05fc13f1931197c8a474d244179a83.zip llvm-64f5a7642a05fc13f1931197c8a474d244179a83.tar.gz llvm-64f5a7642a05fc13f1931197c8a474d244179a83.tar.bz2 |
[Flang][OpenMP] Disable function filtering for host
This should be a temporary fix while we work
towards enabling function filtering for host
again via a future patch.
Diffstat (limited to 'flang')
-rw-r--r-- | flang/lib/Frontend/FrontendActions.cpp | 9 | ||||
-rw-r--r-- | flang/test/Lower/OpenMP/function-filtering-2.f90 | 38 | ||||
-rw-r--r-- | flang/test/Lower/OpenMP/function-filtering.f90 | 7 |
3 files changed, 50 insertions, 4 deletions
diff --git a/flang/lib/Frontend/FrontendActions.cpp b/flang/lib/Frontend/FrontendActions.cpp index 7c44b46..d1158cb 100644 --- a/flang/lib/Frontend/FrontendActions.cpp +++ b/flang/lib/Frontend/FrontendActions.cpp @@ -311,9 +311,14 @@ bool CodeGenAction::beginSourceFileAction() { isDevice = offloadMod.getIsTargetDevice(); pm.addPass(fir::createOMPMarkDeclareTargetPass()); - if (isDevice) + if (isDevice) { pm.addPass(fir::createOMPEarlyOutliningPass()); - pm.addPass(fir::createOMPFunctionFilteringPass()); + // FIXME: This should eventually be moved out of the + // if, so that it also functions for host, however, + // we must fix the filtering to function reasonably + // for host first. + pm.addPass(fir::createOMPFunctionFilteringPass()); + } } pm.enableVerifier(/*verifyPasses=*/true); diff --git a/flang/test/Lower/OpenMP/function-filtering-2.f90 b/flang/test/Lower/OpenMP/function-filtering-2.f90 new file mode 100644 index 0000000..dbad29b --- /dev/null +++ b/flang/test/Lower/OpenMP/function-filtering-2.f90 @@ -0,0 +1,38 @@ +! RUN: %flang_fc1 -fopenmp -emit-llvm %s -o - | FileCheck --check-prefixes=LLVM-HOST %s +! RUN: %flang_fc1 -fopenmp -emit-mlir %s -o - | FileCheck --check-prefix=MLIR-HOST %s +! RUN: %flang_fc1 -fopenmp -fopenmp-is-target-device -emit-llvm %s -o - | FileCheck --check-prefixes=LLVM-DEVICE %s +! RUN: %flang_fc1 -fopenmp -fopenmp-is-target-device -emit-mlir %s -o - | FileCheck --check-prefix=MLIR-DEVICE %s + +! MLIR-HOST: func.func @{{.*}}implicit_invocation( +! MLIR-DEVICE: func.func @{{.*}}implicit_invocation() attributes {omp.declare_target = #omp.declaretarget<device_type = (nohost), capture_clause = (to)>} +! LLVM-HOST: define {{.*}} @{{.*}}implicit_invocation{{.*}}( +! LLVM-DEVICE: define {{.*}} @{{.*}}implicit_invocation{{.*}}( +subroutine implicit_invocation() +end subroutine implicit_invocation + +! MLIR-HOST: func.func @{{.*}}declaretarget( +! MLIR-DEVICE: func.func @{{.*}}declaretarget() attributes {omp.declare_target = #omp.declaretarget<device_type = (nohost), capture_clause = (to)>} +! LLVM-HOST: define {{.*}} @{{.*}}declaretarget{{.*}}( +! LLVM-DEVICE: define {{.*}} @{{.*}}declaretarget{{.*}}( +subroutine declaretarget() +!$omp declare target to(declaretarget) device_type(nohost) + call implicit_invocation() +end subroutine declaretarget + +! MLIR-HOST: func.func @{{.*}}no_declaretarget( +! MLIR-DEVICE: func.func @{{.*}}no_declaretarget() attributes {omp.declare_target = #omp.declaretarget<device_type = (nohost), capture_clause = (to)>} +! LLVM-HOST: define {{.*}} @{{.*}}no_declaretarget{{.*}}( +! LLVM-DEVICE: define {{.*}} @{{.*}}no_declaretarget{{.*}}( +subroutine no_declaretarget() +end subroutine no_declaretarget + +! MLIR-HOST: func.func @{{.*}}main( +! MLIR-DEVICE: func.func @{{.*}}main_omp_outline{{.*}}() attributes {omp.declare_target = #omp.declaretarget<device_type = (host), capture_clause = (to)>, omp.outline_parent_name = "_QQmain"} +! LLVM-HOST: define {{.*}} @{{.*}}main{{.*}}( +! LLVM-DEVICE: define {{.*}} @{{.*}}__omp_offloading{{.*}}main_{{.*}}( +program main +!$omp target + call declaretarget() + call no_declaretarget() +!$omp end target +end program main diff --git a/flang/test/Lower/OpenMP/function-filtering.f90 b/flang/test/Lower/OpenMP/function-filtering.f90 index 4386cb4..117cef6 100644 --- a/flang/test/Lower/OpenMP/function-filtering.f90 +++ b/flang/test/Lower/OpenMP/function-filtering.f90 @@ -7,9 +7,12 @@ ! after running the whole set of translation and transformation passes from ! Fortran. -! MLIR-HOST-NOT: func.func @{{.*}}device_fn( +! DISABLED, this portion of the test is disabled via the removal of the colon for the time +! being as filtering is enabled for device only for the time being while a fix is in progress. +! MLIR-HOST-NOT func.func @{{.*}}device_fn( +! LLVM-HOST-NOT define {{.*}} @{{.*}}device_fn{{.*}}( + ! MLIR-DEVICE: func.func @{{.*}}device_fn( -! LLVM-HOST-NOT: define {{.*}} @{{.*}}device_fn{{.*}}( ! LLVM-DEVICE: define {{.*}} @{{.*}}device_fn{{.*}}( function device_fn() result(x) !$omp declare target to(device_fn) device_type(nohost) |