Skip to content
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

please push a later version of arm64 #105

Closed
PFC-developer opened this issue Nov 30, 2022 · 9 comments
Closed

please push a later version of arm64 #105

PFC-developer opened this issue Nov 30, 2022 · 9 comments

Comments

@PFC-developer
Copy link

rust 1.64 has some changes in the cargo/workspace stuff, which my projects uses.. I just switch to a M1 and now I can't optimize contracts anymore ;-(

@nicolaslara
Copy link

I've been using https://github.com/mandrean/cw-optimizoor/ for this. Alternatively, you could build an arm image locally with make build-workspace-optimizer-arm64 (or make build-rust-optimizer-arm64).

But yeah, having a release of the latest version of this would be useful

@webmaster128
Copy link
Member

To be honest, I am very sceptical about the existence of the *-arm64 images. Since they produce different build results than the Intel ones, they are not suitable for reproducible builds. And this is one of the main goals of this project.

If you do not need reproducible builds, you are better off not using a dockerized solution at all. cw-optimizoor does non-reproducible local builds with the native Rust compiler, this build script does the same.

See also #101 and #102.

@PFC-developer
Copy link
Author

thanks @webmaster128 .. personally new to the mac scene, and am trying to get my compile-test-swear-compile loop as fast as possiblel... I'll check out the build script & optimizoor.. as for the memory issues, I haven't seen them, but I have a larger memory capacity on my dev box.

@nicolaslara
Copy link

Maybe adding that build script to the default template would help. The hard part is making sure it's not used for production 🤔

An option would be to just rename the outputs to include -non-reproducible or something?

@webmaster128
Copy link
Member

The hard part is making sure it's not used for production 🤔

That's a fair point we need to consider on the education side. On the one hand you want a convenient development flow. On the other hand there needs to be a clear border between that and production builds. The same issue exists for cosmwasm/rust-optimizer-arm64, which produces different builds than cosmwasm/rust-optimizer.

In this case, maybe promoting cosmwasm/rust-optimizer-arm64 is even better than local build scripts since it is verifyable by other M1/M2 users and ARM64 servers.

@nicolaslara
Copy link

I think that makes sense. The script to build locally (as well as cw-optimizoor) are useful for faster (and more colorful) builds, but they could be left as documentation for whoever needs them.

I'm thinking it might make sense to have a production feature flag that gets used in the x86 version of rust-optimizer but not the arm86 version. Wasmd can then check the feature and otherwise error with something like: You are trying to upload a wasm file that wasn't compiled for production use. Make sure X and Y for building contracts for production.

I was actually surprised when I first learned that contracts compiled to different wasm in arm64, and still don't understand why that's the case. Do you know if there will be a way to bridge that gap in the future?

@webmaster128
Copy link
Member

a production feature flag that gets used in the x86 version of rust-optimizer but not the arm86 version.

Well, actually it is not necessarily wrong to compile with cosmwasm/rust-optimizer-arm64 for production. You just need to make that clear and only ARM users can do the verification then. But I think this is not a horrible limitation.

We can open up this warning: Arm images are released to ease development and testing on Mac M1 machines. For release / production use, only contracts built with the Intel optimizers must be used. and just say that cosmwasm/rust-optimizer-arm64 builds can only be verified using cosmwasm/rust-optimizer-arm64 and cosmwasm/rust-optimizer builds can only be verified using cosmwasm/rust-optimizer (which can be emulated on Macs using very much memory).

I was actually surprised when I first learned that contracts compiled to different wasm in arm64, and still don't understand why that's the case.

Because all the toolchains (Rust compiler, LLVM backend, wasm-opt, …) is compiled to ARM64 including thousands of low level CPU specific case distinctions. This toolchain just produces slightly different results than a toolchain compiled to x86. The results will both be very similar and both fully functional. But not bit-for-bit the same.

@nicolaslara
Copy link

Right. So having the image available with a warning + maybe a note on https://docs.cosmwasm.com/docs/1.0/getting-started/compile-contract/#optimized-compilation about verifying the images

@webmaster128
Copy link
Member

Version 0.12.11 was pushed for all 4 images. I think this closes this ticket. I'll write some follow up regarding the usage any verifyability of the 4 different images. There is a lot if README to be adjusted and I think the -aarch64 suffix in the Wasm output should be removed eventually.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants