Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Codegen] Add lowering functions for extract/slice/insert #925

Open
AlexRTer opened this issue Nov 29, 2024 · 0 comments
Open

[Codegen] Add lowering functions for extract/slice/insert #925

AlexRTer opened this issue Nov 29, 2024 · 0 comments
Labels
feature missing/requested features

Comments

@AlexRTer
Copy link
Collaborator

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 lower extract, slice, and insert operations to other MLIR dialects. In many cases, this can help to avoid converting a DenseMatrix to a MemRef 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 input MemRef being the result of a MemRef SubViewOp. An example of this combination can be found in src/compiler/lowering/AggDimOpLowering.cpp. SubViewOp takes Offsets, Sizes, and Strides as arguments which can easily implement a view on a single row for example, by setting offset: (1,0), sizes: (1, numCols), strides: (1,1) to create a view on the 2nd row of a MemRef if I am not mistaken.

@AlexRTer AlexRTer added the feature missing/requested features label Nov 29, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature missing/requested features
Projects
None yet
Development

No branches or pull requests

1 participant