[all-commits] [llvm/llvm-project] c41792: [Flang][MLIR][OpenMP] Add explicit shared memory (...

Sergio Afonso via All-commits all-commits at lists.llvm.org
Thu Apr 16 05:07:55 PDT 2026


  Branch: refs/heads/users/skatrak/flang-generic-09-sharedmem-ops
  Home:   https://github.com/llvm/llvm-project
  Commit: c41792894e00285bf8f50b44875da8854ad7df0f
      https://github.com/llvm/llvm-project/commit/c41792894e00285bf8f50b44875da8854ad7df0f
  Author: Sergio Afonso <safonsof at amd.com>
  Date:   2026-04-16 (Thu, 16 Apr 2026)

  Changed paths:
    M flang/lib/Optimizer/CodeGen/CodeGenOpenMP.cpp
    M llvm/include/llvm/Frontend/OpenMP/OMPIRBuilder.h
    M llvm/lib/Frontend/OpenMP/OMPIRBuilder.cpp
    M mlir/include/mlir/Dialect/OpenMP/OpenMPOps.td
    M mlir/lib/Dialect/OpenMP/IR/OpenMPDialect.cpp
    M mlir/lib/Target/LLVMIR/Dialect/OpenMP/OpenMPToLLVMIRTranslation.cpp
    M mlir/test/Dialect/OpenMP/invalid.mlir
    M mlir/test/Dialect/OpenMP/ops.mlir

  Log Message:
  -----------
  [Flang][MLIR][OpenMP] Add explicit shared memory (de-)allocation ops

This patch introduces the `omp.alloc_shared_mem` and `omp.free_shared_mem`
operations to represent explicit allocations and deallocations of shared memory
across threads in a team, mirroring the existing `omp.target_allocmem` and
`omp.target_freemem`.

The `omp.alloc_shared_mem` op goes through the same Flang-specific
transformations as `omp.target_allocmem`, so that the size of the buffer can be
properly calculated when translating to LLVM IR.

The corresponding runtime functions produced for these new operations are
`__kmpc_alloc_shared` and `__kmpc_free_shared`, which previously could only be
created for implicit allocations (e.g. privatized and reduction variables).


  Commit: 8fbeede9bf5a927c11c6b31e18d4ff49aed932c2
      https://github.com/llvm/llvm-project/commit/8fbeede9bf5a927c11c6b31e18d4ff49aed932c2
  Author: Sergio Afonso <Sergio.AfonsoFumero at amd.com>
  Date:   2026-04-16 (Thu, 16 Apr 2026)

  Changed paths:
    M flang/lib/Optimizer/CodeGen/CodeGenOpenMP.cpp
    M mlir/include/mlir/Dialect/OpenMP/OpenMPOps.td
    M mlir/lib/Dialect/OpenMP/IR/OpenMPDialect.cpp
    M mlir/lib/Target/LLVMIR/Dialect/OpenMP/OpenMPToLLVMIRTranslation.cpp
    M mlir/test/Dialect/OpenMP/invalid.mlir
    M mlir/test/Dialect/OpenMP/ops.mlir
    A mlir/test/Target/LLVMIR/omptarget-device-shared-mem.mlir

  Log Message:
  -----------
  simplify omp.alloc_shared_mem


  Commit: 7af0d4b2e3a418a785b1f1b93d8bffb32dad11b2
      https://github.com/llvm/llvm-project/commit/7af0d4b2e3a418a785b1f1b93d8bffb32dad11b2
  Author: Sergio Afonso <Sergio.AfonsoFumero at amd.com>
  Date:   2026-04-16 (Thu, 16 Apr 2026)

  Changed paths:
    M mlir/include/mlir/Dialect/OpenMP/OpenMPClauses.td
    M mlir/include/mlir/Dialect/OpenMP/OpenMPOps.td
    M mlir/lib/Dialect/OpenMP/IR/OpenMPDialect.cpp
    M mlir/lib/Target/LLVMIR/Dialect/OpenMP/OpenMPToLLVMIRTranslation.cpp
    M mlir/test/Dialect/OpenMP/invalid.mlir
    M mlir/test/Dialect/OpenMP/ops.mlir
    M mlir/test/Target/LLVMIR/omptarget-device-shared-mem.mlir

  Log Message:
  -----------
  address review comments: make omp.free_shared_mem self-contained, update alignment handling for shared memory allocations


Compare: https://github.com/llvm/llvm-project/compare/bba8c43f6d23...7af0d4b2e3a4

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