Skip to content
Snippets Groups Projects
Commit f355192d authored by Martin Larralde's avatar Martin Larralde
Browse files

Fix AVX2 implementation of `Maximum::argmax`

parent cd75a905
No related branches found
No related tags found
No related merge requests found
...@@ -198,7 +198,6 @@ impl<A: Alphabet> Maximum<u8, <Dispatch as Backend>::LANES> for Pipeline<A, Disp ...@@ -198,7 +198,6 @@ impl<A: Alphabet> Maximum<u8, <Dispatch as Backend>::LANES> for Pipeline<A, Disp
scores: &StripedScores<u8, <Dispatch as Backend>::LANES>, scores: &StripedScores<u8, <Dispatch as Backend>::LANES>,
) -> Option<MatrixCoordinates> { ) -> Option<MatrixCoordinates> {
match self.backend { match self.backend {
// FIXME !!!!
#[cfg(any(target_arch = "x86", target_arch = "x86_64"))] #[cfg(any(target_arch = "x86", target_arch = "x86_64"))]
Dispatch::Avx2 => Avx2::argmax_u8(scores), Dispatch::Avx2 => Avx2::argmax_u8(scores),
// #[cfg(any(target_arch = "x86", target_arch = "x86_64"))] // #[cfg(any(target_arch = "x86", target_arch = "x86_64"))]
......
...@@ -438,8 +438,8 @@ unsafe fn argmax_u8_avx2( ...@@ -438,8 +438,8 @@ unsafe fn argmax_u8_avx2(
let r1 = _mm256_unpacklo_epi8(r, _mm256_setzero_si256()); let r1 = _mm256_unpacklo_epi8(r, _mm256_setzero_si256());
let r2 = _mm256_unpackhi_epi8(r, _mm256_setzero_si256()); let r2 = _mm256_unpackhi_epi8(r, _mm256_setzero_si256());
// compare scores to local maximums // compare scores to local maximums
let c1 = _mm256_or_si256(_mm256_cmpgt_epi16(r1, s1), _mm256_cmpeq_epi16(r1, s1)); let c1 = _mm256_cmpgt_epi16(s1, r1);
let c2 = _mm256_or_si256(_mm256_cmpgt_epi16(r2, s2), _mm256_cmpeq_epi16(r2, s2)); let c2 = _mm256_cmpgt_epi16(s2, r2);
// replace indices of new local maximums // replace indices of new local maximums
p1 = _mm256_blendv_epi8(p1, index, c1); p1 = _mm256_blendv_epi8(p1, index, c1);
p2 = _mm256_blendv_epi8(p2, index, c2); p2 = _mm256_blendv_epi8(p2, index, c2);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment