[all-commits] [llvm/llvm-project] 632306: [mlir] support returning unranked memrefs
ftynse via All-commits
all-commits at lists.llvm.org
Fri Jun 26 06:37:58 PDT 2020
Branch: refs/heads/master
Home: https://github.com/llvm/llvm-project
Commit: 6323065fd6026de926b15bb609f4601e366a300c
https://github.com/llvm/llvm-project/commit/6323065fd6026de926b15bb609f4601e366a300c
Author: Alex Zinenko <zinenko at google.com>
Date: 2020-06-26 (Fri, 26 Jun 2020)
Changed paths:
M mlir/docs/ConversionToLLVMDialect.md
M mlir/include/mlir/Conversion/StandardToLLVM/ConvertStandardToLLVM.h
M mlir/include/mlir/Dialect/LLVMIR/LLVMOps.td
M mlir/lib/Conversion/StandardToLLVM/StandardToLLVM.cpp
M mlir/test/Conversion/StandardToLLVM/calling-convention.mlir
M mlir/test/Dialect/LLVMIR/roundtrip.mlir
M mlir/test/Target/llvmir-intrinsics.mlir
M mlir/test/mlir-cpu-runner/unranked_memref.mlir
Log Message:
-----------
[mlir] support returning unranked memrefs
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
More information about the All-commits
mailing list