[MLIR] Generic 'malloc', 'aligned_alloc' and 'free' functions
authorMichele Scuttari <mscuttari@users.noreply.github.com>
Mon, 18 Jul 2022 15:47:18 +0000 (17:47 +0200)
committerAlex Zinenko <zinenko@google.com>
Mon, 18 Jul 2022 15:58:58 +0000 (17:58 +0200)
commit3e21fb616d9a1b29bf9d1a1ba484add633d6d5b3
tree95a0eb4918bcb9d6c9eb2dff8c078f390223c7f9
parent344378808778c61d5599f4e0ac783ef7e6f8ed05
[MLIR] Generic 'malloc', 'aligned_alloc' and 'free' functions

When converted to the LLVM dialect, the memref.alloc and memref.free operations were generating calls to hardcoded 'malloc' and 'free' functions. This didn't leave any freedom to users to provide their custom implementation. Those operations now convert into calls to '_mlir_alloc' and '_mlir_free' functions, which have also been implemented into the runtime support library as wrappers to 'malloc' and 'free'. The same has been done for the 'aligned_alloc' function.

Reviewed By: ftynse

Differential Revision: https://reviews.llvm.org/D128791
24 files changed:
mlir/docs/Tutorials/Toy/Ch-6.md
mlir/examples/toy/Ch6/CMakeLists.txt
mlir/examples/toy/Ch6/include/toy/Passes.h
mlir/examples/toy/Ch6/mlir/AllocRenamingPass.cpp [new file with mode: 0644]
mlir/examples/toy/Ch6/toyc.cpp
mlir/examples/toy/Ch7/CMakeLists.txt
mlir/examples/toy/Ch7/include/toy/Passes.h
mlir/examples/toy/Ch7/mlir/AllocRenamingPass.cpp [new file with mode: 0644]
mlir/examples/toy/Ch7/toyc.cpp
mlir/include/mlir/Dialect/LLVMIR/FunctionCallUtils.h
mlir/lib/Conversion/AsyncToLLVM/AsyncToLLVM.cpp
mlir/lib/Conversion/MemRefToLLVM/MemRefToLLVM.cpp
mlir/lib/Dialect/LLVMIR/IR/FunctionCallUtils.cpp
mlir/lib/ExecutionEngine/RunnerUtils.cpp
mlir/lib/Target/LLVMIR/ModuleTranslation.cpp
mlir/test/Conversion/AsyncToLLVM/convert-coro-to-llvm.mlir
mlir/test/Conversion/AsyncToLLVM/convert-to-llvm.mlir
mlir/test/Conversion/FuncToLLVM/calling-convention.mlir
mlir/test/Conversion/MemRefToLLVM/convert-dynamic-memref-ops.mlir
mlir/test/Conversion/MemRefToLLVM/convert-static-memref-ops.mlir
mlir/test/Target/LLVMIR/llvmir.mlir
mlir/test/mlir-cpu-runner/bare-ptr-call-conv.mlir
mlir/test/mlir-cpu-runner/sgemm-naive-codegen.mlir
mlir/test/mlir-cpu-runner/simple.mlir