[flang-commits] [flang] Adding Separate OpenMP Offloading Backend to `libcxx/include/__algorithm/pstl_backends` (PR #66968)

Anton Rydahl via flang-commits flang-commits at lists.llvm.org
Mon Oct 30 10:16:19 PDT 2023


================
@@ -330,6 +330,23 @@ def getStdFlag(cfg, std):
         default=f"{shlex.quote(sys.executable)} {shlex.quote(str(Path(__file__).resolve().parent.parent.parent / 'run.py'))}",
         help="Custom executor to use instead of the configured default.",
         actions=lambda executor: [AddSubstitution("%{executor}", executor)],
+    ),
+    Parameter(
+        name="openmp_pstl_backend",
+        choices=[True, False],
+        type=bool,
+        default=False,
+        help="Enable the OpenMP compilation toolchain if the PSTL backend was set to OpenMP.",
+        actions=lambda enabled: [
+            AddCompileFlag("-fopenmp"),
+            # The linker needs to find the correct version of libomptarget
+            AddLinkFlag("-Wl,-rpath,%{lib}/../../lib"),
+            AddLinkFlag("-L%{lib}/../../lib"),
+            #  The preprocessor needs to find the omp.h header
+            AddFlag("-I %{lib}/../../runtimes/runtimes-bins/openmp/runtime/src"),
+            # If the OpenMP PSTL backend was enbaled, we wish to run the tests for it
----------------
AntonRydahl wrote:

Hi @jhuber6 and @jdoerfert. @ldionne and I just discussed how to modify the `libc++` test configuration to be able to offload to GPUs. I could not get it to work without appending linking and include paths. Do you think `clang` should automatically look for `libomptarget.so` and `omp.h` in the correct places, or is it really necessary to add the paths?

https://github.com/llvm/llvm-project/pull/66968


More information about the flang-commits mailing list