[all-commits] [llvm/llvm-project] 8cd49c: [Flang][MLIR][OpenMP] Explicitly represent omp.tar...
Sergio Afonso via All-commits
all-commits at lists.llvm.org
Thu Jun 25 04:42:15 PDT 2026
Branch: refs/heads/main
Home: https://github.com/llvm/llvm-project
Commit: 8cd49c6f64f2e2b14853ae79bbecd78797d8f2a5
https://github.com/llvm/llvm-project/commit/8cd49c6f64f2e2b14853ae79bbecd78797d8f2a5
Author: Sergio Afonso <safonsof at amd.com>
Date: 2026-06-25 (Thu, 25 Jun 2026)
Changed paths:
M clang/test/CIR/Lowering/omp-target-map.cir
M clang/test/CIR/Transforms/omp-mark-declare-target.cir
M flang/lib/Lower/OpenMP/ClauseProcessor.cpp
M flang/lib/Lower/OpenMP/ClauseProcessor.h
M flang/lib/Lower/OpenMP/OpenMP.cpp
M flang/lib/Optimizer/OpenMP/DoConcurrentConversion.cpp
M flang/lib/Optimizer/OpenMP/LowerWorkdistribute.cpp
M flang/test/Analysis/AliasAnalysis/alias-analysis-omp-target-1.fir
M flang/test/Analysis/AliasAnalysis/alias-analysis-omp-target-2.fir
M flang/test/Fir/OpenMP/bounds-generation-for-char-arrays.f90
M flang/test/Fir/convert-to-llvm-openmp-and-fir.fir
M flang/test/Lower/OpenMP/DelayedPrivatization/target-private-allocatable.f90
M flang/test/Lower/OpenMP/DelayedPrivatization/target-private-implicit-scalar-map-2.f90
M flang/test/Lower/OpenMP/DelayedPrivatization/target-private-implicit-scalar-map.f90
M flang/test/Lower/OpenMP/DelayedPrivatization/target-private-simple.f90
M flang/test/Lower/OpenMP/DelayedPrivatization/target-teams-private-implicit-scalar-map.f90
M flang/test/Lower/OpenMP/KernelLanguage/bare-clause.f90
M flang/test/Lower/OpenMP/allocatable-dtype-intermediate-map-gen.f90
M flang/test/Lower/OpenMP/allocatable-map.f90
M flang/test/Lower/OpenMP/array-bounds.f90
M flang/test/Lower/OpenMP/attach-and-ref-modifier.f90
M flang/test/Lower/OpenMP/common-block-map.f90
M flang/test/Lower/OpenMP/declare-mapper.f90
M flang/test/Lower/OpenMP/default-mapper-no-pointer-map.f90
M flang/test/Lower/OpenMP/defaultmap.f90
M flang/test/Lower/OpenMP/depend-iterator.f90
M flang/test/Lower/OpenMP/derived-type-allocatable-map.f90
M flang/test/Lower/OpenMP/derived-type-map.f90
M flang/test/Lower/OpenMP/distribute-parallel-do-simd.f90
M flang/test/Lower/OpenMP/dyn-groupprivate-clause.f90
M flang/test/Lower/OpenMP/groupprivate.f90
M flang/test/Lower/OpenMP/implicit-mapper-no-pointer-map.f90
M flang/test/Lower/OpenMP/local-intrinsic-sized-array-map.f90
M flang/test/Lower/OpenMP/location.f90
M flang/test/Lower/OpenMP/map-character.f90
M flang/test/Lower/OpenMP/map-component-ref.f90
M flang/test/Lower/OpenMP/map-descriptor-deferral.f90
M flang/test/Lower/OpenMP/map-mapper.f90
M flang/test/Lower/OpenMP/optional-argument-map-2.f90
M flang/test/Lower/OpenMP/optional-argument-map-3.f90
M flang/test/Lower/OpenMP/target-map-complex.f90
M flang/test/Lower/OpenMP/target-parallel-private.f90
M flang/test/Lower/OpenMP/target-scope.f90
M flang/test/Lower/OpenMP/target-spmd.f90
M flang/test/Lower/OpenMP/target-teams-private.f90
M flang/test/Lower/OpenMP/target.f90
M flang/test/Lower/OpenMP/workdistribute-target-teams-clauses.f90
M flang/test/Lower/OpenMP/workdistribute.f90
M flang/test/Transforms/DoConcurrent/host_eval.f90
M flang/test/Transforms/DoConcurrent/local_device.mlir
M flang/test/Transforms/DoConcurrent/map_shape_info.f90
M flang/test/Transforms/DoConcurrent/multiple_iteration_ranges.f90
M flang/test/Transforms/DoConcurrent/non_reference_to_device.f90
M flang/test/Transforms/DoConcurrent/reduce_device.mlir
M flang/test/Transforms/OpenMP/delete-unreachable-targets.mlir
M flang/test/Transforms/OpenMP/function-filtering-host-ops.mlir
M flang/test/Transforms/OpenMP/function-filtering.mlir
M flang/test/Transforms/OpenMP/lower-workdistribute-fission-host.mlir
M flang/test/Transforms/OpenMP/lower-workdistribute-fission-target.mlir
M flang/test/Transforms/OpenMP/lower-workdistribute-runtime-assign-scalar.mlir
M flang/test/Transforms/OpenMP/simd-only.mlir
M flang/test/Transforms/debug-omp-target-op-1.fir
M flang/test/Transforms/debug-omp-target-op-2.fir
M flang/test/Transforms/omp-function-filtering-todo.mlir
M flang/test/Transforms/omp-map-info-finalization-implicit-field.fir
M flang/test/Transforms/omp-map-info-finalization-member-record.fir
M flang/test/Transforms/omp-map-info-finalization-name-loc.fir
M flang/test/Transforms/omp-map-info-finalization-usm.fir
M flang/test/Transforms/omp-map-info-finalization.fir
M flang/test/Transforms/omp-maps-for-privatized-symbols.fir
M mlir/include/mlir/Dialect/OpenMP/OpenMPClauseOperands.h
M mlir/include/mlir/Dialect/OpenMP/OpenMPClauses.td
M mlir/include/mlir/Dialect/OpenMP/OpenMPEnums.td
M mlir/include/mlir/Dialect/OpenMP/OpenMPOps.td
M mlir/lib/Dialect/OpenMP/IR/OpenMPDialect.cpp
M mlir/lib/Dialect/OpenMP/Utils/Utils.cpp
M mlir/lib/Target/LLVMIR/Dialect/OpenMP/OpenMPToLLVMIRTranslation.cpp
M mlir/test/Conversion/OpenMPToLLVM/convert-to-llvmir.mlir
M mlir/test/Dialect/OpenMP/canonicalize.mlir
M mlir/test/Dialect/OpenMP/invalid.mlir
M mlir/test/Dialect/OpenMP/omp-offload-privatization-prepare-by-value.mlir
M mlir/test/Dialect/OpenMP/omp-offload-privatization-prepare.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/omp-target-call-with-repeated-parameter.mlir
M mlir/test/Target/LLVMIR/omptarget-array-sectioning-host.mlir
M mlir/test/Target/LLVMIR/omptarget-atomic-capture-control-options.mlir
M mlir/test/Target/LLVMIR/omptarget-atomic-update-control-options.mlir
M mlir/test/Target/LLVMIR/omptarget-byref-bycopy-generation-device.mlir
M mlir/test/Target/LLVMIR/omptarget-byref-bycopy-generation-host.mlir
M mlir/test/Target/LLVMIR/omptarget-constant-alloca-raise.mlir
M mlir/test/Target/LLVMIR/omptarget-constant-indexing-device-region.mlir
M mlir/test/Target/LLVMIR/omptarget-debug-147063.mlir
M mlir/test/Target/LLVMIR/omptarget-debug-empty.mlir
M mlir/test/Target/LLVMIR/omptarget-debug-loop-loc.mlir
M mlir/test/Target/LLVMIR/omptarget-debug-map-link-loc.mlir
M mlir/test/Target/LLVMIR/omptarget-debug-nowait.mlir
M mlir/test/Target/LLVMIR/omptarget-debug-record-pos.mlir
M mlir/test/Target/LLVMIR/omptarget-debug-var-1.mlir
M mlir/test/Target/LLVMIR/omptarget-debug-var-2.mlir
M mlir/test/Target/LLVMIR/omptarget-debug.mlir
M mlir/test/Target/LLVMIR/omptarget-debug2.mlir
M mlir/test/Target/LLVMIR/omptarget-declare-target-llvm-device-2.mlir
M mlir/test/Target/LLVMIR/omptarget-declare-target-llvm-device.mlir
M mlir/test/Target/LLVMIR/omptarget-declare-target-to-device.mlir
M mlir/test/Target/LLVMIR/omptarget-declare-target-to-host.mlir
M mlir/test/Target/LLVMIR/omptarget-depend-host-only.mlir
M mlir/test/Target/LLVMIR/omptarget-depend.mlir
M mlir/test/Target/LLVMIR/omptarget-device-shared-memory.mlir
M mlir/test/Target/LLVMIR/omptarget-device.mlir
M mlir/test/Target/LLVMIR/omptarget-fortran-common-block-host.mlir
M mlir/test/Target/LLVMIR/omptarget-groupprivate.mlir
M mlir/test/Target/LLVMIR/omptarget-host-ref-semantics.mlir
M mlir/test/Target/LLVMIR/omptarget-if-nowait.mlir
M mlir/test/Target/LLVMIR/omptarget-if.mlir
M mlir/test/Target/LLVMIR/omptarget-llvm.mlir
M mlir/test/Target/LLVMIR/omptarget-mapper-combined-entry.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-nested-ptr-record-type-mapping-host.mlir
M mlir/test/Target/LLVMIR/omptarget-nested-record-type-mapping-host.mlir
M mlir/test/Target/LLVMIR/omptarget-nowait-host-only.mlir
M mlir/test/Target/LLVMIR/omptarget-nowait-llvm.mlir
M mlir/test/Target/LLVMIR/omptarget-nowait.mlir
M mlir/test/Target/LLVMIR/omptarget-nullary-record-ptr-member-map.mlir
M mlir/test/Target/LLVMIR/omptarget-overlapping-record-member-map.mlir
M mlir/test/Target/LLVMIR/omptarget-parallel-llvm-debug.mlir
M mlir/test/Target/LLVMIR/omptarget-parallel-llvm.mlir
M mlir/test/Target/LLVMIR/omptarget-private-llvm.mlir
M mlir/test/Target/LLVMIR/omptarget-record-type-mapping-host.mlir
M mlir/test/Target/LLVMIR/omptarget-record-type-with-ptr-member-host.mlir
M mlir/test/Target/LLVMIR/omptarget-region-device-llvm.mlir
M mlir/test/Target/LLVMIR/omptarget-region-host-device-llvm.mlir
M mlir/test/Target/LLVMIR/omptarget-region-host-only.mlir
M mlir/test/Target/LLVMIR/omptarget-region-llvm.mlir
M mlir/test/Target/LLVMIR/omptarget-region-parallel-llvm.mlir
M mlir/test/Target/LLVMIR/omptarget-runtimecc.mlir
M mlir/test/Target/LLVMIR/omptarget-target-cpu-features.mlir
M mlir/test/Target/LLVMIR/omptarget-teams-distribute-reduction-array-descriptor.mlir
M mlir/test/Target/LLVMIR/omptarget-teams-distribute-reduction.mlir
M mlir/test/Target/LLVMIR/omptarget-teams-reduction.mlir
M mlir/test/Target/LLVMIR/openmp-data-target-device.mlir
M mlir/test/Target/LLVMIR/openmp-iterator.mlir
M mlir/test/Target/LLVMIR/openmp-llvm-invalid.mlir
M mlir/test/Target/LLVMIR/openmp-nested-task-target-parallel.mlir
M mlir/test/Target/LLVMIR/openmp-private-allloca-hoisting.mlir
M mlir/test/Target/LLVMIR/openmp-target-default-as.mlir
M mlir/test/Target/LLVMIR/openmp-target-dyn-groupprivate.mlir
M mlir/test/Target/LLVMIR/openmp-target-generic-spmd.mlir
M mlir/test/Target/LLVMIR/openmp-target-has-device-addr.mlir
M mlir/test/Target/LLVMIR/openmp-target-launch-device.mlir
M mlir/test/Target/LLVMIR/openmp-target-launch-host.mlir
M mlir/test/Target/LLVMIR/openmp-target-multiple-private.mlir
M mlir/test/Target/LLVMIR/openmp-target-private-allocatable.mlir
M mlir/test/Target/LLVMIR/openmp-target-private-shared-mem.mlir
M mlir/test/Target/LLVMIR/openmp-target-private.mlir
M mlir/test/Target/LLVMIR/openmp-target-simd-on_device.mlir
M mlir/test/Target/LLVMIR/openmp-target-spmd-num-threads-i64.mlir
M mlir/test/Target/LLVMIR/openmp-target-spmd.mlir
M mlir/test/Target/LLVMIR/openmp-target-wsloop-private.mlir
M mlir/test/Target/LLVMIR/openmp-teams-clauses-trunc-ext.mlir
M mlir/test/Target/LLVMIR/openmp-todo.mlir
Log Message:
-----------
[Flang][MLIR][OpenMP] Explicitly represent omp.target kernel types (#186166)
Currently, the kernel type (i.e. `generic`, `spmd`, `spmd-no-loop` and
`bare`) of an `omp.target` operation is not an explicit attribute of the
operation. Rather, this is inferred based on the contents of its region
and clauses.
The problems with this approach are that it can be a potentially
resource intensive check for large kernels, and misidentifications are
prone to happen based on the presence of arbitrary operations from other
dialects.
Since the AST already contains the information needed to identify the
kernel type in a more reliable manner, this patch moves that
responsiblity to the Flang frontend. Other MLIR passes that create
`omp.target` operations are updated as well.
One known limitation of this approach is that the MLIR op verifier for
`omp.target` can't completely check that the contents of its region are
compatible with the declared kernel type without being exposed to the
same pattern-matching limitations that this patch is removing. Also, the
`TargetOp::getInnermostCapturedOmpOp()` function is maintained but,
ideally, a better solution should be implemented to remove its expensive
and potentially flaky checks from MLIR.
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