Skip to content

perf: replace SIMD merge with a generic bitonic sorting network in Stable Simd - #382

Merged
Kerollmops merged 1 commit into
stable_simd_pcmpistrmfrom
stable_simd_bitonic_sort
Oct 26, 2026
Merged

Kerollmops merged 1 commit into
stable_simd_pcmpistrmfrom
stable_simd_bitonic_sort

Conversation

@Dr-Emann

@Dr-Emann Dr-Emann commented Oct 9, 2026 •

Copy link
Copy Markdown
Member

Use bitonic_merge for array-store union and xor, replacing repeated lane rotations with compare-exchange stages. Generalize the helper to support integer SIMD vectors with power-of-two lane counts.

This both does less work (O(log(N)) vs O(N) per vector), but has less operations dependent on previous operations.

@Dr-Emann
Dr-Emann added this pull request to stack #381 October 9, 2026 17:29
@Dr-Emann Dr-Emann changed the title perf: replace SIMD merge with a generic bitonic sorting network perf: replace SIMD merge with a generic bitonic sorting network in Stable Simd Oct 9, 2026
@Dr-Emann
Dr-Emann force-pushed the stable_simd_bitonic_sort branch 3 times, most recently from 9febca8 to b94450c Compare October 9, 2026 19:05
@Dr-Emann
Dr-Emann force-pushed the stable_simd_bitonic_sort branch from b94450c to 9e43630 Compare October 9, 2026 19:20
@Dr-Emann
Dr-Emann force-pushed the stable_simd_bitonic_sort branch 2 times, most recently from a1bd8f7 to c5a0699 Compare October 11, 2026 02:53

@Kerollmops Kerollmops left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice changes but do you have any benchmarks showing the perf gain, please? Even if it's only on x86, x86-64.

@Dr-Emann
Dr-Emann force-pushed the stable_simd_bitonic_sort branch from c5a0699 to efe0519 Compare October 22, 2026 03:23
Use bitonic_merge for array-store union and xor, replacing repeated lane
rotations with compare-exchange stages. Generalize the helper to support
integer SIMD vectors with power-of-two lane counts.
@Dr-Emann
Dr-Emann force-pushed the stable_simd_bitonic_sort branch from efe0519 to 1e8a759 Compare October 23, 2026 00:14
@Kerollmops
Kerollmops added this pull request to the merge queue Oct 26, 2026
Merged via the queue into main with commit 0890ec8 Oct 26, 2026
28 checks passed
@Kerollmops
Kerollmops deleted the stable_simd_bitonic_sort branch October 26, 2026 15:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants