[Codegen] Add lowering functions for extract
/slice
/insert
#925
Labels
feature
missing/requested features
extract
/slice
/insert
#925
In order to run scripts using the
--mlir-codegen
cli flag with little to no dependence on pre-compiled kernels it would be beneficial to be able to lowerextract
,slice
, andinsert
operations to other MLIR dialects. In many cases, this can help to avoid converting aDenseMatrix
to aMemRef
and back between operations that support codegen and those that do not. The three mentioned operations are very common and should be straight-forward to implement.A possible approach is to lower these to a
Linalg GenericOp
with (one of) the inputMemRef
being the result of aMemRef SubViewOp
. An example of this combination can be found insrc/compiler/lowering/AggDimOpLowering.cpp
.SubViewOp
takesOffsets
,Sizes
, andStrides
as arguments which can easily implement a view on a single row for example, by settingoffset: (1,0), sizes: (1, numCols), strides: (1,1)
to create a view on the 2nd row of a MemRef if I am not mistaken.The text was updated successfully, but these errors were encountered: