[all-commits] [llvm/llvm-project] e77dd2: [Flang][OpenMP] Minimize host ops remaining in dev...

Sergio Afonso via All-commits all-commits at lists.llvm.org
Thu Apr 24 07:45:52 PDT 2025


  Branch: refs/heads/users/skatrak/map-rework-03-rm-host-ops
  Home:   https://github.com/llvm/llvm-project
  Commit: e77dd2a17cd9110d62beb574e039fae55f6c0d65
      https://github.com/llvm/llvm-project/commit/e77dd2a17cd9110d62beb574e039fae55f6c0d65
  Author: Sergio Afonso <safonsof at amd.com>
  Date:   2025-04-24 (Thu, 24 Apr 2025)

  Changed paths:
    M flang/include/flang/Optimizer/OpenMP/Passes.td
    M flang/lib/Optimizer/OpenMP/FunctionFiltering.cpp
    M flang/test/Lower/OpenMP/declare-target-link-tarop-cap.f90
    M flang/test/Lower/OpenMP/host-eval.f90
    M flang/test/Lower/OpenMP/real10.f90
    A flang/test/Transforms/OpenMP/function-filtering-host-ops.mlir
    A flang/test/Transforms/OpenMP/function-filtering.mlir
    R flang/test/Transforms/omp-function-filtering.mlir

  Log Message:
  -----------
  [Flang][OpenMP] Minimize host ops remaining in device compilation

This patch updates the function filtering OpenMP pass intended to remove host
functions from the MLIR module created by Flang lowering when targeting an
OpenMP target device.

Host functions holding target regions must be kept, so that the target regions
within them can be translated for the device. The issue is that non-target
operations inside these functions cannot be discarded because some of them hold
information that is also relevant during target device codegen. Specifically,
mapping information resides outside of `omp.target` regions.

This patch updates the previous behavior where all host operations were
preserved to then ignore all of those that are not actually needed by target
device codegen. This, in practice, means only keeping target regions and mapping
information needed by the device. Arguments for some of these remaining
operations are replaced by placeholder allocations and `fir.undefined`, since
they are only actually defined inside of the target regions themselves.

As a result, this set of changes makes it possible to later simplify target
device codegen, as it is no longer necessary to handle host operations
differently to avoid issues.



To unsubscribe from these emails, change your notification settings at https://github.com/llvm/llvm-project/settings/notifications


More information about the All-commits mailing list