-
Notifications
You must be signed in to change notification settings - Fork 188
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
[midend/lib/Conversion/LowerLinalgToGemmini] Add pass support for gemmini to run E2E LeNet and some tests. #463
base: main
Are you sure you want to change the base?
Conversation
…mini to run E2E LeNet and some tests.
The commits seem to be missing the endline? Although I can see them locally..... |
%output = memref.alloc() : memref<1x3x3x1xi8> | ||
|
||
// CHECK: gemmini.tile_conv %{{[0-9]+}} %alloc_{{[0-9]+}} %alloc_{{[0-9]+}} %alloc_{{[0-9]+}} %{{.+}} %{{.+}} : | ||
// CHECK-SAME: memref<1x7x7x1xi8> memref<25x1xi8> memref<1xi32> memref<9x1xi8> i64 i64 |
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.
Maybe you don't need check-same
, and feel that the content of check-smae
is not important. The same is true for the following example.
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.
gemmini.tile_conv ({{.*}}
({{.*}}
..., Maybe better since you're not capturing the variable and then using it.
|
||
ModuleOp parentModule = op->getParentOfType<ModuleOp>(); | ||
|
||
auto printfRef = getOrInsertPrintf(rewriter, parentModule); |
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.
Do not use auto
,The data types here can be confusing for people who are not familiar with this code.
valueToPrint = rewriter.create<LLVM::SExtOp>(loc, rewriter.getI32Type(), | ||
valueToPrint); | ||
} | ||
|
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.
For unsupported data types, you should return failure
.
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 work, I just did a quick review.
// CHECK: gemmini.print_scalar %{{.*}} : i8 | ||
gemmini.print_scalar %scalar : i8 | ||
|
||
%vector = memref.alloc() : memref<4xi8> // 1D向量 |
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.
use English.
@@ -222,6 +311,7 @@ void LowerGemminiToLLVMPass::runOnOperation() { | |||
cf::populateControlFlowToLLVMConversionPatterns(converter, patterns); | |||
populateFuncToLLVMConversionPatterns(converter, patterns); | |||
patterns.add<PrintOpLowering>(&getContext()); | |||
patterns.add<PrintScalarOpLowering>(&getContext()); |
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.
... context = &getContext();
patterns.add<...>(context);
if (stridesAttr) | ||
strides = (*stridesAttr.begin()).getLimitedValue(); | ||
|
||
if (inputShape[1] != inputShape[2]) // h, w |
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.
The comment should be more explicit and should be placed above the if statement.
Ping @shirohasuki I don't seem to have approval authority. If no one approves this PR (CI cannot run, please @zhanghb97 in time. |
Thank you so much for the REVIEW! I'll modify it and @zhanghb97 for CI. |
Print Ops in Gemmini has always been coupled.Its logic should actually be |
I think it's right, Separate the printOp pattern into a decoupled pass and it will be like this?
|
|
I got it! |
* [Test] Add testcases for python binding Signed-off-by: Junyi Mei <[email protected]> * [Test] Add testcase for conv-vectorization Signed-off-by: Junyi Mei <[email protected]> * [Test] More detailed check for conv-vectorization Signed-off-by: Junyi Mei <[email protected]> * [Test] Add testcase for matmul-vectorization Signed-off-by: Junyi Mei <[email protected]> * [Test] Verify module ops in python binding Signed-off-by: Junyi Mei <[email protected]> --------- Signed-off-by: Junyi Mei <[email protected]>
…iler#465) Current vectorization pass of matmul-transpose-b reduce the vector in each iteration and accumulate it to the result element. This commit modify it into elementwise addition and do the reduction after the inner loop with reassoc enabled. Signed-off-by: Junyi Mei <[email protected]>
) * [examples] Add MLIR vector dialect to RVV code generation makefile target Signed-off-by: asdf1113 <[email protected]> * [docs] Add RVV instruction support docs Mapping MLIR Vector Operations to RVV Instructions --------- Signed-off-by: asdf1113 <[email protected]>
* [feat] accelerate rotate2d, add rotate4d affine part. * [feat] finish rotate_4d(nhwc and nchw format) * [modify] add test, fix code format. * clean up code format using pre-commit * [fix] force inline in DIP header file to avoid link failure * [fix] format code with pre-commit
Please rebase the code. Let's check if it passes the CI tests after rebase. |
…uddy-compiler#471) * [midend] Support scalable vector for matmul-transpos-b vectorization * [midend] Fix matmul-transpose-b scalable vector problem * [Test] Disable scalable in matmul-transpose-b vectorization testcase
…mini to run E2E LeNet and some tests.
I sync from the remote repo. Maybe we can try CI again? |
You can see how much code you've changed in the upper right corner.Looks like you introduced someone else's PR.You should go back to the very first commit and then use git rebase your code to eliminate code conflicts.Or pulling the contents of the main branch should do the trick. |
OKOK. |
[midend/lib/Conversion/LowerLinalgToGemmini] Add conv2d_nhwc_fhwc pass for gemmini and add relevant examples and tests.
[midend/lib/Conversion/LowerGemmini] Add scalar print Op for convenient testing and add relevant examples and tests.
[midend/lib/Dialect/Gemmini] Split gemmini conv's RISC and CISC instruction lowering into two separate passes. (Now it's default lowering to RISC type different from native-gemmini, maybe we need a option to config this. Both can pass the LENet test.)
Below are the RISC version and CISC version running LeNet E2E on firesim.
