Change ref_from_bytes() to inline(always).#3137
Conversation
|
Warning You have reached your daily quota limit. Please wait up to 24 hours and I will start processing your requests again! |
|
You'll want to run |
Codecov Report✅ All modified and coverable lines are covered by tests. 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. 🚀 New features to boost your workflow:
|
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.
|
hmm, those benchmark changes don't look good :( |
jswrenn
left a comment
There was a problem hiding this comment.
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.
Enables customers to tune inlining aggressiveness of many of zerocopy's public functions. At higher `codegen-units`, the Rust compiler may fail to inline invocations of conversion functions. Applying the `#[inline(always)]` attribute (as in #3137) forces inlining, but that might not be desirable for all monomorphizations or invocations. Dynamically padded types, for instance, require much more complex codegen than statically sized for unpadded dynamically sized types. While reducing `codegen-units` for a build can improve codegen, it carries a large penalty in build times. The `--cfg zerocopy_inline_always` flag provides a narrowly-scoped lever for achieving some of the benefits of `codegen-units=1` without the broad build time penalties. gherrit-pr-id: G750518420a745aec19276f7a24bcd0f66584bb2c
Enables customers to tune inlining aggressiveness of many of zerocopy's public functions. At higher `codegen-units`, the Rust compiler may fail to inline invocations of conversion functions. Applying the `#[inline(always)]` attribute (as in #3137) forces inlining, but that might not be desirable for all monomorphizations or invocations. Dynamically padded types, for instance, require much more complex codegen than statically sized for unpadded dynamically sized types. While reducing `codegen-units` for a build can improve codegen, it carries a large penalty in build times. The `--cfg zerocopy_inline_always` flag provides a narrowly-scoped lever for achieving some of the benefits of `codegen-units=1` without the broad build time penalties. gherrit-pr-id: G750518420a745aec19276f7a24bcd0f66584bb2c
Enables customers to tune inlining aggressiveness of many of zerocopy's public functions. At higher `codegen-units`, the Rust compiler may fail to inline invocations of conversion functions. Applying the `#[inline(always)]` attribute (as in #3137) forces inlining, but that might not be desirable for all monomorphizations or invocations. Dynamically padded types, for instance, require much more complex codegen than statically sized for unpadded dynamically sized types. While reducing `codegen-units` for a build can improve codegen, it carries a large penalty in build times. The `--cfg zerocopy_inline_always` flag provides a narrowly-scoped lever for achieving some of the benefits of `codegen-units=1` without the broad build time penalties. gherrit-pr-id: G750518420a745aec19276f7a24bcd0f66584bb2c
Enables customers to tune inlining aggressiveness of many of zerocopy's public functions. At higher `codegen-units`, the Rust compiler may fail to inline invocations of conversion functions. Applying the `#[inline(always)]` attribute (as in #3137) forces inlining, but that might not be desirable for all monomorphizations or invocations. Dynamically padded types, for instance, require much more complex codegen than statically sized for unpadded dynamically sized types. While reducing `codegen-units` for a build can improve codegen, it carries a large penalty in build times. The `--cfg zerocopy_inline_always` flag provides a narrowly-scoped lever for achieving some of the benefits of `codegen-units=1` without the broad build time penalties. gherrit-pr-id: G750518420a745aec19276f7a24bcd0f66584bb2c
Enables customers to tune inlining aggressiveness of many of zerocopy's public functions. At higher `codegen-units`, the Rust compiler may fail to inline invocations of conversion functions. Applying the `#[inline(always)]` attribute (as in #3137) forces inlining, but that might not be desirable for all monomorphizations or invocations. Dynamically padded types, for instance, require much more complex codegen than statically sized for unpadded dynamically sized types. While reducing `codegen-units` for a build can improve codegen, it carries a large penalty in build times. The `--cfg zerocopy_inline_always` flag provides a narrowly-scoped lever for achieving some of the benefits of `codegen-units=1` without the broad build time penalties. gherrit-pr-id: G750518420a745aec19276f7a24bcd0f66584bb2c
Enables customers to tune inlining aggressiveness of many of zerocopy's public functions. At higher `codegen-units`, the Rust compiler may fail to inline invocations of conversion functions. Applying the `#[inline(always)]` attribute (as in #3137) forces inlining, but that might not be desirable for all monomorphizations or invocations. Dynamically padded types, for instance, require much more complex codegen than statically sized for unpadded dynamically sized types. While reducing `codegen-units` for a build can improve codegen, it carries a large penalty in build times. The `--cfg zerocopy_inline_always` flag provides a narrowly-scoped lever for achieving some of the benefits of `codegen-units=1` without the broad build time penalties. gherrit-pr-id: G750518420a745aec19276f7a24bcd0f66584bb2c
Enables customers to tune inlining aggressiveness of many of zerocopy's public functions. At higher `codegen-units`, the Rust compiler may fail to inline invocations of conversion functions. Applying the `#[inline(always)]` attribute (as in #3137) forces inlining, but that might not be desirable for all monomorphizations or invocations. Dynamically padded types, for instance, require much more complex codegen than statically sized for unpadded dynamically sized types. While reducing `codegen-units` for a build can improve codegen, it carries a large penalty in build times. The `--cfg zerocopy_inline_always` flag provides a narrowly-scoped lever for achieving some of the benefits of `codegen-units=1` without the broad build time penalties. gherrit-pr-id: G750518420a745aec19276f7a24bcd0f66584bb2c
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.