This patch introduces an alternative calling convention for
MemRef function arguments in LLVM dialect. It converts MemRef
function arguments to LLVM bare pointers to the MemRef element
type instead of creating a MemRef descriptor. Bare pointers are
then promoted to a MemRef descriptors at the beginning of the
function. This calling convention is only enabled with a flag.
This is a stepping stone towards having an alternative and simpler
lowering for MemRefs when dynamic shapes are not needed. It can
also be used to temporarily overcome the issue with passing 'noalias'
attribute for MemRef arguments, discussed in [1, 2], since we can
now convert:
func @check_noalias(%static : memref<2xf32> {llvm.noalias = true}) {
return
}
into:
llvm.func @check_noalias(%arg0: !llvm<"float*"> {llvm.noalias = true}) {
%0 = llvm.mlir.undef ... %1 = llvm.insertvalue %arg0, %0[0] ... %2 = llvm.insertvalue %arg0, %1[1] ... ... llvm.return
}
Related discussion:
[1] https://github.com/tensorflow/mlir/issues/309 [2] https://github.com/tensorflow/mlir/pull/337
-> /