[all-commits] [llvm/llvm-project] d6061d: [Flang][OpenMP] Add pass to replace allocas with d...

Sergio Afonso via All-commits all-commits at lists.llvm.org
Mon Apr 27 05:14:41 PDT 2026


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: d6061d297d3c4f462a84bd77f182d191d982ac5d
      https://github.com/llvm/llvm-project/commit/d6061d297d3c4f462a84bd77f182d191d982ac5d
  Author: Sergio Afonso <safonsof at amd.com>
  Date:   2026-04-27 (Mon, 27 Apr 2026)

  Changed paths:
    M flang/include/flang/Optimizer/Support/InitFIR.h
    M flang/lib/Optimizer/Passes/Pipelines.cpp
    M flang/test/Fir/basic-program.fir
    M mlir/docs/Passes.md
    M mlir/include/mlir/Dialect/OpenMP/Transforms/Passes.h
    M mlir/include/mlir/Dialect/OpenMP/Transforms/Passes.td
    M mlir/lib/Dialect/OpenMP/CMakeLists.txt
    A mlir/lib/Dialect/OpenMP/IR/CMakeLists.txt
    M mlir/lib/Dialect/OpenMP/Transforms/CMakeLists.txt
    A mlir/lib/Dialect/OpenMP/Transforms/StackToShared.cpp
    A mlir/test/Dialect/OpenMP/stack-to-shared.mlir

  Log Message:
  -----------
  [Flang][OpenMP] Add pass to replace allocas with device shared memory (#161863)

This patch introduces a new Flang OpenMP MLIR pass, only ran for target
device modules, that identifies `fir.alloca` operations that should use
device shared memory and replaces them with pairs of
`omp.alloc_shared_mem` and `omp.free_shared_mem` operations.

This works in conjunction to the MLIR to LLVM IR translation pass'
handling of privatization, mapping and reductions in the OpenMP dialect
to properly select the right memory space for allocations based on where
they are made and where they are used.

This pass, in particular, handles explicit stack allocations in MLIR,
whereas the aforementioned translation pass takes care of implicit ones
represented by entry block arguments.



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