-
-
Notifications
You must be signed in to change notification settings - Fork 17
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
x86_64: Use lock or
instead of mfence
#156
Merged
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
taiki-e
force-pushed
the
x86_64-mfence
branch
2 times, most recently
from
March 21, 2024 16:49
a0d7f3f
to
817f51e
Compare
Based on x86_32 64-bit atomic SeqCst store using SSE generated by LLVM. https://godbolt.org/z/9sKEr8YWc Equivalent to mfence, but is 10-35% faster at least in simple cases on Coffee Lake. Below are the results of the microbenchmark on an Intel Core i7-9750H (Coffee Lake) with the ORDERING constant set to SeqCst. ``` bench_portable_atomic_arch/u128_store time: [11.610 ns 11.670 ns 11.738 ns] change: [-36.119% -35.236% -34.348%] (p = 0.00 < 0.05) Performance has improved. Found 4 outliers among 100 measurements (4.00%) 4 (4.00%) high mild bench_portable_atomic_arch/u128_concurrent_load_store time: [202.30 µs 203.54 µs 205.24 µs] change: [-32.313% -31.167% -29.845%] (p = 0.00 < 0.05) Performance has improved. Found 8 outliers among 100 measurements (8.00%) 2 (2.00%) high mild 6 (6.00%) high severe bench_portable_atomic_arch/u128_concurrent_store time: [395.74 µs 397.37 µs 398.98 µs] change: [-18.517% -17.560% -16.582%] (p = 0.00 < 0.05) Performance has improved. Found 15 outliers among 100 measurements (15.00%) 1 (1.00%) low mild 2 (2.00%) high mild 12 (12.00%) high severe bench_portable_atomic_arch/u128_concurrent_store_swap time: [791.21 µs 793.43 µs 795.69 µs] change: [-10.682% -10.197% -9.6789%] (p = 0.00 < 0.05) Performance has improved. Found 7 outliers among 100 measurements (7.00%) 2 (2.00%) low severe 2 (2.00%) low mild 2 (2.00%) high mild 1 (1.00%) high severe ```
I created another version of this based on my guess described in smol-rs/event-listener#71 (comment), and did a microbenchmark using the same way about 3 months ago. Intel Core i7-9750H, Coffee Lake
Intel Core i7-i3800H, Raptor Lake-H
|
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
UPDATE: this implementation is now replaced with faster implementation; see #156 (comment).
Based on x86_32 64-bit atomic SeqCst store using SSE generated by LLVM. https://godbolt.org/z/9sKEr8YWc
Equivalent to mfence, but is 10-35% faster at least in simple cases on Coffee Lake.
Below are the results of the microbenchmark on Intel Core i7-9750H (Coffee Lake) with the ORDERING constant set to SeqCst.