[med-svn] [Git][med-team/last-align][upstream] New upstream version 1045

Michael R. Crusoe gitlab at salsa.debian.org
Mon Dec 30 17:58:22 GMT 2019



Michael R. Crusoe pushed to branch upstream at Debian Med / last-align


Commits:
73307486 by Michael R. Crusoe at 2019-12-30T17:44:41Z
New upstream version 1045
- - - - -


6 changed files:

- ChangeLog.txt
- src/Alignment.cc
- src/GappedXdropAligner.hh
- src/GappedXdropAlignerDna.cc
- src/mcf_simd.hh
- src/version.hh


Changes:

=====================================
ChangeLog.txt
=====================================
@@ -1,9 +1,16 @@
+2019-12-23  Martin C. Frith  <Martin C. Frith>
+
+	* src/Alignment.cc, src/GappedXdropAligner.hh,
+	src/GappedXdropAlignerDna.cc, src/mcf_simd.hh:
+	Make it usable without SSE/SIMD
+	[4270e27518ca] [tip]
+
 2019-12-20  Martin C. Frith  <Martin C. Frith>
 
 	* src/GappedXdropAligner.hh, src/GappedXdropAlignerDna.cc,
 	src/mcf_simd.hh, test/last-test.out, test/last-test.sh:
 	Maybe make lastal gapped alignment a bit faster
-	[11810fcff80c] [tip]
+	[11810fcff80c]
 
 2019-12-19  Martin C. Frith  <Martin C. Frith>
 


=====================================
src/Alignment.cc
=====================================
@@ -347,11 +347,13 @@ void Alignment::extend( std::vector< SegmentPair >& chunks,
 				  del.openCost, del.growCost,
 				  ins.openCost, ins.growCost,
 				  gap.pairCost, gap.isAffine, maxDrop, smMax)
+#if defined __SSE4_1__
     : isSimdMatrix ? aligner.alignDna(seq1 + start1, seq2 + start2,
 				      isForward, sm,
 				      del.openCost, del.growCost,
 				      ins.openCost, ins.growCost,
 				      maxDrop, smMax, alph.numbersToUppercase)
+#endif
     :           aligner.align(seq1 + start1, seq2 + start2,
 			      isForward, globality, sm,
 			      del.openCost, del.growCost,
@@ -370,12 +372,16 @@ void Alignment::extend( std::vector< SegmentPair >& chunks,
     if( isGreedy ){
       while( greedyAligner.getNextChunk( end1, end2, size ) )
 	chunks.push_back( SegmentPair( end1 - size, end2 - size, size ) );
-    } else if (isSimdMatrix && !pssm2 && !sm2qual) {
+    }
+#if defined __SSE4_1__
+    else if (isSimdMatrix && !pssm2 && !sm2qual) {
       while (aligner.getNextChunkDna(end1, end2, size,
 				     del.openCost, del.growCost,
 				     ins.openCost, ins.growCost))
 	chunks.push_back(SegmentPair(end1 - size, end2 - size, size));
-    }else{
+    }
+#endif
+    else {
       while( aligner.getNextChunk( end1, end2, size,
 				   del.openCost, del.growCost,
 				   ins.openCost, ins.growCost, gap.pairCost ) )


=====================================
src/GappedXdropAligner.hh
=====================================
@@ -317,7 +317,7 @@ class GappedXdropAligner {
   void init3();
 
   // Everything below here is for alignDna & getNextChunkDna
-
+#if defined __SSE4_1__
   std::vector<TinyScore> xTinyScores;
   std::vector<TinyScore> yTinyScores;
   std::vector<TinyScore> zTinyScores;
@@ -362,6 +362,7 @@ class GappedXdropAligner {
     while (*x2 != target) ++x2;
     bestSeq1position = x2 - x2beg + seq1beg;
   }
+#endif
 };
 
 }


=====================================
src/GappedXdropAlignerDna.cc
=====================================
@@ -1,6 +1,8 @@
 // Author: Martin C. Frith 2019
 // SPDX-License-Identifier: GPL-3.0-or-later
 
+#if defined __SSE4_1__
+
 #include "GappedXdropAligner.hh"
 #include "GappedXdropAlignerInl.hh"
 
@@ -109,7 +111,7 @@ int GappedXdropAligner::alignDna(const uchar *seq1,
 	SimdInt y = simdAdds1(simdLoad(y1+i), mDelGrowCost1);
 	SimdInt z = simdAdds1(simdLoad(z1+i), mInsGrowCost1);
 	SimdInt b = simdMin1(simdMin1(x, y), z);
-	SimdInt isDrop = simdEq1(simdMin1(b, mBadScore), mBadScore);
+	SimdInt isDrop = simdGe1(b, mBadScore);
 	mBestScore = simdMin1(b, mBestScore);
 	simdStore(x0+i, simdOr(simdSub1(b, s), isDrop));
 	simdStore(y0+i, simdMin1(simdAdds1(b, mDelOpenCost), y));
@@ -166,7 +168,7 @@ int GappedXdropAligner::alignDna(const uchar *seq1,
 	SimdInt y = simdAdds1(simdLoad(y1+i), mDelGrowCost1);
 	SimdInt z = simdAdds1(simdLoad(z1+i), mInsGrowCost1);
 	SimdInt b = simdMin1(simdMin1(x, y), z);
-	SimdInt isDrop = simdEq1(simdMin1(b, mBadScore), mBadScore);
+	SimdInt isDrop = simdGe1(b, mBadScore);
 	mBestScore = simdMin1(b, mBestScore);
 	simdStore(x0+i, simdOr(simdSub1(b, s), isDrop));
 	simdStore(y0+i, simdMin1(simdAdds1(b, mDelOpenCost), y));
@@ -273,3 +275,5 @@ bool GappedXdropAligner::getNextChunkDna(size_t &end1,
 }
 
 }
+
+#endif


=====================================
src/mcf_simd.hh
=====================================
@@ -4,7 +4,9 @@
 #ifndef MCF_SIMD_HH
 #define MCF_SIMD_HH
 
+#if defined __SSE4_1__
 #include <immintrin.h>
+#endif
 
 namespace mcf {
 
@@ -39,21 +41,12 @@ static inline SimdInt simdBlend(SimdInt x, SimdInt y, SimdInt mask) {
 }
 
 const int simdLen = 8;
-const int simdLen2 = 16;
 
 static inline SimdInt simdSet(int i7, int i6, int i5, int i4,
 			      int i3, int i2, int i1, int i0) {
   return _mm256_set_epi32(i7, i6, i5, i4, i3, i2, i1, i0);
 }
 
-static inline SimdInt simdSet2(short iF, short iE, short iD, short iC,
-			       short iB, short iA, short i9, short i8,
-			       short i7, short i6, short i5, short i4,
-			       short i3, short i2, short i1, short i0) {
-  return _mm256_set_epi16(iF, iE, iD, iC, iB, iA, i9, i8,
-			  i7, i6, i5, i4, i3, i2, i1, i0);
-}
-
 static inline SimdInt simdSet1(char jF, char jE, char jD, char jC,
 			       char jB, char jA, char j9, char j8,
 			       char j7, char j6, char j5, char j4,
@@ -72,34 +65,22 @@ static inline SimdInt simdFill(int x) {
   return _mm256_set1_epi32(x);
 }
 
-static inline SimdInt simdFill2(short x) {
-  return _mm256_set1_epi16(x);
-}
-
 static inline SimdInt simdFill1(char x) {
   return _mm256_set1_epi8(x);
 }
 
-static inline SimdInt simdEq1(SimdInt x, SimdInt y) {
-  return _mm256_cmpeq_epi8(x, y);
-}
-
 static inline SimdInt simdGt(SimdInt x, SimdInt y) {
   return _mm256_cmpgt_epi32(x, y);
 }
 
-static inline SimdInt simdGt2(SimdInt x, SimdInt y) {
-  return _mm256_cmpgt_epi16(x, y);
+static inline SimdInt simdGe1(SimdInt x, SimdInt y) {
+  return _mm256_cmpeq_epi8(_mm256_min_epu8(x, y), y);
 }
 
 static inline SimdInt simdAdd(SimdInt x, SimdInt y) {
   return _mm256_add_epi32(x, y);
 }
 
-static inline SimdInt simdAdd2(SimdInt x, SimdInt y) {
-  return _mm256_add_epi16(x, y);
-}
-
 static inline SimdInt simdAdd1(SimdInt x, SimdInt y) {
   return _mm256_add_epi8(x, y);
 }
@@ -112,10 +93,6 @@ static inline SimdInt simdSub(SimdInt x, SimdInt y) {
   return _mm256_sub_epi32(x, y);
 }
 
-static inline SimdInt simdSub2(SimdInt x, SimdInt y) {
-  return _mm256_sub_epi16(x, y);
-}
-
 static inline SimdInt simdSub1(SimdInt x, SimdInt y) {
   return _mm256_sub_epi8(x, y);
 }
@@ -128,10 +105,6 @@ static inline SimdInt simdMax(SimdInt x, SimdInt y) {
   return _mm256_max_epi32(x, y);
 }
 
-static inline SimdInt simdMax2(SimdInt x, SimdInt y) {
-  return _mm256_max_epi16(x, y);
-}
-
 static inline SimdInt simdMin1(SimdInt x, SimdInt y) {
   return _mm256_min_epu8(x, y);
 }
@@ -144,14 +117,6 @@ static inline int simdHorizontalMax(SimdInt x) {
   return _mm_cvtsi128_si32(z);
 }
 
-static inline int simdHorizontalMax2(SimdInt x) {
-  __m128i z = _mm256_castsi256_si128(x);
-  z = _mm_max_epi16(z, _mm256_extracti128_si256(x, 1));
-  z = _mm_sub_epi16(_mm_set1_epi16(32767), z);
-  z = _mm_minpos_epu16(z);
-  return 32767 - _mm_extract_epi16(z, 0);
-}
-
 static inline int simdHorizontalMin1(SimdInt x) {
   __m128i z = _mm256_castsi256_si128(x);
   z = _mm_min_epu8(z, _mm256_extracti128_si256(x, 1));
@@ -195,17 +160,11 @@ static inline SimdInt simdBlend(SimdInt x, SimdInt y, SimdInt mask) {
 }
 
 const int simdLen = 4;
-const int simdLen2 = 8;
 
 static inline SimdInt simdSet(int i3, int i2, int i1, int i0) {
   return _mm_set_epi32(i3, i2, i1, i0);
 }
 
-static inline SimdInt simdSet2(short i7, short i6, short i5, short i4,
-			       short i3, short i2, short i1, short i0) {
-  return _mm_set_epi16(i7, i6, i5, i4, i3, i2, i1, i0);
-}
-
 static inline SimdInt simdSet1(char iF, char iE, char iD, char iC,
 			       char iB, char iA, char i9, char i8,
 			       char i7, char i6, char i5, char i4,
@@ -218,34 +177,22 @@ static inline SimdInt simdFill(int x) {
   return _mm_set1_epi32(x);
 }
 
-static inline SimdInt simdFill2(short x) {
-  return _mm_set1_epi16(x);
-}
-
 static inline SimdInt simdFill1(char x) {
   return _mm_set1_epi8(x);
 }
 
-static inline SimdInt simdEq1(SimdInt x, SimdInt y) {
-  return _mm_cmpeq_epi8(x, y);
-}
-
 static inline SimdInt simdGt(SimdInt x, SimdInt y) {
   return _mm_cmpgt_epi32(x, y);
 }
 
-static inline SimdInt simdGt2(SimdInt x, SimdInt y) {
-  return _mm_cmpgt_epi16(x, y);
+static inline SimdInt simdGe1(SimdInt x, SimdInt y) {
+  return _mm_cmpeq_epi8(_mm_min_epu8(x, y), y);
 }
 
 static inline SimdInt simdAdd(SimdInt x, SimdInt y) {
   return _mm_add_epi32(x, y);
 }
 
-static inline SimdInt simdAdd2(SimdInt x, SimdInt y) {
-  return _mm_add_epi16(x, y);
-}
-
 static inline SimdInt simdAdd1(SimdInt x, SimdInt y) {
   return _mm_add_epi8(x, y);
 }
@@ -258,10 +205,6 @@ static inline SimdInt simdSub(SimdInt x, SimdInt y) {
   return _mm_sub_epi32(x, y);
 }
 
-static inline SimdInt simdSub2(SimdInt x, SimdInt y) {
-  return _mm_sub_epi16(x, y);
-}
-
 static inline SimdInt simdSub1(SimdInt x, SimdInt y) {
   return _mm_sub_epi8(x, y);
 }
@@ -274,10 +217,6 @@ static inline SimdInt simdMax(SimdInt x, SimdInt y) {
   return _mm_max_epi32(x, y);  // SSE4.1
 }
 
-static inline SimdInt simdMax2(SimdInt x, SimdInt y) {
-  return _mm_max_epi16(x, y);
-}
-
 static inline SimdInt simdMin1(SimdInt x, SimdInt y) {
   return _mm_min_epu8(x, y);
 }
@@ -288,12 +227,6 @@ static inline int simdHorizontalMax(SimdInt x) {
   return _mm_cvtsi128_si32(x);
 }
 
-static inline int simdHorizontalMax2(SimdInt x) {
-  x = simdSub2(simdFill2(32767), x);
-  x = _mm_minpos_epu16(x);  // SSE4.1
-  return 32767 - _mm_extract_epi16(x, 0);
-}
-
 static inline int simdHorizontalMin1(SimdInt x) {
   x = _mm_min_epu8(x, _mm_srli_epi16(x, 8));
   x = _mm_minpos_epu16(x);  // SSE4.1
@@ -301,13 +234,15 @@ static inline int simdHorizontalMin1(SimdInt x) {
 }
 
 static inline SimdInt simdChoose1(SimdInt items, SimdInt choices) {
-  return _mm_shuffle_epi8(items, choices);
+  return _mm_shuffle_epi8(items, choices);  // SSSE3
 }
 
 #else
 
 typedef int SimdInt;
+const int simdBytes = 1;
 const int simdLen = 1;
+static inline int simdZero() { return 0; }
 static inline int simdSet(int x) { return x; }
 static inline int simdFill(int x) { return x; }
 static inline int simdLoad(const int *p) { return *p; }


=====================================
src/version.hh
=====================================
@@ -1 +1 @@
-"1044"
+"1045"



View it on GitLab: https://salsa.debian.org/med-team/last-align/commit/7330748602b56bfe29fc09265d90980dfed68b02

-- 
View it on GitLab: https://salsa.debian.org/med-team/last-align/commit/7330748602b56bfe29fc09265d90980dfed68b02
You're receiving this email because of your account on salsa.debian.org.


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://alioth-lists.debian.net/pipermail/debian-med-commit/attachments/20191230/5738171e/attachment-0001.html>


More information about the debian-med-commit mailing list