-
Notifications
You must be signed in to change notification settings - Fork 71
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
transformations: (convert-riscv-to-llvm) #2468
Conversation
Some further reflection on this approach: It is functional, but the amount of unrealized conversion casts gets a bit ridiculous (see KULeuven-MICAS/snax-mlir#116). Also, the emission of riscv arithmetic in llvm inline assembly instead of regular llvm ir is a bit silly (not in the example). I think the following approach would make more sense: Create ops for the custom snitch operations (such as refactor the The lowerings would look like this:
I can work on this, but I would like to get your opinion on this first @AntonLydike @JosseVanDelm . |
@jorendumoulin I agree with your suggestion. CC @cappadokes |
Flattering your tag as may be @JosseVanDelm, I find Joren's mentioning of Anton much more meaningful. I don't have the knowledge to constructively comment on this discussion--but thanks again for considering me. |
…tions (#2784) In order to make progress on #2468 I factored out the insn representation. This will hopefully also make it usable for the RISC-V backend efforts. --------- Co-authored-by: Joren Dumoulin <[email protected]>
d0d8a9f
to
2eb8fb3
Compare
Oh no, we hit the magic interactive tests again :( |
@jorendumoulin I did a pass to handle named registers in puts differently. We now just print the register name in the assembly instead of going through the SSA value. Additionally, with #2797 we can now CSE delete the remaining I'll fix the problem with ops that return a |
What's the latest on this? |
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #2468 +/- ##
==========================================
+ Coverage 90.18% 90.19% +0.01%
==========================================
Files 456 458 +2
Lines 57567 57705 +138
Branches 5541 5560 +19
==========================================
+ Hits 51917 52049 +132
- Misses 4191 4194 +3
- Partials 1459 1462 +3 ☔ View full report in Codecov by Sentry. |
No longer [WIP]? |
Yes, this is now ready for your all eyes |
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.
Indeed, no longer WIP
Thank you, this looks good to me!
@jorendumoulin, I think if you could update this and get it in, it would be fabulous, I'm sure we'll find more use-cases for this functionality |
865fb63
to
f55a2e6
Compare
6bde482
to
3b418dd
Compare
I rebased and resolved all outstanding comments, I just don't really get what is meant with this final comment:
|
constraints_string = ",".join(constraints) | ||
|
||
# construct llvm inline asm op | ||
register_width_int = builtin.IntegerType(self.xlen) |
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.
Why not index type?
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.
llvm dialect doesn't like index type
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.
!!
I think it may have been outdated, before the get registers for zero... I'm not 100% sure, I can no longer spot an issue. |
Thanks! Apologies for the extreme delay on this! I hope I'll soon find some time to convert our snitch runtime stuff to use this flow :) |
The important thing is that we got there in the end, thank you very much for picking it back up! |
This PR implements a conversion of riscv dialect to llvm using the inline assembly op.
This is useful such that any generated RISC-V code can also be used with an LLVM target like we use in
snax-mlir
.Specifically, this will be used to reuse the lowering of
snrt
toriscv
, without having to duplicate the entiresnrt-to-riscv
transform.@AntonLydike