[flang][OpenMP] Re-enable tests when building OpenMP as a runtime (#89046)

This commit is contained in:
Michael Klemm 2024-05-18 08:25:43 +02:00 committed by GitHub
parent 195ba45721
commit bfeebda3b1
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
54 changed files with 78 additions and 64 deletions

View File

@ -9,11 +9,11 @@
! This should just work
! RUN: not rm omp_lib.h
! RUN: %flang -cpp -fsyntax-only -fopenmp %s 2>&1
! RUN: %flang -cpp -fsyntax-only %openmp_flags %s 2>&1
! Create an empty omp_lib.h header that _does not_ define omp_default_mem_alloc - this should lead to semantic errors
! RUN: touch omp_lib.h
! RUN: not %flang -cpp -fsyntax-only -fopenmp %s 2>&1 | FileCheck %s
! RUN: not %flang -cpp -fsyntax-only %openmp_flags %s 2>&1 | FileCheck %s
! RUN: rm omp_lib.h
! CHECK: error: Must have INTEGER type, but is REAL(4)

View File

@ -2,9 +2,8 @@
! This test checks the lowering of atomic capture
! RUN: bbc -fopenmp -emit-hlfir %s -o - | FileCheck %s
! RUN: %flang_fc1 -emit-hlfir -fopenmp %s -o - | FileCheck %s
! RUN: bbc %openmp_flags -emit-hlfir %s -o - | FileCheck %s
! RUN: %flang_fc1 -emit-hlfir %openmp_flags %s -o - | FileCheck %s
program OmpAtomicCapture

View File

@ -1,6 +1,6 @@
! REQUIRES: openmp_runtime
! RUN: bbc -fopenmp -emit-hlfir %s -o - | FileCheck %s
! RUN: bbc %openmp_flags -emit-hlfir %s -o - | FileCheck %s
! This test checks the lowering of atomic read

View File

@ -1,8 +1,8 @@
! REQUIRES: openmp_runtime
! This test checks lowering of atomic and atomic update constructs
! RUN: bbc -fopenmp -emit-hlfir %s -o - | FileCheck %s
! RUN: %flang_fc1 -emit-hlfir -fopenmp %s -o - | FileCheck %s
! RUN: bbc %openmp_flags -emit-hlfir %s -o - | FileCheck %s
! RUN: %flang_fc1 -emit-hlfir %openmp_flags %s -o - | FileCheck %s
program OmpAtomicUpdate
use omp_lib

View File

@ -1,6 +1,6 @@
! REQUIRES: openmp_runtime
! RUN: bbc -fopenmp -emit-hlfir %s -o - | FileCheck %s
! RUN: bbc %openmp_flags -emit-hlfir %s -o - | FileCheck %s
! This test checks the lowering of atomic write

View File

@ -1,6 +1,6 @@
! REQUIRES: openmp_runtime
!RUN: %flang_fc1 -emit-hlfir -fopenmp %s -o - | FileCheck %s
!RUN: %flang_fc1 -emit-hlfir %openmp_flags %s -o - | FileCheck %s
!CHECK: omp.critical.declare @help2
!CHECK: omp.critical.declare @help1 hint(contended)

View File

@ -1,9 +1,9 @@
! REQUIRES: openmp_runtime
! RUN: %flang_fc1 -emit-hlfir -fopenmp %s -o - 2>&1 | FileCheck %s
! RUN: bbc -fopenmp -emit-hlfir -o - %s 2>&1 | FileCheck %s
! RUN: %flang_fc1 -emit-fir -fopenmp %s -o - 2>&1 | FileCheck %s
! RUN: bbc -emit-fir -fopenmp -o - %s 2>&1 | FileCheck %s
! RUN: %flang_fc1 -emit-hlfir %openmp_flags %s -o - 2>&1 | FileCheck %s
! RUN: bbc %openmp_flags -emit-hlfir -o - %s 2>&1 | FileCheck %s
! RUN: %flang_fc1 -emit-fir %openmp_flags %s -o - 2>&1 | FileCheck %s
! RUN: bbc -emit-fir %openmp_flags -o - %s 2>&1 | FileCheck %s
!
! Test that the calls to omp_lib's omp_get_num_threads and omp_set_num_threads
! get lowered even though their implementation is not in the omp_lib module

View File

@ -1,6 +1,6 @@
! REQUIRES: openmp_runtime
!RUN: %flang_fc1 -emit-hlfir -fopenmp %s -o - | FileCheck %s
!RUN: %flang_fc1 -emit-hlfir %openmp_flags %s -o - | FileCheck %s
!===============================================================================
! Parallel sections construct

View File

@ -1,6 +1,6 @@
! REQUIRES: openmp_runtime
!RUN: %flang_fc1 -emit-hlfir -fopenmp %s -o - | FileCheck %s
!RUN: %flang_fc1 -emit-hlfir %openmp_flags %s -o - | FileCheck %s
!CHECK-LABEL: func @_QPparallel_simple
subroutine parallel_simple()

View File

@ -2,8 +2,8 @@
! This test checks the lowering of OpenMP sections construct with several clauses present
! RUN: %flang_fc1 -flang-experimental-hlfir -emit-hlfir -fopenmp %s -o - | FileCheck %s
! RUN: bbc -hlfir -emit-hlfir -fopenmp %s -o - | FileCheck %s
! RUN: %flang_fc1 -flang-experimental-hlfir -emit-hlfir %openmp_flags %s -o - | FileCheck %s
! RUN: bbc -hlfir -emit-hlfir %openmp_flags %s -o - | FileCheck %s
!CHECK: func @_QQmain() attributes {fir.bindc_name = "sample"} {
!CHECK: %[[COUNT:.*]] = fir.address_of(@_QFEcount) : !fir.ref<i32>

View File

@ -1,7 +1,7 @@
! REQUIRES: openmp_runtime
!RUN: %flang_fc1 -emit-hlfir -fopenmp %s -o - | FileCheck %s
!RUN: bbc -emit-hlfir -fopenmp %s -o - | FileCheck %s
!RUN: %flang_fc1 -emit-hlfir %openmp_flags %s -o - | FileCheck %s
!RUN: bbc -emit-hlfir %openmp_flags %s -o - | FileCheck %s
!===============================================================================
! Single construct

View File

@ -1,6 +1,6 @@
! REQUIRES: openmp_runtime
!RUN: %flang_fc1 -emit-hlfir -fopenmp %s -o - | FileCheck %s
!RUN: %flang_fc1 -emit-hlfir %openmp_flags %s -o - | FileCheck %s
!CHECK-LABEL: func @_QPomp_task_simple() {
subroutine omp_task_simple

View File

@ -1,4 +1,6 @@
!RUN: %flang_fc1 -emit-hlfir -fopenmp %s -o - | FileCheck %s
! REQUIRES: openmp_runtime
!RUN: %flang_fc1 -emit-hlfir %openmp_flags %s -o - | FileCheck %s
! The "allocate" clause has been removed, because it needs to be used
! together with a privatizing clause. The only such clause for "taskgroup"

View File

@ -1,6 +1,6 @@
! REQUIRES: openmp_runtime
! RUN: %flang_fc1 -emit-hlfir -fopenmp -fopenmp-version=52 %s -o - | FileCheck %s
! RUN: %flang_fc1 -emit-hlfir %openmp_flags -fopenmp-version=52 %s -o - | FileCheck %s
! CHECK-LABEL: func @_QPteams_simple
subroutine teams_simple()

View File

@ -2,7 +2,7 @@
! Simple test for lowering of OpenMP Threadprivate Directive with HLFIR.
!RUN: %flang_fc1 -emit-hlfir -fopenmp %s -o - | FileCheck %s
!RUN: %flang_fc1 -emit-hlfir %openmp_flags %s -o - | FileCheck %s
!CHECK-LABEL: func.func @_QPsub1() {
!CHECK: %[[A:.*]] = fir.address_of(@_QFsub1Ea) : !fir.ref<i32>

View File

@ -1,6 +1,6 @@
! REQUIRES: openmp_runtime
! RUN: %flang_fc1 -fopenmp -fdebug-dump-parse-tree %s | FileCheck %s
! RUN: %flang_fc1 %openmp_flags -fdebug-dump-parse-tree %s | FileCheck %s
! Ensures associated declarative OMP allocations in the specification
! part are kept there

View File

@ -1,7 +1,7 @@
! REQUIRES: openmp_runtime
! RUN: %flang_fc1 -fopenmp -fdebug-dump-parse-tree %s | FileCheck %s
! RUN: %flang_fc1 -fopenmp -fdebug-unparse %s | FileCheck %s --check-prefix="UNPARSE"
! RUN: %flang_fc1 %openmp_flags -fdebug-dump-parse-tree %s | FileCheck %s
! RUN: %flang_fc1 %openmp_flags -fdebug-unparse %s | FileCheck %s --check-prefix="UNPARSE"
! Ensures associated declarative OMP allocations are nested in their
! corresponding executable allocate directive

View File

@ -1,7 +1,7 @@
! REQUIRES: openmp_runtime
! RUN: %flang_fc1 -fdebug-unparse-no-sema -fopenmp %s | FileCheck --ignore-case %s
! RUN: %flang_fc1 -fdebug-dump-parse-tree -fopenmp %s | FileCheck --check-prefix="PARSE-TREE" %s
! RUN: %flang_fc1 -fdebug-unparse-no-sema %openmp_flags %s | FileCheck --ignore-case %s
! RUN: %flang_fc1 -fdebug-dump-parse-tree %openmp_flags %s | FileCheck --check-prefix="PARSE-TREE" %s
! Checks the parsing of Openmp 5.0 Target Device constructs
!
PROGRAM main

View File

@ -1,6 +1,6 @@
! REQUIRES: openmp_runtime
! RUN: %python %S/../test_errors.py %s %flang_fc1 -fopenmp
! RUN: %python %S/../test_errors.py %s %flang_fc1 %openmp_flags
! OpenMP Version 5.2
! The allocate clause's allocator modifier must be of type allocator_handle
! and the align modifier must be constant, positive integer expression

View File

@ -1,6 +1,6 @@
! REQUIRES: openmp_runtime
! RUN: %python %S/../test_errors.py %s %flang_fc1 -fopenmp
! RUN: %python %S/../test_errors.py %s %flang_fc1 %openmp_flags
! Check OpenMP Allocate directive
use omp_lib

View File

@ -1,6 +1,6 @@
! REQUIRES: openmp_runtime
! RUN: %python %S/../test_errors.py %s %flang_fc1 -fopenmp
! RUN: %python %S/../test_errors.py %s %flang_fc1 %openmp_flags
! OpenMP Version 5.0
! 2.11.3 allocate Directive
! The allocate directive must appear in the same scope as the declarations of

View File

@ -1,6 +1,6 @@
! REQUIRES: openmp_runtime
! RUN: %python %S/../test_errors.py %s %flang_fc1 -fopenmp
! RUN: %python %S/../test_errors.py %s %flang_fc1 %openmp_flags
! OpenMP Version 5.0
! 2.11.3 allocate Directive
! At most one allocator clause can appear on the allocate directive.

View File

@ -1,6 +1,6 @@
! REQUIRES: openmp_runtime
! RUN: %python %S/../test_errors.py %s %flang_fc1 -fopenmp
! RUN: %python %S/../test_errors.py %s %flang_fc1 %openmp_flags
! OpenMP Version 5.0
! 2.11.3 allocate Directive
! A variable that is part of another variable (as an array or

View File

@ -1,6 +1,6 @@
! REQUIRES: openmp_runtime
! RUN: %python %S/../test_errors.py %s %flang_fc1 -fopenmp
! RUN: %python %S/../test_errors.py %s %flang_fc1 %openmp_flags
! OpenMP Version 5.0
! 2.11.3 allocate Directive
! Only the allocator clause is allowed on the allocate directive

View File

@ -1,6 +1,6 @@
! REQUIRES: openmp_runtime
! RUN: %python %S/../test_errors.py %s %flang_fc1 -fopenmp
! RUN: %python %S/../test_errors.py %s %flang_fc1 %openmp_flags
! OpenMP Version 5.0
! 2.11.3 allocate Directive
! allocate directives that appear in a target region must specify an allocator

View File

@ -1,6 +1,6 @@
! REQUIRES: openmp_runtime
! RUN: %python %S/../test_errors.py %s %flang_fc1 -fopenmp
! RUN: %python %S/../test_errors.py %s %flang_fc1 %openmp_flags
! OpenMP Version 5.0
! 2.11.3 allocate Directive
! List items specified in the allocate directive must not have the ALLOCATABLE attribute unless the directive is associated with an

View File

@ -1,6 +1,6 @@
! REQUIRES: openmp_runtime
! RUN: %python %S/../test_errors.py %s %flang_fc1 -fopenmp
! RUN: %python %S/../test_errors.py %s %flang_fc1 %openmp_flags
! OpenMP Version 5.0
! 2.11.3 allocate Directive
! A type parameter inquiry cannot appear in an allocate directive.

View File

@ -1,6 +1,6 @@
! REQUIRES: openmp_runtime
! RUN: %python %S/../test_errors.py %s %flang_fc1 -fopenmp
! RUN: %python %S/../test_errors.py %s %flang_fc1 %openmp_flags
! OpenMP Version 5.0
! 2.11.3 allocate Directive
! If list items within the ALLOCATE directive have the SAVE attribute, are a common block name, or are declared in the scope of a

View File

@ -1,6 +1,6 @@
! REQUIRES: openmp_runtime
! RUN: %python %S/../test_errors.py %s %flang_fc1 -fopenmp
! RUN: %python %S/../test_errors.py %s %flang_fc1 %openmp_flags
! OpenMP Version 5.0
! 2.11.3 allocate Directive
! List items specified in an allocate directive that is associated

View File

@ -1,6 +1,6 @@
! REQUIRES: openmp_runtime
! RUN: %python %S/../test_errors.py %s %flang_fc1 -fopenmp
! RUN: %python %S/../test_errors.py %s %flang_fc1 %openmp_flags
! OpenMP Version 5.2
! 6.7 allocators construct
! A list item that appears in an allocate clause must appear as

View File

@ -1,6 +1,6 @@
! REQUIRES: openmp_runtime
! RUN: %python %S/../test_errors.py %s %flang_fc1 -fopenmp
! RUN: %python %S/../test_errors.py %s %flang_fc1 %openmp_flags
! OpenMP Version 5.2
! 6.7 allocators construct
! A variable that is part of another variable (as an array or

View File

@ -1,6 +1,6 @@
! REQUIRES: openmp_runtime
! RUN: %python %S/../test_errors.py %s %flang_fc1 -fopenmp
! RUN: %python %S/../test_errors.py %s %flang_fc1 %openmp_flags
! OpenMP Version 5.2
! 6.7 allocators construct
! Only the allocate clause is allowed on the allocators construct

View File

@ -1,6 +1,6 @@
! REQUIRES: openmp_runtime
! RUN: %python %S/../test_errors.py %s %flang_fc1 -fopenmp
! RUN: %python %S/../test_errors.py %s %flang_fc1 %openmp_flags
! OpenMP Version 5.2
! Inherited from 2.11.3 allocate Directive
! If list items within the ALLOCATE directive have the SAVE attribute, are a common block name, or are declared in the scope of a

View File

@ -1,6 +1,6 @@
! REQUIRES: openmp_runtime
! RUN: %python %S/../test_errors.py %s %flang_fc1 -fopenmp
! RUN: %python %S/../test_errors.py %s %flang_fc1 %openmp_flags
! OpenMP Version 5.2
! Inherited from 2.11.3 allocate directive
! allocate directives that appear in a target region must specify an

View File

@ -1,6 +1,6 @@
! REQUIRES: openmp_runtime
! RUN: %python %S/../test_errors.py %s %flang_fc1 -fopenmp
! RUN: %python %S/../test_errors.py %s %flang_fc1 %openmp_flags
! OpenMP Version 5.2
! Inherited from 2.11.3 allocate directive
! The allocate directive must appear in the same scope as the declarations of

View File

@ -1,6 +1,6 @@
! REQUIRES: openmp_runtime
! RUN: %python %S/../test_errors.py %s %flang_fc1 -fopenmp
! RUN: %python %S/../test_errors.py %s %flang_fc1 %openmp_flags
! Semantic checks on hint clauses, as they appear on atomic constructs
program sample

View File

@ -1,6 +1,6 @@
! REQUIRES: openmp_runtime
! RUN: %python %S/../test_errors.py %s %flang_fc1 -fopenmp
! RUN: %python %S/../test_errors.py %s %flang_fc1 %openmp_flags
! Semantic checks for OpenMP 5.0 standard 2.17.7 atomic Construct.
use omp_lib

View File

@ -1,6 +1,6 @@
! REQUIRES: openmp_runtime
! RUN: %python %S/../test_errors.py %s %flang_fc1 -fopenmp
! RUN: %python %S/../test_errors.py %s %flang_fc1 %openmp_flags
! OpenMP Atomic construct
! section 2.17.7

View File

@ -1,6 +1,6 @@
! REQUIRES: openmp_runtime
! RUN: %python %S/../test_errors.py %s %flang_fc1 -fopenmp
! RUN: %python %S/../test_errors.py %s %flang_fc1 %openmp_flags
! OpenMP Atomic construct
! section 2.17.7

View File

@ -1,6 +1,6 @@
! REQUIRES: openmp_runtime
! RUN: %python %S/../test_errors.py %s %flang_fc1 -fopenmp
! RUN: %python %S/../test_errors.py %s %flang_fc1 %openmp_flags
! OpenMP Atomic construct
! section 2.17.7

View File

@ -1,6 +1,6 @@
! REQUIRES: openmp_runtime
! RUN: %python %S/../test_errors.py %s %flang -fopenmp
! RUN: %python %S/../test_errors.py %s %flang %openmp_flags
! This tests the various semantics related to the clauses of various OpenMP atomic constructs

View File

@ -1,6 +1,6 @@
! REQUIRES: openmp_runtime
! RUN: %python %S/../test_errors.py %s %flang_fc1 -fopenmp
! RUN: %python %S/../test_errors.py %s %flang_fc1 %openmp_flags %openmp_module_flag
use omp_lib
! Check OpenMP clause validity for the following directives:
!

View File

@ -1,6 +1,6 @@
! REQUIRES: openmp_runtime
! RUN: %python %S/../test_errors.py %s %flang_fc1 -fopenmp
! RUN: %python %S/../test_errors.py %s %flang_fc1 %openmp_flags
! Semantic checks on hint clauses, as they appear on critical construct
program sample

View File

@ -1,6 +1,6 @@
! REQUIRES: openmp_runtime
! RUN: %python %S/../test_errors.py %s %flang_fc1 -fopenmp
! RUN: %python %S/../test_errors.py %s %flang_fc1 %openmp_flags
! OpenMP Version 5.1
! Check OpenMP construct validity for the following directives:
! 2.14.7 Declare Target Directive

View File

@ -1,6 +1,6 @@
! REQUIRES: openmp_runtime
! RUN: %python %S/../test_errors.py %s %flang_fc1 -fopenmp
! RUN: %python %S/../test_errors.py %s %flang_fc1 %openmp_flags
! Check OpenMP 5.0 - 2.17.8 flush Construct
! Restriction -

View File

@ -1,6 +1,6 @@
! REQUIRES: openmp_runtime
! RUN: %python %S/../test_errors.py %s %flang_fc1 -fopenmp
! RUN: %python %S/../test_errors.py %s %flang_fc1 %openmp_flags
! Semantic checks for various assignments related to atomic constructs
program sample

View File

@ -1,6 +1,6 @@
! REQUIRES: openmp_runtime
! RUN: %python %S/../test_errors.py %s %flang -fopenmp
! RUN: %python %S/../test_errors.py %s %flang %openmp_flags
! OpenMP version 5.0.0
! 2.13.3 parallel sections Construct
! The restrictions for the parallel construct and the sections construct apply

View File

@ -1,6 +1,6 @@
! REQUIRES: openmp_runtime
! RUN: %python %S/../test_errors.py %s %flang_fc1 -fopenmp
! RUN: %python %S/../test_errors.py %s %flang_fc1 %openmp_flags
use omp_lib
!2.11.4 Allocate Clause
!For any list item that is specified in the allocate

View File

@ -1,6 +1,6 @@
! REQUIRES: openmp_runtime
! RUN: %python %S/../test_errors.py %s %flang -fopenmp
! RUN: %python %S/../test_errors.py %s %flang %openmp_flags
! OpenMP version 5.0.0
! 2.8.1 sections construct
! The code enclosed in a sections construct must be a structured block.

View File

@ -1,6 +1,6 @@
! REQUIRES: openmp_runtime
! RUN: %python %S/../test_errors.py %s %flang -fopenmp
! RUN: %python %S/../test_errors.py %s %flang %openmp_flags
! OpenMP Version 5.0
! 2.17.1 critical construct

View File

@ -1,6 +1,6 @@
! REQUIRES: openmp_runtime
! RUN: %python %S/../test_errors.py %s %flang -fopenmp
! RUN: %python %S/../test_errors.py %s %flang %openmp_flags
use omp_lib
implicit none

View File

@ -1,6 +1,6 @@
! REQUIRES: openmp_runtime
! RUN: %python %S/../test_errors.py %s %flang_fc1 -fopenmp
! RUN: %python %S/../test_errors.py %s %flang_fc1 %openmp_flags
! OpenMP Version 5.1
! Check OpenMP construct validity for the following directives:
! 2.21.2 Threadprivate Directive

View File

@ -203,6 +203,15 @@ if result:
# Determine if OpenMP runtime was built (enable OpenMP tests via REQUIRES in test file)
if config.have_openmp_rtl:
config.available_features.add("openmp_runtime")
# For the enabled OpenMP tests, add a substitution that is needed in the tests to find
# the omp_lib.{h,mod} files, depending on whether the OpenMP runtime was built as a
# project or runtime.
if config.openmp_module_dir:
config.substitutions.append(
("%openmp_flags", f"-fopenmp -J {config.openmp_module_dir}")
)
else:
config.substitutions.append(("%openmp_flags", "-fopenmp"))
# Add features and substitutions to test F128 math support.
# %f128-lib substitution may be used to generate check prefixes

View File

@ -25,7 +25,11 @@ config.cc = "@CMAKE_C_COMPILER@"
config.osx_sysroot = path(r"@CMAKE_OSX_SYSROOT@")
config.targets_to_build = "@TARGETS_TO_BUILD@"
config.default_sysroot = "@DEFAULT_SYSROOT@"
config.have_openmp_rtl = ("@LLVM_TOOL_OPENMP_BUILD@" == "TRUE")
config.have_openmp_rtl = ("@LLVM_TOOL_OPENMP_BUILD@" == "TRUE") or ("openmp" in "@LLVM_ENABLE_RUNTIMES@".lower().split(";"))
if "openmp" in "@LLVM_ENABLE_RUNTIMES@".lower().split(";"):
config.openmp_module_dir = "@CMAKE_BINARY_DIR@/runtimes/runtimes-bins/openmp/runtime/src"
else:
config.openmp_module_dir = None
config.flang_runtime_f128_math_lib = "@FLANG_RUNTIME_F128_MATH_LIB@"
import lit.llvm