Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

spike: mips64r2 target support #942

Closed
clabby opened this issue Jan 24, 2025 · 4 comments · Fixed by #943
Closed

spike: mips64r2 target support #942

clabby opened this issue Jan 24, 2025 · 4 comments · Fixed by #943
Labels
A-build Area: Build Pipelines M-good-first-issue Meta: Good for newcomers

Comments

@clabby
Copy link
Collaborator

clabby commented Jan 24, 2025

Overview

Right now, we test compilation against a custom mips32r1 target, but cannon has been updated to support the mips64r2 target.

Being able to run kona on cannon is desirable, allowing the use of cannon as the backing fault proof VM for a production deployment while asterisc is finished up.

I've already given some attempts to compile kona to a bare metal mips64r2 target, but wasn't able to get it running on the MT64 variant of cannon on the afternoon I was trying it out. Possibly with a bit more exploration, this could work.

@clabby clabby added A-build Area: Build Pipelines M-good-first-issue Meta: Good for newcomers labels Jan 24, 2025
@clabby clabby linked a pull request Jan 24, 2025 that will close this issue
@clabby
Copy link
Collaborator Author

clabby commented Jan 24, 2025

I've done some investigation tonight, and I think this should work if we add more instructions to cannon. There's quite a few mips64r2 instructions that cannon doesn't support right now, such as SEB, DSBH, DSHD, DEXT, DEXTM, DROTR32, DROTR, DROTRV, and probably a few more.

The build target now seems to generate valid mips64r2 code, which is nice. PR over @ #943, I'll need to update the build image manually to get CI passing tomorrow.

I've got a draft branch up in cannon that I was using for some experimenting here as well: https://github.com/ethereum-optimism/optimism/compare/cl/support-full-r2?expand=1

Curious your thoughts @Inphi @mbaxter

@Inphi
Copy link

Inphi commented Jan 24, 2025

It's cool to see that target compilation working. Given mips32r2 has tier 3 support in Rust, how confident are we that the codegen quality? I'm a bit worried about correctness than efficiency. There are several open mips-specific issues in the rust gh that indicate it may not good enough. Nonetheless, it would still be good to have kona+cannon available as a backup option.

The unimplemented instructions look straight forward enough. No weird ones like LL/SC that need tender care, so I think we can probably have them implemented and reviewed quickly if we had some time to spare. Pretty baller of you to have a draft up already. This looks promising. Main bottleneck is finding time to finish up adding support for additional instructions to cannon. We'd probably end up shipping Asterisc anyways if cannon+kona doesn't land in time.

@clabby
Copy link
Collaborator Author

clabby commented Jan 24, 2025

Given mips32r2 has tier 3 support in Rust, how confident are we that the codegen quality?

Good question - less confident than the RISC-V target for sure, but given that we're generating bare-metal code, I'd hope the target is "stable enough" since we don't need any of the std lib etc. The LLVM target has been around for a long time, and is maintained by a range of folks it looks like, but not incredibly active like other targets. It's probably worth the effort to finish the implementation of the remaining mips64r2 instructions and just see if it works.

The draft for the cannon instructions ins't complete just yet, just a few instructions - will need to chase down remaining unsupported instructions to wrap it up. Glad to walk through how to run kona on cannon from #943 locally, if you guys are able to take that on.

@clabby
Copy link
Collaborator Author

clabby commented Jan 24, 2025

Going to go ahead and close this issue along with #943. The compilation looks fine through some manual objdump / readelf scanning, this is now up to cannon to support the full mips64r2 isa.

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
A-build Area: Build Pipelines M-good-first-issue Meta: Good for newcomers
Projects
Status: Done
Development

Successfully merging a pull request may close this issue.

2 participants