-
Notifications
You must be signed in to change notification settings - Fork 136
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
[CIR][ThroughMLIR] Support lowering ForOp to scf #605
Conversation
Nice, thanks! How does this relate to the other loop canonicalization PR? I'd be good if you can split the implementation into another file, so we can mitigate this early on, differently from the current state of LowerToLLVM.cpp. |
WIth the other PR which guarantee IV in the LHS of loop comparison, we could use RHS to search the loop boundary and hoisting the boundary operations out of the loop would allow the conversion using the value as input operand for SCF loop.
It seems to be a good idea. I will work in this direction. Thanks! |
I tried to implement a pass before ConvertCIRToMLIRPass which only convert CIR for loop to SCF. Because SCF for loop required the inputs are builtin integer types(index or i32/i64), the operand checking will report error. It seems CIRForOpLowering might live in ConvertCIRToMLIRPass to make sure the operations before loops have been converted to MLIR. Would you like me to try other way to split the implementation or live CIRForOpLowering as it is? |
Sorry for the confusion, my suggestion is only about the mechanical part of splitting the implementation in more files, no need to change the overall approach of the PR. |
I will put the implementation in a separate file. Thanks for the clarification. |
This commit introduces CIRForOpLowering for lowering to scf. The initial commit only support increment loop with lt or le comparison.
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.
LGTM with one note for future work.
!s32i = !cir.int<s, 32> | ||
module { | ||
cir.global external @a = #cir.zero : !cir.array<!s32i x 100> | ||
|
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.
Can you add a comment with the original C/C++ code you are building or write the test in a way that is testable all the way from the source file? As we change CIR, I'm afraid these tests are going to get hard to update. We already have that problem elsewhere, but probably best not to increase them. Similar for your other PR. No need to tackle right now, a future PR sounds good.
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 letting me know. I will create a PR to update for.cir soon.
Hellow, I completed the |
It would be great addition. Thank you! |
This commit introduces CIRForOpLowering for lowering to scf. The initial commit only support increment loop with lt or le comparison.
This commit introduces CIRForOpLowering for lowering to scf. The initial commit only support increment loop with lt or le comparison.
This commit introduces CIRForOpLowering for lowering to scf. The initial commit only support increment loop with lt or le comparison.
This commit introduces CIRForOpLowering for lowering to scf. The initial commit only support increment loop with lt or le comparison.
This commit introduces CIRForOpLowering for lowering to scf. The initial commit only support increment loop with lt or le comparison.
This commit introduces CIRForOpLowering for lowering to scf. The initial commit only support increment loop with lt or le comparison.
This commit introduces CIRForOpLowering for lowering to scf.
The initial commit only support increment loop with lt or le comparison.