-
Notifications
You must be signed in to change notification settings - Fork 10.5k
Add more efficient SIMDMask.random. #36583
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
base: main
Are you sure you want to change the base?
Add more efficient SIMDMask.random. #36583
Conversation
@swift-ci please benchmark |
Build failed before running benchmark. |
Performance: -O
Code size: -O
Performance: -Osize
Code size: -Osize
Performance: -Onone
Code size: -swiftlibsHow to read the dataThe tables contain differences in performance which are larger than 8% and differences in code size which are larger than 1%.If you see any unexpected regressions, you should consider fixing the Noise: Sometimes the performance results (not code size!) contain false Hardware Overview
|
@swift-ci please test compiler performance |
@swift-ci please test |
Build failed |
Build failed |
@swift-ci please test |
Build failed |
@swift-ci please test |
Build failed |
Build failed |
@swift-ci please test |
4698c3b
to
7482758
Compare
Build failed |
Build failed |
@swift-ci please test macOS |
Build failed |
7482758
to
1abb400
Compare
@swift-ci please benchmark |
Performance: -O
Code size: -O
Performance: -Osize
Code size: -Osize
Performance: -Onone
Code size: -swiftlibs
How to read the dataThe tables contain differences in performance which are larger than 8% and differences in code size which are larger than 1%.If you see any unexpected regressions, you should consider fixing the Noise: Sometimes the performance results (not code size!) contain false Hardware Overview
|
@swift-ci test |
Build failed |
Build failed |
@swift-ci test |
- any(_:SIMDMask), all(_:SIMDMask) - .min(), .max(), .wrappingSum() Also adds test coverage to make sure we match the existing generic implementations and an internal binding for the x86 MOVMSK instructions.
This is dependent on Builtins added recently, so has to be staged into the stdlib.
33bad13
to
c96b99e
Compare
@swift-ci test |
1 similar comment
@swift-ci test |
@swift-ci please benchmark |
(Opening this as a draft PR because it's dependent on new Builtins work that was just merged to main)
Implements a more efficient concrete algorithm for generating random SIMDMask objects. Because each lane of a SIMDMask only needs a single bit of randomness, we can get all the randomness we need from a single call to rng.next(), instead of using a call per lane as happens when we go through Bool.random() in the generic implementation. (We can also improve the generic implementation, which I'll look at next).
SIMDMask.random() is not too heavily used, so we won't see any big wins from this anywhere, but it's a mostly trivial change with some nice speedups.