-
Notifications
You must be signed in to change notification settings - Fork 65
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
[LDE: Project] 'Codegen-only compilation pipeline for LA operations' #935
base: main
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the PR.
This already looks promising! A few changes are needed and we should add test cases before merging this in.
containers/entrypoint-interactive.sh
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Remove these changes.
containers/run-docker-example.sh
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Remove these changes.
scripts/examples/slice.daph
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Remove this file and add proper testcases. Look at the testcases in test/codegen/
and test/api/cli/codegen
, there you will find different kind of tests for our codegen. FileCheck
based tests that verify the IR after a certain pass(es), and end-to-end tests that execute daphne
and verify the output. You should add a single file, e.g., test/codegen/sliceop.mlir
for the IR tests and a single .cpp
file for the end-to-end tests that compare the non codegen with the codegen'd execution of daphne
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Combine these into a single pass which has two rewrite patterns.
SmallVector<AffineMap, 2> indexMaps{AffineMap::getMultiDimIdentityMap(2, rewriter.getContext()), | ||
AffineMap::getMultiDimIdentityMap(2, rewriter.getContext())}; | ||
|
||
SmallVector<utils::IteratorType, 2> iterTypes{utils::IteratorType::parallel, | ||
utils::IteratorType::parallel}; | ||
|
||
rewriter.create<linalg::GenericOp>(loc, TypeRange{}, ValueRange{selMemref}, ValueRange{resMemref}, | ||
indexMaps, iterTypes, | ||
[&](OpBuilder &OpBuilderNested, Location locNested, ValueRange arg) { | ||
OpBuilderNested.create<linalg::YieldOp>(locNested, arg[0]); | ||
}); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This shouldn't be needed, as we want to create a view of a matrix we don't want to copy the data. The memref::SubViewOp
should be enough. You'll need to properly lower it afterwards by adding the following passes to the pipeline:
mlir::memref::createExpandStridedMetadataPass;
and mlir::createFinalizeMemRefToLLVMConversionPass
.
This is an implementation of Codegen-only compilation pipeline for LA operations #693 as the coursework for 'LDE: Project'