Skip to content

Commit

Permalink
Fixed generic architecture.
Browse files Browse the repository at this point in the history
  • Loading branch information
bbuchfink committed Oct 27, 2021
1 parent a332de5 commit c35483c
Show file tree
Hide file tree
Showing 6 changed files with 20 additions and 24 deletions.
25 changes: 2 additions & 23 deletions src/dp/score_vector_int16.h
Original file line number Diff line number Diff line change
Expand Up @@ -206,30 +206,9 @@ struct ScoreVector<int16_t, DELTA>
data_(_mm_loadu_si128((const __m128i*)x))
{}

ScoreVector(unsigned a, uint64_t seq)
{
const uint16_t* row((uint16_t*)&score_matrix.matrix16()[a << 5]);
uint64_t b = uint64_t(row[seq & 0xff]);
seq >>= 8;
b |= uint64_t(row[seq & 0xff]) << 16;
seq >>= 8;
b |= uint64_t(row[seq & 0xff]) << 16 * 2;
seq >>= 8;
b |= uint64_t(row[seq & 0xff]) << 16 * 3;
seq >>= 8;
uint64_t c = uint64_t(row[seq & 0xff]);
seq >>= 8;
c |= uint64_t(row[seq & 0xff]) << 16;
seq >>= 8;
c |= uint64_t(row[seq & 0xff]) << 16 * 2;
seq >>= 8;
c |= uint64_t(row[seq & 0xff]) << 16 * 3;
data_ = _mm_set_epi64x(c, b);
}

#ifdef __SSSE3__
ScoreVector(unsigned a, Register seq)
{
#ifdef __SSSE3__
const __m128i *row = reinterpret_cast<const __m128i*>(&score_matrix.matrix8u()[a << 5]);

__m128i high_mask = _mm_slli_epi16(_mm_and_si128(seq, ::SIMD::_mm_set1_epi8('\x10')), 3);
Expand All @@ -242,8 +221,8 @@ struct ScoreVector<int16_t, DELTA>
__m128i s2 = _mm_shuffle_epi8(r2, seq_high);
data_ = _mm_and_si128(_mm_or_si128(s1, s2), ::SIMD::_mm_set1_epi16(255));
data_ = _mm_subs_epi16(data_, ::SIMD::_mm_set1_epi16(score_matrix.bias()));
#endif
}
#endif

ScoreVector operator+(const ScoreVector&rhs) const
{
Expand Down
2 changes: 2 additions & 0 deletions src/dp/score_vector_int8.h
Original file line number Diff line number Diff line change
Expand Up @@ -238,6 +238,7 @@ struct ScoreVector<int8_t, DELTA>
data_(_mm_loadu_si128(reinterpret_cast<const __m128i*>(s)))
{ }

#ifdef __SSSE3__
ScoreVector(unsigned a, __m128i seq)
{
const __m128i* row = reinterpret_cast<const __m128i*>(&score_matrix.matrix8()[a << 5]);
Expand All @@ -252,6 +253,7 @@ struct ScoreVector<int8_t, DELTA>
__m128i s2 = _mm_shuffle_epi8(r2, seq_high);
data_ = _mm_or_si128(s1, s2);
}
#endif

ScoreVector operator+(const ScoreVector&rhs) const
{
Expand Down
5 changes: 5 additions & 0 deletions src/dp/swipe/banded_3frame_swipe.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -425,6 +425,7 @@ list<Hsp> banded_3frame_swipe(
frameshift_penalty(score_matrix.frame_shift());

SwipeProfile<_sv> profile;
std::array<const int8_t*, 32> target_scores;
Score best[ScoreTraits<_sv>::CHANNELS];
int max_col[ScoreTraits<_sv>::CHANNELS];
for (int i = 0; i < ScoreTraits<_sv>::CHANNELS; ++i) {
Expand All @@ -443,7 +444,11 @@ list<Hsp> banded_3frame_swipe(
_sv vgap0, vgap1, vgap2, hgap, col_best;
vgap0 = vgap1 = vgap2 = col_best = ScoreTraits<_sv>::zero();

#ifdef __SSSE3__
profile.set(targets.get());
#else
profile.set(targets.get(target_scores.data()));
#endif
for (int i = i0_; i <= i1_; ++i) {
hgap = it.hgap();
_sv next = cell_update<_sv>(it.sm3, it.sm4, it.sm2, profile.get(q[0][i]), extend_penalty, open_penalty, frameshift_penalty, hgap, vgap0, col_best);
Expand Down
4 changes: 4 additions & 0 deletions src/dp/swipe/banded_swipe.h
Original file line number Diff line number Diff line change
Expand Up @@ -252,7 +252,11 @@ list<Hsp> swipe(const vector<DpTarget>::const_iterator subject_begin, const vect
profile.set(targets.get(target_scores.data()));
}
else {
#ifdef __SSSE3__
profile.set(target_seqv);
#else
profile.set(targets.get(target_scores.data()));
#endif
}
#ifdef DP_STAT
const uint64_t live = targets.live();
Expand Down
4 changes: 4 additions & 0 deletions src/dp/swipe/full_swipe.h
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,11 @@ list<Hsp> swipe(const It target_begin, const It target_end, std::atomic_size_t*
profile.set(targets.get(target_scores.data()));
}
else {
#ifdef __SSSE3__
profile.set(target_seq_vector);
#else
profile.set(targets.get(target_scores.data()));
#endif
}

#ifdef DP_STAT
Expand Down
4 changes: 3 additions & 1 deletion src/dp/swipe/swipe.h
Original file line number Diff line number Diff line change
Expand Up @@ -92,12 +92,14 @@ template<typename Sv>
struct SwipeProfile
{

#ifdef __SSSE3__
inline void set(typename ScoreTraits<Sv>::Vector seq)
{
assert(sizeof(data_) / sizeof(Sv) >= value_traits.alphabet_size);
for (unsigned j = 0; j < AMINO_ACID_COUNT; ++j)
data_[j] = Sv(j, seq);
}
#endif

inline const Sv& get(Letter i) const
{
Expand Down Expand Up @@ -166,7 +168,7 @@ struct SwipeProfile<int32_t>
for (int i = 0; i < 32; ++i)
row[i] = target_scores[0][i];
}
void set(const int32_t * *target_scores) {
void set(const int32_t** target_scores) {
for (int i = 0; i < 32; ++i)
row[i] = target_scores[0][i];
}
Expand Down

0 comments on commit c35483c

Please sign in to comment.