forked from OSchip/llvm-project
6323065fd6
Initially, unranked memref descriptors in the LLVM dialect were designed only to be passed into functions. An assertion was guarding against returning unranked memrefs from functions in the standard-to-LLVM conversion. This is insufficient for functions that wish to return an unranked memref such that the caller does not know the rank in advance, and hence cannot allocate the descriptor and pass it in as an argument. Introduce a calling convention for returning unranked memref descriptors as follows. An unranked memref descriptor always points to a ranked memref descriptor stored on stack of the current function. When an unranked memref descriptor is returned from a function, the ranked memref descriptor it points to is copied to dynamically allocated memory, the ownership of which is transferred to the caller. The caller is responsible for deallocating the dynamically allocated memory and for copying the pointed-to ranked memref descriptor onto its stack. Provide default lowerings for std.return, std.call and std.indirect_call that maintain the conversion defined above. This convention is additionally exercised by a runtime test to guard against memory errors. Differential Revision: https://reviews.llvm.org/D82647 |
||
---|---|---|
.. | ||
include | ||
CMakeLists.txt | ||
bare_ptr_call_conv.mlir | ||
linalg_integration_test.mlir | ||
lit.local.cfg | ||
mlir_test_cblas.cpp | ||
mlir_test_cblas_interface.cpp | ||
sgemm_naive_codegen.mlir | ||
simple.mlir | ||
unranked_memref.mlir | ||
utils.mlir |