perf(vello_cpu): statically dispatch f32 image sampling quality#1343
Merged
Conversation
LaurenzV
approved these changes
Jan 7, 2026
By using a `const` generic to dispatch statically between bilinear and
bicubic sampling, we get a 7% timing decrease for bilinear sampling
(medium quality) in the f32 pipeline. It appears not to impact bicubic
sampling (high quality).
The benchmark was performed by temporarily adding medium and high
quality variants of `transform::rotate` in
`sparse_strips/vello_bench/src/fine/image.rs`.
```
fine/image/transform/rotate_medium_f32_scalar
time: [10.142 µs 10.149 µs 10.157 µs]
change: [-7.5294% -7.3741% -7.2353%] (p = 0.00 < 0.05)
Performance has improved.
Found 26 outliers among 100 measurements (26.00%)
4 (4.00%) low severe
9 (9.00%) low mild
6 (6.00%) high mild
7 (7.00%) high severe
Benchmarking fine/image/transform/rotate_high_f32_scalar: Collecting 100 samples in estimated 5.0357 s (162k iterfine/image/transform/rotate_high_f32_scalar
time: [31.144 µs 31.175 µs 31.215 µs]
change: [-0.3454% +0.1490% +0.4994%] (p = 0.57 > 0.05)
No change in performance detected.
Found 14 outliers among 100 measurements (14.00%)
2 (2.00%) high mild
12 (12.00%) high severe
```
93359a5 to
bbedcf1
Compare
This file contains hidden or 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
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.
By using a
constgeneric to dispatch statically between bilinear and bicubic sampling, on x86 we get a 7% timing decrease for bilinear sampling (medium quality) in the f32 pipeline. It appears not to impact timings for bicubic sampling (high quality).The benchmark was performed by temporarily adding medium and high quality variants of
transform::rotateinsparse_strips/vello_bench/src/fine/image.rs.