-
Notifications
You must be signed in to change notification settings - Fork 79
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
transforms: (convert-snrt-to-riscv) Convert to arith where possible #2783
Conversation
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #2783 +/- ##
=======================================
Coverage 89.80% 89.80%
=======================================
Files 381 381
Lines 48226 48227 +1
Branches 7377 7378 +1
=======================================
+ Hits 43308 43311 +3
+ Misses 3765 3764 -1
+ Partials 1153 1152 -1 ☔ View full report in Codecov by Sentry. |
I don't understand, the pass is to riscv, why would it be to arith instead? |
Some things can only be represented as RISC-V dialect (eg. csr reads/writes), but others are just arithmetic operations. Instead of hand-lowering the arithmetic as well, I think it makes sense to leave that up to the default lowerings that are already in place (also makes CSE and such easier as arith is 100% pure and has more pattern coverage). Additionally, this allows us to re-use this lowering when going to e.g. llvm dialect, as we only need to convert some select few RISC-V ops to inline assembly, which is the plan in snax mlir. |
e76c384
to
56288d3
Compare
Surely that's a different pass, that converts snrt to arith instead? This doesn't typecheck for me |
I too, am a bit confused. As I very much welcome this change, this pass does not seem to be the correct place for this? What is wrong with original plan from #2468?:
|
@jorendumoulin I think this pass fits relatively nicely into the picture of yours, where the |
I have renamed the pass to |
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.
Allright, however, using the riscv_snrt dialect as primitives still results in some silly i32->riscv-reg->i32
conversions. It does avoid having almost duplicate ops in two different dialects. I'm not sure whats best.
Yes, but these will be cleaned up automagically by xdsl when we reconclile casts, this shouldn't be a problem imo |
Replace some arithmetic RISCV operations with arith dialect operations. This is in preperation for another PR.
This shouldn't change the usability of this pass, but makes it much easier to re-use this pass without targeting our own RISC-V backend.