You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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
This adds initial support for SIMD types in most places. An exception is the Luv related types, where the conversion logic need extra attention. Some of the conversions aren't necessarily optimal but the focus was on making it work at all.
Integration with the wide crate has been added behind a feature flag, as a first example. More SIMD crates can be added in the future.
Breaking Change
Some functions that used to return bool is now returning a mask type. This mask type is still bool for regular floats and ints, so this change will mostly affect generic code. GetHue was also changed to no longer return Option<T> for SIMD friendliness.
Ogeon
changed the title
Implement SIMD support and add wide integration
Implement SIMD support and add wide integration
Apr 2, 2022
It's a bummer that the RGB to HSL and RGB to HSV conversion is so much slower. I'll try with the old one behind type ID checks (i.e. Great Value Specialization) for now and see if it works better. I should see if I can add benchmarks for the SIMD versions before merging this.
Looks like the performance gain varies from nothing to several times faster, depending on the work. Converting sRGB to linear RGB is even a bit slower on my machine (possibly due to the powf implementation), converting RGB to HSV or HSL is slightly faster if I use f32x8 but almost equal with f32x4, and converting between XYZ and RGB scales pretty good with the amount of lanes. My CPU is not particularly new, though, so YMMV. As always, with performance.
I don't think I will go through and optimize everything now. Just making sure there's any improvement at all.
The benchmark fails because the wide feature isn't on master. But the logs show similar results. And it's pretty cool that it keeps on being feasible to run these benchmarks here!
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.
This adds initial support for SIMD types in most places. An exception is the
Luv
related types, where the conversion logic need extra attention. Some of the conversions aren't necessarily optimal but the focus was on making it work at all.Integration with the wide crate has been added behind a feature flag, as a first example. More SIMD crates can be added in the future.
Breaking Change
Some functions that used to return
bool
is now returning a mask type. This mask type is stillbool
for regular floats and ints, so this change will mostly affect generic code.GetHue
was also changed to no longer returnOption<T>
for SIMD friendliness.