Skip to content

Change ref_from_bytes() to inline(always).#3137

Merged
jswrenn merged 1 commit intogoogle:mainfrom
korran:inline-always
Mar 19, 2026
Merged

Change ref_from_bytes() to inline(always).#3137
jswrenn merged 1 commit intogoogle:mainfrom
korran:inline-always

Conversation

@korran
Copy link
Contributor

@korran korran commented Mar 18, 2026

When building my firmware for rv32imc with lto=fat, changing codegen-units from 16 to 1 influences the compiler heuristics enough to not inline this function, causing code bloat and unnecessary panic logic.

@gemini-code-assist
Copy link
Contributor

Warning

You have reached your daily quota limit. Please wait up to 24 hours and I will start processing your requests again!

@joshlf
Copy link
Member

joshlf commented Mar 18, 2026

You'll want to run ./tools/update-expected-test-output.sh to update expected output and fix the failing CI job.

@codecov-commenter
Copy link

codecov-commenter commented Mar 18, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 91.87%. Comparing base (e38763f) to head (5a4f1e1).

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #3137   +/-   ##
=======================================
  Coverage   91.87%   91.87%           
=======================================
  Files          20       20           
  Lines        6057     6057           
=======================================
  Hits         5565     5565           
  Misses        492      492           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

When building my firmware for rv32imc with lto=fat, changing
codegen-units from 16 to 1 influences the compiler heuristics enough to
*not* inline this function, causing code bloat and unnecessary panic
logic.
@korran
Copy link
Contributor Author

korran commented Mar 18, 2026

hmm, those benchmark changes don't look good :(

Copy link
Collaborator

@jswrenn jswrenn left a comment

Choose a reason for hiding this comment

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

The benchmark results are fine. :-) There's only a six instructions overhead on the dynamic padding case, and a hypothetical cycle improvement in the dynamic size case. Since dynamically padded types are unusual, not too much weight should be put in optimizing them relative to unpadded dynamically sized types.

@jswrenn jswrenn added this pull request to the merge queue Mar 19, 2026
Merged via the queue into google:main with commit d6d67bf Mar 19, 2026
108 checks passed
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.

4 participants