Add SIMD vectorization to mapreduce_neighbor_unsafe - #165
Draft
efaulhaber wants to merge 3 commits into
Draft
Conversation
mapreduce_neighbor_unsafemapreduce_neighbor_unsafe
3 tasks
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #165 +/- ##
==========================================
- Coverage 84.59% 84.40% -0.20%
==========================================
Files 15 15
Lines 792 795 +3
==========================================
+ Hits 670 671 +1
- Misses 122 124 +2
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
efaulhaber
force-pushed
the
ef/simd-mapreduce-neighbor
branch
from
August 4, 2026 14:04
a9afefa to
9fc74ce
Compare
efaulhaber
force-pushed
the
ef/simd-mapreduce-neighbor
branch
from
August 12, 2026 14:52
1637527 to
f8de39d
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.
This PR adds a kwarg
simdtomapreduce_neighbor_unsafe. Enabling this option adds a loop header that forces the inner loop to SIMD-vectorize.A simple
@simddoesn't trigger proper vectorization for TLSPH in my tests, so (unfortunately) we need this extra loop header. In situations where vectorization is not possible (e.g. when the loop contains branching or bounds checks), we get a warning, which is why this is not enabled by default. I would prefer a silent failure, somapreduce_neighbor_unsafealways tries to vectorize, with an option to enable the warning for debugging, but this doesn't seem to be possible, as the warnings are coming from deep within Julia.Note that vectorization doesn't work with bounds checks, so there is no point in adding this kwarg to
mapreduce_neighbor.This kwarg is intentionally undocumented, so we can test it first before we decide on a final public API.