[all-commits] [llvm/llvm-project] f20b67: [Flang][MLIR][OpenMP] Improve device-only function...

Sergio Afonso via All-commits all-commits at lists.llvm.org
Thu Aug 10 03:30:16 PDT 2023


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: f20b67a81c66f44ab2f57b5a2fce04dafe758a86
      https://github.com/llvm/llvm-project/commit/f20b67a81c66f44ab2f57b5a2fce04dafe758a86
  Author: Sergio Afonso <safonsof at amd.com>
  Date:   2023-08-10 (Thu, 10 Aug 2023)

  Changed paths:
    M flang/include/flang/Optimizer/Transforms/Passes.td
    M flang/lib/Frontend/FrontendActions.cpp
    M flang/lib/Optimizer/Transforms/OMPFunctionFiltering.cpp
    M flang/test/Lower/OpenMP/function-filtering-2.f90
    M flang/test/Lower/OpenMP/function-filtering.f90
    M flang/test/Transforms/omp-function-filtering.mlir
    M mlir/lib/Target/LLVMIR/Dialect/OpenMP/OpenMPToLLVMIRTranslation.cpp
    M mlir/test/Target/LLVMIR/openmp-llvm.mlir

  Log Message:
  -----------
  [Flang][MLIR][OpenMP] Improve device-only function filtering

This patch improves the implementation of a recent function filtering
workaround to address problems uncovered by D154247.

In particular, the problem was related to the removal of functions called from
within target regions. Since target regions have to remain until LLVM IR is
generated, removing these functions from MLIR results in undefined references
any time there are calls to them in a target region. This patch modifies the
MLIR function filtering pass to make these functions "external" rather than
removing them. This way, the processing and lowering of MLIR functions that
will eventually be discarded is still prevented, but no calls to undefined
functions remain either.

Additionally, the approach of just filtering host-only functions during device
compilation, and not filtering device-only functions during host compilation,
is maintained. This is because code generation for device-only functions is
required for host fallback to work.

Depends on D156988

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




More information about the All-commits mailing list