[all-commits] [llvm/llvm-project] 9e60e4: [MLIR][OpenMP] Explicit tagging of combined constr...

Sergio Afonso via All-commits all-commits at lists.llvm.org
Fri Jun 12 04:48:11 PDT 2026


  Branch: refs/heads/users/skatrak/flang-generic-14-explicit-combined
  Home:   https://github.com/llvm/llvm-project
  Commit: 9e60e473c03672a588413fa72b43bf97b5fdb818
      https://github.com/llvm/llvm-project/commit/9e60e473c03672a588413fa72b43bf97b5fdb818
  Author: Sergio Afonso <Sergio.AfonsoFumero at amd.com>
  Date:   2026-06-12 (Fri, 12 Jun 2026)

  Changed paths:
    M mlir/include/mlir/Dialect/OpenMP/OpenMPOps.td
    M mlir/include/mlir/Dialect/OpenMP/OpenMPOpsInterfaces.td
    M mlir/lib/Dialect/OpenMP/IR/OpenMPDialect.cpp
    M mlir/lib/Target/LLVMIR/Dialect/OpenMP/OpenMPToLLVMIRTranslation.cpp
    M mlir/test/Conversion/OpenMPToLLVM/convert-to-llvmir.mlir
    A mlir/test/Dialect/OpenMP/invalid-interface.mlir
    M mlir/test/Dialect/OpenMP/invalid.mlir
    M mlir/test/Dialect/OpenMP/ops.mlir
    M mlir/test/Dialect/OpenMP/stack-to-shared.mlir
    M mlir/test/Target/LLVMIR/allocatable_gpu_reduction.mlir
    M mlir/test/Target/LLVMIR/allocatable_gpu_reduction_teams.mlir
    M mlir/test/Target/LLVMIR/omptarget-debug-loop-loc.mlir
    M mlir/test/Target/LLVMIR/omptarget-memcpy-align-metadata.mlir
    M mlir/test/Target/LLVMIR/omptarget-multi-block-reduction.mlir
    M mlir/test/Target/LLVMIR/omptarget-multi-reduction.mlir
    M mlir/test/Target/LLVMIR/omptarget-private-llvm.mlir
    M mlir/test/Target/LLVMIR/omptarget-teams-distribute-reduction-array-descriptor.mlir
    M mlir/test/Target/LLVMIR/openmp-data-target-device.mlir
    M mlir/test/Target/LLVMIR/openmp-nested-task-target-parallel.mlir
    M mlir/test/Target/LLVMIR/openmp-target-generic-spmd.mlir
    M mlir/test/Target/LLVMIR/openmp-target-launch-device.mlir
    M mlir/test/Target/LLVMIR/openmp-target-spmd.mlir
    M mlir/test/Target/LLVMIR/openmp-taskloop-bounds-cast.mlir
    M mlir/test/Target/LLVMIR/openmp-taskloop-cancel.mlir
    M mlir/test/Target/LLVMIR/openmp-taskloop-cancellation-point.mlir
    M mlir/test/Target/LLVMIR/openmp-taskloop-collapse.mlir
    M mlir/test/Target/LLVMIR/openmp-taskloop-context-alloca.mlir
    M mlir/test/Target/LLVMIR/openmp-taskloop-final.mlir
    M mlir/test/Target/LLVMIR/openmp-taskloop-grainsize.mlir
    M mlir/test/Target/LLVMIR/openmp-taskloop-if.mlir
    M mlir/test/Target/LLVMIR/openmp-taskloop-local-bounds.mlir
    M mlir/test/Target/LLVMIR/openmp-taskloop-mergeable.mlir
    M mlir/test/Target/LLVMIR/openmp-taskloop-no-context-struct.mlir
    M mlir/test/Target/LLVMIR/openmp-taskloop-nogroup.mlir
    M mlir/test/Target/LLVMIR/openmp-taskloop-num_tasks.mlir
    M mlir/test/Target/LLVMIR/openmp-taskloop-outer-bounds.mlir
    M mlir/test/Target/LLVMIR/openmp-taskloop-priority.mlir
    M mlir/test/Target/LLVMIR/openmp-taskloop-untied.mlir
    M mlir/test/Target/LLVMIR/openmp-taskloop.mlir
    M mlir/test/Target/LLVMIR/openmp-teams-clauses-trunc-ext.mlir
    M mlir/test/Target/LLVMIR/openmp-todo.mlir

  Log Message:
  -----------
  [MLIR][OpenMP] Explicit tagging of combined constructs

Combined OpenMP constructs, such as `parallel do`, which represent
nests of constructs where each one contains a single other construct
without any other directives or statements in between, are currently not
marked in any way in the MLIR representation.

This works because they don't usually require any specific handling
other than what would be done for the included operations. However, the
handling of `target` regions needs to know whether it was part of a
combined construct in order to properly optimize for the SPMD case and
detect when certain clauses must be inconditionally evaluated in the
host.

So far, this has been achieved by having some MLIR pattern-matching
logic to infer whether a nest of operations could have potentially been
produced for a combined construct. This approach is error prone,
computationally expensive and it can't really work in the general case.
On the other hand, a compiler frontend can easily tell the difference
and tag MLIR operations accordingly.

This patch extends the `ComposableOpInterface` of the OpenMP dialect to
handle a new `omp.combined` attribute that must be set for all leafs
(except for the innermost one) on a combined construct. Verification
logic is added for this interface, which is added to all operations that
can be used as part of a combined construct, and the previous
`target`-related pattern-matching logic is removed.

This patch has to be followed up with Flang lowering changes.



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