Vectorize alignment algorithm for x86-64
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 587
- Forks
- 144
- Avg merge
- 2h 37m
- Merged PRs (30d)
- 1
Description
Ideally you would want to use in this case __m128i _mm_blendv_epi8(__m128i a, __m128i b, __m128i mask)
where the mask could be created with anything in the _mm_cmp**_epi8 range.
But blendv is a SSE4.1 instruction. Leading to compile headaches. However, this can be done using SSE2 instructions only:
<include "emmintrin.h">
static inline __m128i vector_blend_128(__m128i a, __m128i b, __m128i mask) {
return _mm_or_si128(
_mm_and_si128(mask, a);
_mm_andnot_si128(mask, b);
);
}
So this might open up opportunities for vectorization, using only #ifdef __SSE2__ compile guards.
EDIT: This would work for other than epi8 data types as well of course.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by locating the alignment algorithm and any existing x86-64 or SIMD implementation in the repository. Check how CPU feature guards are handled, then evaluate whether an SSE2-only blend using the proposed intrinsics can be integrated without SSE4.1 requirements; done means the alignment path is vectorized and remains buildable on supported x86-64 targets.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- c
- Domain
- performance
- Issue type
- Refactor
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 35/100