[all-commits] [llvm/llvm-project] 2b97b1: [OpenMP] Add option to make offloading mandatory

Joseph Huber via All-commits all-commits at lists.llvm.org
Wed Feb 23 13:45:52 PST 2022


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 2b97b16f294af91281d8a138759f3f772952a902
      https://github.com/llvm/llvm-project/commit/2b97b16f294af91281d8a138759f3f772952a902
  Author: Joseph Huber <jhuber6 at vols.utk.edu>
  Date:   2022-02-23 (Wed, 23 Feb 2022)

  Changed paths:
    M clang/include/clang/Basic/LangOptions.def
    M clang/include/clang/Driver/Options.td
    M clang/lib/CodeGen/CGOpenMPRuntime.cpp
    M clang/lib/CodeGen/CGStmtOpenMP.cpp
    M clang/lib/Driver/ToolChains/Clang.cpp
    M clang/lib/Sema/SemaOpenMP.cpp
    A clang/test/OpenMP/target_offload_mandatory_codegen.cpp

  Log Message:
  -----------
  [OpenMP] Add option to make offloading mandatory

Currently when we generate OpenMP offloading code we always make
fallback code for the CPU. This is necessary for implementing features
like conditional offloading and ensuring that unhandled pragmas don't
result in missing symbols. However, this is problematic for a few cases.
For offloading tests we can silently fail to the host without realizing
that offloading failed. Additionally, this makes it impossible to
provide interoperabiility to other offloading schemes like HIP or CUDA
because those methods do not provide any such host fallback guaruntee.
this patch adds the `-fopenmp-offload-mandatory` flag to prevent
generating the fallback symbol on the CPU and instead replaces the
function with a dummy global and the failed branch with 'unreachable'.

Reviewed By: ABataev

Differential Revision: https://reviews.llvm.org/D120353




More information about the All-commits mailing list