[all-commits] [llvm/llvm-project] bf7b2c: [Flang][MLIR][OpenMP] Move function filtering to t...

Sergio Afonso via All-commits all-commits at lists.llvm.org
Wed Aug 5 03:22:28 PDT 2026


  Branch: refs/heads/users/skatrak/omp-func-filter-01-pass
  Home:   https://github.com/llvm/llvm-project
  Commit: bf7b2c660260b2d77430051ad9b35681a35d05b0
      https://github.com/llvm/llvm-project/commit/bf7b2c660260b2d77430051ad9b35681a35d05b0
  Author: Sergio Afonso <Sergio.AfonsoFumero at amd.com>
  Date:   2026-08-05 (Wed, 05 Aug 2026)

  Changed paths:
    M flang/include/flang/Optimizer/OpenMP/Passes.td
    M flang/lib/Optimizer/OpenMP/CMakeLists.txt
    R flang/lib/Optimizer/OpenMP/FunctionFiltering.cpp
    A flang/lib/Optimizer/OpenMP/UnimplementedDeviceCheck.cpp
    M flang/lib/Optimizer/Passes/Pipelines.cpp
    M flang/test/Fir/basic-program.fir
    A flang/test/Integration/OpenMP/function-filtering-2.f90
    A flang/test/Integration/OpenMP/function-filtering-3.f90
    A flang/test/Integration/OpenMP/function-filtering-4.f90
    A flang/test/Integration/OpenMP/function-filtering.f90
    M flang/test/Lower/OpenMP/declare-target-deferred-marking-reductions.f90
    M flang/test/Lower/OpenMP/declare-target-deferred-marking.f90
    M flang/test/Lower/OpenMP/declare-target-implicit-func-and-subr-cap-enter.f90
    M flang/test/Lower/OpenMP/declare-target-implicit-func-and-subr-cap.f90
    M flang/test/Lower/OpenMP/declare-target-implicit-tarop-cap.f90
    M flang/test/Lower/OpenMP/declare-target-named-main-interface.f90
    R flang/test/Lower/OpenMP/function-filtering-2.f90
    R flang/test/Lower/OpenMP/function-filtering-3.f90
    R flang/test/Lower/OpenMP/function-filtering-4.f90
    R flang/test/Lower/OpenMP/function-filtering.f90
    R flang/test/Transforms/OpenMP/function-filtering.mlir
    M flang/test/Transforms/omp-function-filtering-todo.mlir
    M mlir/include/mlir/Dialect/OpenMP/Transforms/Passes.td
    M mlir/lib/Dialect/OpenMP/Transforms/CMakeLists.txt
    A mlir/lib/Dialect/OpenMP/Transforms/FunctionFiltering.cpp
    A mlir/test/Dialect/OpenMP/function-filter.mlir

  Log Message:
  -----------
  [Flang][MLIR][OpenMP] Move function filtering to the omp dialect

The `FunctionFilteringPass`, which removes host-only functions when
compiling for an OpenMP target device, is currently defined only for
Flang. However, it implements logic that would generally be useful for
other frontends that can generate OpenMP offloading code. This patch
makes that transition by implementing the following changes:
- It rewrites the `FunctionFilteringPass` to work on lower level non-FIR
  MLIR modules.
- It splits off preexisting logic to check for not-yet-implemented target
  device features during function filtering to its own pass and it improves
  context detection to properly diagnostic only device code.
- It delays function filtering to run at the end of the pipeline, as well
  as the `MarkDeclareTargetPass`. This will enable the latter to run
  only once in the pipeline after the `UnimplementedDeviceCheckPass`
  becomes no longer necessary.

One side effect of these changes is that delaying the filtering will
cause all following passes to process host functions that are eventually
deleted. On the other hand, it minimizes divergence between host and
device MLIR modules making passes such as the `DeleteUnreachableTargets`
no longer necessary, as well as allowing passes to introduce new host
functions without causing problems on the device.



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