-
Notifications
You must be signed in to change notification settings - Fork 288
Implement prefetch hints for aarch64 #918
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
Conversation
Co-authored-by: Wang Maozhang <[email protected]>
Thanks for the pull request, and welcome! The Rust team is excited to review your changes, and you should hear from @Amanieu (or someone else) soon. If any changes to this PR are deemed necessary, please add them as extra commits. This ensures that the reviewer can see what has changed since they last reviewed the code. Due to the way GitHub handles out-of-date commits, this should also make it reasonably obvious what issues have or haven't been addressed. Large or tricky changes may require several passes of review and changes. Please see the contribution instructions for more information. |
The check error is strange:
This PR does not touch any code in wasm32 at all. Could anyone give some suggestion here? Best Regards. |
#[cfg_attr(test, assert_instr("prfm pstl3keep", rw = _PREFETCH_WRITE, locality = _PREFETCH_LOCALITY1))] | ||
#[cfg_attr(test, assert_instr("prfm pstl2keep", rw = _PREFETCH_WRITE, locality = _PREFETCH_LOCALITY2))] | ||
#[cfg_attr(test, assert_instr("prfm pstl1keep", rw = _PREFETCH_WRITE, locality = _PREFETCH_LOCALITY3))] | ||
pub unsafe fn _prefetch(p: *const i8, rw: i32, locality: i32) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Use #[rustc_args_required_const(1, 2)]
to ensure that rw
and locality
are compile-time constants.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You also need to match on every valid (rw, locality)
pair so that the prefetch
call always gets constant values as arguments and you need to handle invalid values.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks a lot for the quick review.
The #[rustc_args_required_const(1, 2)]
is added just before the function _prefetch.
Created a macro pref
to match all valid (rw, locality)
pairs.
An invalid pair will cause panic now.
Suggestions?
The wasm failure seems to be due to an issue on the latest Rust nightly. You can fix it by adding the |
Added the |
Thanks! |
update stdarch submodule This commit update the src/stdarch submodule, we primarily want to include [https://github.com/rust-lang/stdarch/pull/918](url) which provides prefetch hints for aarch64. This PR could deliver ~20% performance gain on our aarch64 server in Filecoin. Wish this could be used as soon as possible. Thanks.
Co-authored-by: Wang Maozhang [email protected]
This implements prefetch hints for aarch64 via LLVMs
prefetch
instrinsic.We wintness ~20% performance gain in seal_pre_commit_phase1 of Filecoin with 32GB data input.
Verified with
cargo +nightly test
andcargo +nightly test --release
.There are four failures (as shown below), but these are not cause by this PR.
These tests failed both with and without this PR.
Thanks.