This is an archive of the discontinued LLVM Phabricator instance.

[flang][openmp] Fortran offloading test
ClosedPublic

Authored by elmcdonough on Apr 19 2023, 8:22 PM.

Details

Summary

Flang currently supports offloading for AMD GPUs. This patch establishes a test structure for Fortran offloading tests in libomptarget.

Diff Detail

Event Timeline

elmcdonough created this revision.Apr 19 2023, 8:22 PM
Herald added a project: Restricted Project. · View Herald Transcript
elmcdonough requested review of this revision.Apr 19 2023, 8:22 PM

Fix build issues with past flang existence check.

@tianshilei1992 @jhuber6, works for me, anything jumps out on your end?

vzakhari added inline comments.
openmp/libomptarget/test/lit.cfg
90

I think you have to make sure that check-libomptarget CMake target has a dependency on whatever target produces flang-new tool. Alternatively, you may follow the same logic that is used for clang with config.test_*_compiler properties, but then it does not really matter if Flang is in LLVM_ENABLE_PROJECTS.

elmcdonough added inline comments.May 5 2023, 10:47 AM
openmp/libomptarget/test/lit.cfg
90

I wanted to make it so that the flang dependency is optional. The offloading tests should be run if flang is an enabled project, otherwise, they should be ignored. I had a config.test_fortran_compiler in my original build that inherited from CMAKE_Fortran_COMPILER in standalone builds and looked for flang-new in the binary dir with CMake's find_program for in-tree builds. Unfortunately, that version didn't work in certain circumstances.

The current revision seems to work better and is cleaner IMO, but I'm open to the idea of adding an extra build flag for fortran tests if others think it would work better. @jdoerfert Any thoughts on this?

vzakhari added inline comments.May 5 2023, 10:52 AM
openmp/libomptarget/test/lit.cfg
90

... and looked for flang-new in the binary dir with CMake's find_program for in-tree builds. Unfortunately, that version didn't work in certain circumstances.

Right, without the CMake dependency between check-libomptarget and flang-new this will not work when flang-new is built later than all prerequisites for check-libomptarget are satisfied.
I believe the current version has the same issue.

One of the solutions is to add the target dependency in libomptarget/test/CMakeLists.txt when flang is present in LLVM_ENABLE_PROJECTS.

Ah okay, thanks for clarifying. I haven't had any issues when testing it locally, but I'll make sure to look into this.

Add flang-new as dependency when flang is enabled

jdoerfert accepted this revision.Jun 28 2023, 9:05 AM
This revision is now accepted and ready to land.Jun 28 2023, 9:05 AM
This revision was automatically updated to reflect the committed changes.