[Mlir-commits] [mlir] [mlir] [memref] Elevate `AllocOp`s to `GlobalOp`s pass (PR #211141)
Federico Bruzzone
llvmlistbot at llvm.org
Fri Jul 24 05:17:50 PDT 2026
FedericoBruzzone wrote:
I've been struggling with various issues on the LLVM side regarding aspects related to _promote_ allocations :D
And in my experience, these are very delicate aspects that require a great deal of attention.
I'd like to ask a few questions (just to confirm a few points 🫶):
1. `memref.alloc` is a per-call-site allocation. `memref.global` is process-lifetime, i.e., shared. Is correct to affirm that the _promotion_ is correct only when the function is never called concurrently or recursively?
2. A note: "global_alloc" is hardcoded. While the SymbolTable will rename the subsequent insertions, should we want it to behave this way?
3. The PR removes all `memref.dealloc` uses of the `alloc`. But what if a `dealloc` dominates a second `alloc` of the same type? 🤔
4. I don't want to sound tedious, but, unless I'm missing something (it's possible), we should consider whether the allocator [escapes the current function](https://en.wikipedia.org/wiki/Escape_analysis). Right?
5. MLIR has `alloca_to_global`. Is there a way to eventually reuse this logic?
https://github.com/llvm/llvm-project/blob/82488f0e7119dd05cd63329458733e8c295f0338/mlir/include/mlir/Dialect/MemRef/TransformOps/MemRefTransformOps.td#L147-L157
https://github.com/llvm/llvm-project/pull/211141
More information about the Mlir-commits
mailing list