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

feat: enable LTO and codegen-units = 1 optimization #20927

Merged
merged 2 commits into from
Jan 24, 2025

Conversation

kiwamizamurai
Copy link
Contributor

@kiwamizamurai kiwamizamurai commented Jan 20, 2025

Description

Enable Link-Time Optimization (LTO) for the project and other optimization

Test plan

building process is successfully completed

Release notes

Check each box that your changes affect. If none of the boxes relate to your changes, release notes aren't required.

For each box you select, include information after the relevant heading that describes the impact of your changes that a user might notice and any actions they must take to implement updates.

  • Protocol:
  • Nodes (Validators and Full nodes):
  • gRPC:
  • JSON-RPC:
  • GraphQL:
  • CLI:
  • Rust SDK:

Copy link

vercel bot commented Jan 20, 2025

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
sui-docs ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jan 24, 2025 7:44am
2 Skipped Deployments
Name Status Preview Comments Updated (UTC)
multisig-toolkit ⬜️ Ignored (Inspect) Visit Preview Jan 24, 2025 7:44am
sui-kiosk ⬜️ Ignored (Inspect) Visit Preview Jan 24, 2025 7:44am

@stefan-mysten
Copy link
Member

Thanks @kiwamizamurai!

Out of curiosity, did you try to benchmark to see any differences between not having this settings and having them? If so, what was the performance in terms of compilation times + binary size?

@kiwamizamurai
Copy link
Contributor Author

@stefan-mysten
Thank you for your review

In this repository, I haven't tried it yet. Let me check.
But which binary file should I use?

@stefan-mysten
Copy link
Member

@stefan-mysten Thank you for your review

In this repository, I haven't tried it yet. Let me check. But which binary file should I use?

sui or sui-node would be good examples.

We tried enabling it, but it fails to build and the GitHub CI cancels the operation due to taking too long at what it seems to be building the sui binary.

@kiwamizamurai
Copy link
Contributor Author

@stefan-mysten
Thank you

When I tried, I encountered the same issue. 🤔

Do you have any idea?
I'm debugging now

@stefan-mysten
Copy link
Member

When I tried, I encountered the same issue. 🤔

Interesting, at least we know it's not an isolated issue on our side. I don't have ideas yet on what can be done, I assume that because the code is so large, these optimizations are quite computationally heavy and might take a few hours to complete. We might try a bit more on our side, but please let us know if you managed to get it working. Thank you!

@kiwamizamurai
Copy link
Contributor Author

@stefan-mysten
Thank you for your support

It seems that this repository requires me a lot of memory 🤔 32GB might not be enough.

I keep investigating.

@stefan-mysten
Copy link
Member

stefan-mysten commented Jan 24, 2025

@kiwamizamurai we made it compile but the build time increased 5-6x times, which is slightly concerning. Given that this might make a lot of our CI workflows fail due to the long build time, I will suggest that we do not merge these changes for now. I hope that you can keep these changes locally and build with these flags as you need.

@mwtian mwtian reopened this Jan 24, 2025
Copy link
Member

@mwtian mwtian left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @kiwamizamurai, thanks for looking into this. As @stefan-mysten said, we may not be able to switch to compiling with lto by default right now. Can you make your change under another profile? Otherwise lgtm.

Cargo.toml Show resolved Hide resolved
@mwtian mwtian temporarily deployed to sui-typescript-aws-kms-test-env January 24, 2025 04:42 — with GitHub Actions Inactive
@kiwamizamurai
Copy link
Contributor Author

kiwamizamurai commented Jan 24, 2025

@mwtian @stefan-mysten

Thank you very much for your comments and investigation! I learned a lot from this project. I truly appreciate your help.

I have created a separate profile.
Kindly review it at your convenience.

@kiwamizamurai kiwamizamurai temporarily deployed to sui-typescript-aws-kms-test-env January 24, 2025 07:45 — with GitHub Actions Inactive
@mwtian mwtian merged commit 6f5fbfd into MystenLabs:main Jan 24, 2025
47 checks passed
@stefan-mysten
Copy link
Member

@kiwamizamurai appreciate your time looking into this optimization!

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

Successfully merging this pull request may close these issues.

3 participants