Skip to content

Commit 12250c4

Browse files
authored
Reland [OpenMP][Fix] libomptarget Fortran tests (#76189)
This patch fixes the erroneous multiple-target requirement in Fortran offloading tests. Additionally, it adds two new variables (test_flags_clang, test_flags_flang) to lit.cfg so that compiler-specific flags for Clang and Flang can be specified. This patch re-lands: #74543. The error was caused by having: ``` config.substitutions.append(("%flags", config.test_flags)) config.substitutions.append(("%flags_clang", config.test_flags_clang)) config.substitutions.append(("%flags_flang", config.test_flags_flang)) ``` when instead it has to be: ``` config.substitutions.append(("%flags_clang", config.test_flags_clang)) config.substitutions.append(("%flags_flang", config.test_flags_flang)) config.substitutions.append(("%flags", config.test_flags)) ``` because LIT replaces with the first longest sub-string match.
1 parent 35a5df2 commit 12250c4

11 files changed

+21
-15
lines changed

openmp/libomptarget/test/lit.cfg

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,10 @@ config.test_flags = " -I " + config.test_source_root + \
7878
" -L " + config.library_dir + \
7979
" -L " + config.llvm_lib_directory
8080

81+
# compiler specific flags
82+
config.test_flags_clang = ""
83+
config.test_flags_flang = ""
84+
8185
if config.omp_host_rtl_directory:
8286
config.test_flags = config.test_flags + " -L " + \
8387
config.omp_host_rtl_directory
@@ -136,7 +140,7 @@ else: # Unices
136140
if config.cuda_libdir:
137141
config.test_flags += " -Wl,-rpath," + config.cuda_libdir
138142
if config.libomptarget_current_target.startswith('nvptx'):
139-
config.test_flags += " --libomptarget-nvptx-bc-path=" + config.library_dir + '/DeviceRTL'
143+
config.test_flags_clang += " --libomptarget-nvptx-bc-path=" + config.library_dir + '/DeviceRTL'
140144
if config.libomptarget_current_target.endswith('-LTO'):
141145
config.test_flags += " -foffload-lto"
142146
if config.libomptarget_current_target.endswith('-JIT-LTO') and evaluate_bool_env(
@@ -273,13 +277,13 @@ for libomptarget_target in config.libomptarget_all_targets:
273277
libomptarget_target, \
274278
"%not --crash %t"))
275279
config.substitutions.append(("%clangxx-" + libomptarget_target, \
276-
"%clangxx %openmp_flags %cuda_flags %flags -fopenmp-targets=" +\
280+
"%clangxx %openmp_flags %cuda_flags %flags %flags_clang -fopenmp-targets=" +\
277281
remove_suffix_if_present(libomptarget_target)))
278282
config.substitutions.append(("%clang-" + libomptarget_target, \
279-
"%clang %openmp_flags %cuda_flags %flags -fopenmp-targets=" +\
283+
"%clang %openmp_flags %cuda_flags %flags %flags_clang -fopenmp-targets=" +\
280284
remove_suffix_if_present(libomptarget_target)))
281285
config.substitutions.append(("%flang-" + libomptarget_target, \
282-
"%flang %openmp_flags %flags -fopenmp-targets=" +\
286+
"%flang %openmp_flags %flags %flags_flang -fopenmp-targets=" +\
283287
remove_suffix_if_present(libomptarget_target)))
284288
config.substitutions.append(("%fcheck-" + libomptarget_target, \
285289
config.libomptarget_filecheck + " %s"))
@@ -356,5 +360,7 @@ if config.libomptarget_current_target.startswith('nvptx') and config.cuda_path:
356360
config.substitutions.append(("%cuda_flags", "--cuda-path=" + config.cuda_path))
357361
else:
358362
config.substitutions.append(("%cuda_flags", ""))
363+
config.substitutions.append(("%flags_clang", config.test_flags_clang))
364+
config.substitutions.append(("%flags_flang", config.test_flags_flang))
359365
config.substitutions.append(("%flags", config.test_flags))
360366
config.substitutions.append(("%not", config.libomptarget_not))

openmp/libomptarget/test/offloading/fortran/basic-target-region-1D-array-section.f90

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
! Basic offloading test of arrays with provided lower
22
! and upper bounds as specified by OpenMP's sectioning
3-
! REQUIRES: flang, amdgcn-amd-amdhsa, nvptx64-nvidia-cuda
3+
! REQUIRES: flang
44
! UNSUPPORTED: nvptx64-nvidia-cuda-LTO
55
! UNSUPPORTED: aarch64-unknown-linux-gnu
66
! UNSUPPORTED: aarch64-unknown-linux-gnu-LTO

openmp/libomptarget/test/offloading/fortran/basic-target-region-3D-array-section.f90

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
! Basic offloading test of a regular array explicitly
22
! passed within a target region
3-
! REQUIRES: flang, amdgcn-amd-amdhsa, nvptx64-nvidia-cuda
3+
! REQUIRES: flang
44
! UNSUPPORTED: nvptx64-nvidia-cuda-LTO
55
! UNSUPPORTED: aarch64-unknown-linux-gnu
66
! UNSUPPORTED: aarch64-unknown-linux-gnu-LTO

openmp/libomptarget/test/offloading/fortran/basic-target-region-3D-array.f90

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
! Basic offloading test of a regular array explicitly
22
! passed within a target region
3-
! REQUIRES: flang, amdgcn-amd-amdhsa, nvptx64-nvidia-cuda
3+
! REQUIRES: flang
44
! UNSUPPORTED: nvptx64-nvidia-cuda-LTO
55
! UNSUPPORTED: aarch64-unknown-linux-gnu
66
! UNSUPPORTED: aarch64-unknown-linux-gnu-LTO

openmp/libomptarget/test/offloading/fortran/basic_target_region.f90

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
! Basic offloading test with a target region
2-
! REQUIRES: flang, amdgcn-amd-amdhsa, nvptx64-nvidia-cuda
2+
! REQUIRES: flang
33
! UNSUPPORTED: nvptx64-nvidia-cuda-LTO
44
! UNSUPPORTED: aarch64-unknown-linux-gnu
55
! UNSUPPORTED: aarch64-unknown-linux-gnu-LTO

openmp/libomptarget/test/offloading/fortran/constant-arr-index.f90

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,7 @@
22
! that checks constant indexing on device
33
! correctly works (regression test for prior
44
! bug).
5-
! REQUIRES: flang, amdgcn-amd-amdhsa
6-
! UNSUPPORTED: nvptx64-nvidia-cuda
5+
! REQUIRES: flang
76
! UNSUPPORTED: nvptx64-nvidia-cuda-LTO
87
! UNSUPPORTED: aarch64-unknown-linux-gnu
98
! UNSUPPORTED: aarch64-unknown-linux-gnu-LTO

openmp/libomptarget/test/offloading/fortran/declare-target-array-in-target-region.f90

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
! Offloading test with a target region mapping a declare target
22
! Fortran array writing some values to it and checking the host
33
! correctly receives the updates made on the device.
4-
! REQUIRES: flang, amdgcn-amd-amdhsa, nvptx64-nvidia-cuda
4+
! REQUIRES: flang
55
! UNSUPPORTED: nvptx64-nvidia-cuda-LTO
66
! UNSUPPORTED: aarch64-unknown-linux-gnu
77
! UNSUPPORTED: aarch64-unknown-linux-gnu-LTO

openmp/libomptarget/test/offloading/fortran/double-target-call-with-declare-target.f90

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,8 @@
22
! declare target Fortran array and writing some values to
33
! it before checking the host correctly receives the
44
! correct updates made on the device.
5-
! REQUIRES: flang, amdgcn-amd-amdhsa, nvptx64-nvidia-cuda
5+
! REQUIRES: flang
6+
! UNSUPPORTED: nvptx64-nvidia-cuda
67
! UNSUPPORTED: nvptx64-nvidia-cuda-LTO
78
! UNSUPPORTED: aarch64-unknown-linux-gnu
89
! UNSUPPORTED: aarch64-unknown-linux-gnu-LTO

openmp/libomptarget/test/offloading/fortran/target-region-implicit-array.f90

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
! Basic offloading test of a regular array explicitly
22
! passed within a target region
3-
! REQUIRES: flang, amdgcn-amd-amdhsa, nvptx64-nvidia-cuda
3+
! REQUIRES: flang
44
! UNSUPPORTED: nvptx64-nvidia-cuda-LTO
55
! UNSUPPORTED: aarch64-unknown-linux-gnu
66
! UNSUPPORTED: aarch64-unknown-linux-gnu-LTO

openmp/libomptarget/test/offloading/fortran/target_map_common_block.f90

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
! Basic offloading test with a target region
2-
! REQUIRES: flang, amdgcn-amd-amdhsa
2+
! REQUIRES: flang
33
! UNSUPPORTED: nvptx64-nvidia-cuda
44
! UNSUPPORTED: nvptx64-nvidia-cuda-LTO
55
! UNSUPPORTED: aarch64-unknown-linux-gnu

openmp/libomptarget/test/offloading/fortran/target_map_common_block2.f90

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
! REQUIRES: flang, amdgcn-amd-amdhsa
1+
! REQUIRES: flang
22
! UNSUPPORTED: nvptx64-nvidia-cuda
33
! UNSUPPORTED: nvptx64-nvidia-cuda-LTO
44
! UNSUPPORTED: aarch64-unknown-linux-gnu

0 commit comments

Comments
 (0)