llvm-project/mlir
William S. Moses 670aeece51 [MLIR][OpenMP][SCF] Mark parallel regions as allocation scopes
MLIR has the notion of allocation scopes which specify that stack allocations (e.g. memref.alloca, llvm.alloca) should be freed or equivalently aren't available at the end of the corresponding region.
Currently neither OpenMP parallel nor SCF parallel regions have the notion of such a scope.

This clearly makes sense for an OpenMP parallel as this is implemented in with a new function which outlines the region, and clearly any allocations in that newly outlined function have a lifetime that ends at the return of the function, by definition.

While SCF.parallel doesn't have a guaranteed runtime which it is implemented with, this similarly makes sense for SCF.parallel since otherwise an allocation within an SCF.parallel will needlessly continue to allocate stack memory that isn't cleaned up until the function (or other allocation scope op) which contains the SCF.parallel returns. This means that it is impossible to represent thread or iteration-local memory without causing a stack blow-up. In the case that this stack-blow-up behavior is intended, this can be equivalently represented with an allocation outside of the SCF.parallel with a size equal to the number of iterations.

Reviewed By: ftynse

Differential Revision: https://reviews.llvm.org/D119743
2022-02-18 11:06:32 -05:00
..
benchmark/python [mlir] Use sparse-compiler pass in sparse benchmark 2022-02-09 20:16:47 +00:00
cmake/modules [mlir] Do not use an empty source file when building aggregate libraries. 2022-02-05 23:06:28 -08:00
docs [MLIR] add entry block to MLIR grammar. 2022-02-17 15:40:43 +05:30
examples [mlir] Update Toy operations to use the `hasCustomAssemblyFormat` field 2022-02-07 19:03:58 -08:00
include [MLIR][OpenMP][SCF] Mark parallel regions as allocation scopes 2022-02-18 11:06:32 -05:00
lib [mlir][ODS] Infer return types if the operands are variadic but the results are not 2022-02-18 15:29:06 +01:00
python [mlir][OpDSL] Restructure comprehension.py (NFC). 2022-02-14 12:56:01 +00:00
test [MLIR][OpenMP][SCF] Mark parallel regions as allocation scopes 2022-02-18 11:06:32 -05:00
tools [mlir] Added oilist primitive 2022-02-17 11:10:24 +05:30
unittests Rename PatternRewriteSet::insert to add 2022-02-18 12:18:41 +01:00
utils [mlir][spirv] Add OpenCL fma op and lowering 2022-02-15 11:28:20 +03:00
.clang-format
.clang-tidy Enable readability-redundant-smartptr-get in MLIR local clang-tidy config 2022-01-08 20:07:11 +00:00
CMakeLists.txt [mlir] Set up boilerplate build for MLIR benchmarks 2022-01-27 21:38:15 +00:00
LICENSE.TXT
README.md

README.md

Multi-Level Intermediate Representation

See https://mlir.llvm.org/ for more information.