Skip to content

[OpenMP][Fix] libomptarget Fortran tests #74543

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

Merged
merged 2 commits into from
Dec 19, 2023
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
14 changes: 10 additions & 4 deletions openmp/libomptarget/test/lit.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,10 @@ config.test_flags = " -I " + config.test_source_root + \
" -L " + config.library_dir + \
" -L " + config.llvm_lib_directory

# compiler specific flags
config.test_flags_clang = ""
config.test_flags_flang = ""

if config.omp_host_rtl_directory:
config.test_flags = config.test_flags + " -L " + \
config.omp_host_rtl_directory
Expand Down Expand Up @@ -136,7 +140,7 @@ else: # Unices
if config.cuda_libdir:
config.test_flags += " -Wl,-rpath," + config.cuda_libdir
if config.libomptarget_current_target.startswith('nvptx'):
config.test_flags += " --libomptarget-nvptx-bc-path=" + config.library_dir + '/DeviceRTL'
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think the leading whitespace needs to stay in case config.test_flags_clang is not empty.

config.test_flags_clang += " --libomptarget-nvptx-bc-path=" + config.library_dir + '/DeviceRTL'
if config.libomptarget_current_target.endswith('-LTO'):
config.test_flags += " -foffload-lto"
if config.libomptarget_current_target.endswith('-JIT-LTO') and evaluate_bool_env(
Expand Down Expand Up @@ -273,13 +277,13 @@ for libomptarget_target in config.libomptarget_all_targets:
libomptarget_target, \
"%not --crash %t"))
config.substitutions.append(("%clangxx-" + libomptarget_target, \
"%clangxx %openmp_flags %cuda_flags %flags -fopenmp-targets=" +\
"%clangxx %openmp_flags %cuda_flags %flags %flags_clang -fopenmp-targets=" +\
remove_suffix_if_present(libomptarget_target)))
config.substitutions.append(("%clang-" + libomptarget_target, \
"%clang %openmp_flags %cuda_flags %flags -fopenmp-targets=" +\
"%clang %openmp_flags %cuda_flags %flags %flags_clang -fopenmp-targets=" +\
remove_suffix_if_present(libomptarget_target)))
config.substitutions.append(("%flang-" + libomptarget_target, \
"%flang %openmp_flags %flags -fopenmp-targets=" +\
"%flang %openmp_flags %flags %flags_flang -fopenmp-targets=" +\
remove_suffix_if_present(libomptarget_target)))
config.substitutions.append(("%fcheck-" + libomptarget_target, \
config.libomptarget_filecheck + " %s"))
Expand Down Expand Up @@ -357,4 +361,6 @@ if config.libomptarget_current_target.startswith('nvptx') and config.cuda_path:
else:
config.substitutions.append(("%cuda_flags", ""))
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))
config.substitutions.append(("%not", config.libomptarget_not))
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
! Basic offloading test of arrays with provided lower
! and upper bounds as specified by OpenMP's sectioning
! REQUIRES: flang, amdgcn-amd-amdhsa, nvptx64-nvidia-cuda
! REQUIRES: flang
! UNSUPPORTED: nvptx64-nvidia-cuda-LTO
! UNSUPPORTED: aarch64-unknown-linux-gnu
! UNSUPPORTED: aarch64-unknown-linux-gnu-LTO
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
! Basic offloading test of a regular array explicitly
! passed within a target region
! REQUIRES: flang, amdgcn-amd-amdhsa, nvptx64-nvidia-cuda
! REQUIRES: flang
! UNSUPPORTED: nvptx64-nvidia-cuda-LTO
! UNSUPPORTED: aarch64-unknown-linux-gnu
! UNSUPPORTED: aarch64-unknown-linux-gnu-LTO
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
! Basic offloading test of a regular array explicitly
! passed within a target region
! REQUIRES: flang, amdgcn-amd-amdhsa, nvptx64-nvidia-cuda
! REQUIRES: flang
! UNSUPPORTED: nvptx64-nvidia-cuda-LTO
! UNSUPPORTED: aarch64-unknown-linux-gnu
! UNSUPPORTED: aarch64-unknown-linux-gnu-LTO
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
! Basic offloading test with a target region
! REQUIRES: flang, amdgcn-amd-amdhsa, nvptx64-nvidia-cuda
! REQUIRES: flang
! UNSUPPORTED: nvptx64-nvidia-cuda-LTO
! UNSUPPORTED: aarch64-unknown-linux-gnu
! UNSUPPORTED: aarch64-unknown-linux-gnu-LTO
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,7 @@
! that checks constant indexing on device
! correctly works (regression test for prior
! bug).
! REQUIRES: flang, amdgcn-amd-amdhsa
! UNSUPPORTED: nvptx64-nvidia-cuda
! REQUIRES: flang
! UNSUPPORTED: nvptx64-nvidia-cuda-LTO
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why is nvptx still unsupported?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I removed the restriction that test is supported.

However, there are a couple of tests that are still unsupported like target_map_common_block2.f90. The reason is that nvlink fails to resolve some external symbols (bc of the inclusion of omp_lib), but those symbols shouldn't have been inserted into the module in the first place.

! UNSUPPORTED: aarch64-unknown-linux-gnu
! UNSUPPORTED: aarch64-unknown-linux-gnu-LTO
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
! Offloading test with a target region mapping a declare target
! Fortran array writing some values to it and checking the host
! correctly receives the updates made on the device.
! REQUIRES: flang, amdgcn-amd-amdhsa, nvptx64-nvidia-cuda
! REQUIRES: flang
! UNSUPPORTED: nvptx64-nvidia-cuda-LTO
! UNSUPPORTED: aarch64-unknown-linux-gnu
! UNSUPPORTED: aarch64-unknown-linux-gnu-LTO
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@
! declare target Fortran array and writing some values to
! it before checking the host correctly receives the
! correct updates made on the device.
! REQUIRES: flang, amdgcn-amd-amdhsa, nvptx64-nvidia-cuda
! REQUIRES: flang
! UNSUPPORTED: nvptx64-nvidia-cuda
! UNSUPPORTED: nvptx64-nvidia-cuda-LTO
! UNSUPPORTED: aarch64-unknown-linux-gnu
! UNSUPPORTED: aarch64-unknown-linux-gnu-LTO
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
! Basic offloading test of a regular array explicitly
! passed within a target region
! REQUIRES: flang, amdgcn-amd-amdhsa, nvptx64-nvidia-cuda
! REQUIRES: flang
! UNSUPPORTED: nvptx64-nvidia-cuda-LTO
! UNSUPPORTED: aarch64-unknown-linux-gnu
! UNSUPPORTED: aarch64-unknown-linux-gnu-LTO
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
! Basic offloading test with a target region
! REQUIRES: flang, amdgcn-amd-amdhsa
! REQUIRES: flang
! UNSUPPORTED: nvptx64-nvidia-cuda
! UNSUPPORTED: nvptx64-nvidia-cuda-LTO
! UNSUPPORTED: aarch64-unknown-linux-gnu
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
! REQUIRES: flang, amdgcn-amd-amdhsa
! REQUIRES: flang
! UNSUPPORTED: nvptx64-nvidia-cuda
! UNSUPPORTED: nvptx64-nvidia-cuda-LTO
! UNSUPPORTED: aarch64-unknown-linux-gnu
Expand Down