[all-commits] [llvm/llvm-project] 593f40: [MLIR][OpenMP] Prevent loop wrapper translation cr...

Sergio Afonso via All-commits all-commits at lists.llvm.org
Fri Feb 14 07:37:39 PST 2025


  Branch: refs/heads/users/skatrak/target-spmd-01-loop-refactor
  Home:   https://github.com/llvm/llvm-project
  Commit: 593f40181a6fcf68606d1046256d724ad0af843a
      https://github.com/llvm/llvm-project/commit/593f40181a6fcf68606d1046256d724ad0af843a
  Author: Sergio Afonso <safonsof at amd.com>
  Date:   2025-02-14 (Fri, 14 Feb 2025)

  Changed paths:
    M mlir/lib/Target/LLVMIR/Dialect/OpenMP/OpenMPToLLVMIRTranslation.cpp

  Log Message:
  -----------
  [MLIR][OpenMP] Prevent loop wrapper translation crashes

This patch updates the `convertOmpOpRegions` translation function to prevent
calling it for a loop wrapper region from causing a compiler crash due to a
lack of terminator operations.

This problem is currently not triggered because there are no cases for which
the region of a loop wrapper is passed to that function. This might have to
change in order to support composite construct translation to LLVM IR.


  Commit: 1130774685396ded30a352539f36b7cef4f63293
      https://github.com/llvm/llvm-project/commit/1130774685396ded30a352539f36b7cef4f63293
  Author: Sergio Afonso <safonsof at amd.com>
  Date:   2025-02-14 (Fri, 14 Feb 2025)

  Changed paths:
    M mlir/lib/Target/LLVMIR/Dialect/OpenMP/OpenMPToLLVMIRTranslation.cpp
    M mlir/test/Target/LLVMIR/openmp-llvm.mlir
    M mlir/test/Target/LLVMIR/openmp-simd-private.mlir

  Log Message:
  -----------
  [MLIR][OpenMP] Normalize lowering of omp.loop_nest

This patch refactors the translation of `omp.loop_nest` operations into LLVM IR
so that it is handled similarly to other operations. Before this change, the
responsibility of translating the loop nest fell into each loop wrapper,
causing code duplication. This patch centralizes that handling of the loop.

As a result, it is now expected that the handling of composite constructs is
performed collaboratively among translating functions for each operation
involved. At the moment, only `do/for simd` is supported by ignoring SIMD
information, and this behavior is preserved.

The translation of loop wrapper operations need access to the
`llvm::CanonicalLoopInfo` loop information structure in order to apply
transformations to it. This is now created in the nested call to
`convertOmpLoopNest`, so it needs to be passed up to all associated loop
wrapper translation functions. This is done via the creation of an
`OpenMPLoopInfoStackFrame` within `convertOmpLoopNest` and its removal after
its outermost associated loop wrapper has been translated.


Compare: https://github.com/llvm/llvm-project/compare/593f40181a6f%5E...113077468539

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