| 1 |
|
| 2 |
|
| 3 |
|
| 4 |
#ifndef CM_IMPL_SSE_INCLUDED |
| 5 |
#define CM_IMPL_SSE_INCLUDED |
| 6 |
|
| 7 |
#include <xmmintrin.h> |
| 8 |
#include <emmintrin.h> |
| 9 |
|
| 10 |
#include <esl_config.h> |
| 11 |
#include <p7_config.h> |
| 12 |
#include "config.h" |
| 13 |
|
| 14 |
#include "easel.h" |
| 15 |
#include "esl_hmm.h" |
| 16 |
|
| 17 |
#include "hmmer.h" |
| 18 |
|
| 19 |
#include "infernal.h" |
| 20 |
|
| 21 |
#define BYTEMAX 255 |
| 22 |
#define WORDMAX 0x7fff |
| 23 |
|
| 24 |
|
| 25 |
|
| 26 |
|
| 27 |
|
| 28 |
typedef struct cm_optimized_s { |
| 29 |
|
| 30 |
int M; |
| 31 |
char *sttype; |
| 32 |
int *cfirst; |
| 33 |
int *cnum; |
| 34 |
int *plast; |
| 35 |
int *pnum; |
| 36 |
|
| 37 |
const ESL_ALPHABET *abc; |
| 38 |
|
| 39 |
|
| 40 |
float scale_w; |
| 41 |
int16_t **tsc; |
| 42 |
int16_t **oesc; |
| 43 |
int16_t *beginsc; |
| 44 |
int16_t *endsc; |
| 45 |
int16_t el_selfsc; |
| 46 |
} CM_OPTIMIZED; |
| 47 |
|
| 48 |
|
| 49 |
|
| 50 |
|
| 51 |
|
| 52 |
typedef struct ccm_bg_s { |
| 53 |
float p1; |
| 54 |
float *f; |
| 55 |
|
| 56 |
ESL_HMM *fhmm; |
| 57 |
} CCM_BG; |
| 58 |
|
| 59 |
|
| 60 |
|
| 61 |
|
| 62 |
|
| 63 |
typedef struct cm_consensus_s { |
| 64 |
int M; |
| 65 |
char *sttype; |
| 66 |
int *next; |
| 67 |
|
| 68 |
|
| 69 |
|
| 70 |
|
| 71 |
ESL_ALPHABET *abc; |
| 72 |
|
| 73 |
|
| 74 |
float e_fraglen; |
| 75 |
float p_rfrag; |
| 76 |
float sc_frag; |
| 77 |
|
| 78 |
|
| 79 |
uint8_t tsb_S_Sa, tsb_S_SM, tsb_S_e, tsb_M_S; |
| 80 |
float scale_b; |
| 81 |
uint8_t base_b; |
| 82 |
uint8_t bias_b; |
| 83 |
uint8_t **oesc; |
| 84 |
|
| 85 |
|
| 86 |
float *mcompo; |
| 87 |
float *fcompo; |
| 88 |
CCM_BG *bg; |
| 89 |
} CM_CONSENSUS; |
| 90 |
|
| 91 |
|
| 92 |
|
| 93 |
|
| 94 |
|
| 95 |
|
| 96 |
|
| 97 |
|
| 98 |
typedef struct gammahitmx_epu8_s { |
| 99 |
int L; |
| 100 |
int *mx; |
| 101 |
int *gback; |
| 102 |
float *savesc; |
| 103 |
float cutoff; |
| 104 |
int i0; |
| 105 |
int iamgreedy; |
| 106 |
} GammaHitMx_epu8; |
| 107 |
|
| 108 |
|
| 109 |
|
| 110 |
|
| 111 |
|
| 112 |
typedef struct hitcoord_epi16_s { |
| 113 |
int16_t score; |
| 114 |
int16_t v; |
| 115 |
int j; |
| 116 |
int16_t d; |
| 117 |
} HitCoord_epi16; |
| 118 |
|
| 119 |
|
| 120 |
|
| 121 |
|
| 122 |
|
| 123 |
|
| 124 |
uint8_t biased_byteify(CM_CONSENSUS *ccm, float sc); |
| 125 |
uint8_t unbiased_byteify(CM_CONSENSUS *ccm, float sc); |
| 126 |
|
| 127 |
|
| 128 |
|
| 129 |
|
| 130 |
|
| 131 |
|
| 132 |
|
| 133 |
static inline int16_t wordify(float scale_w, float sc) |
| 134 |
{ |
| 135 |
sc = roundf(scale_w * sc); |
| 136 |
if (sc >= 32767.0) return 32767; |
| 137 |
else if (sc <= -32768.0) return -32768; |
| 138 |
else return (int16_t) sc; |
| 139 |
} |
| 140 |
|
| 141 |
CM_OPTIMIZED* cm_optimized_Convert(const CM_t *cm); |
| 142 |
void cm_optimized_Free(CM_OPTIMIZED *ocm); |
| 143 |
|
| 144 |
CM_CONSENSUS* cm_consensus_Convert(CM_t *cm); |
| 145 |
void cm_consensus_Free(CM_CONSENSUS *ccm); |
| 146 |
float ccm_explen(CM_CONSENSUS *ccm, float t1, float t2, float t3); |
| 147 |
int ccm_SetCompo(CM_CONSENSUS *ccm, float f_S_Sa, float f_S_SM, float f_S_e); |
| 148 |
CCM_BG* ccm_bg_CreateUniform(CM_CONSENSUS *ccm); |
| 149 |
void ccm_bg_Destroy(CCM_BG *bg); |
| 150 |
int ccm_bg_NullOne(const CCM_BG *bg, int L, float *ret_sc); |
| 151 |
int ccm_bg_SetFilter(CM_CONSENSUS *ccm, float mL, float sL); |
| 152 |
int ccm_bg_FilterScore(CCM_BG *bg, ESL_DSQ *dsq, int L, float *ret_sc); |
| 153 |
|
| 154 |
|
| 155 |
GammaHitMx_epu8 *CreateGammaHitMx_epu8(int L, int i0, int be_greedy, int offset_zero, float cutoff, int do_backward); |
| 156 |
void FreeGammaHitMx_epu8(GammaHitMx_epu8 *gamma); |
| 157 |
int UpdateGammaHitMx_epu8(CM_CONSENSUS *ccm, char *errbuf, GammaHitMx_epu8 *gamma, int j, __m128i *alpha_row, CM_TOPHITS *hitlist, int W, int sW); |
| 158 |
void TBackGammaHitMx_epu8 (GammaHitMx_epu8 *gamma, CM_TOPHITS *hitlist, int i0, int j0); |
| 159 |
|
| 160 |
|
| 161 |
int SSE_MSCYK(CM_CONSENSUS *ccm, char *errbuf, int W, ESL_DSQ *dsq, int i0, int j0, uint8_t cutoff, |
| 162 |
CM_TOPHITS *hitlist, int do_null3, float **ret_vsc, float *ret_sc); |
| 163 |
CM_TOPHITS * ResolveMSCYK(CM_TOPHITS *initial, int i0, int j0, int W, float cutoff); |
| 164 |
|
| 165 |
|
| 166 |
int SSE_CYKScan(CM_t *cm, char *errbuf, CM_SCAN_MX *smx, ESL_DSQ *dsq, |
| 167 |
int i0, int j0, float cutoff, CM_TOPHITS *hitlist, |
| 168 |
int do_null3, float **ret_vsc, float *ret_sc); |
| 169 |
|
| 170 |
|
| 171 |
float SSE_CYKInside(CM_t *cm, ESL_DSQ *dsq, int L, int r, |
| 172 |
int i0, int j0, Parsetree_t **ret_tr); |
| 173 |
float SSE_CYKInsideScore(CM_t *cm, ESL_DSQ *dsq, int L, int r, int i0, int j0); |
| 174 |
float SSE_CYKDemands(CM_t *cm, int L, int be_quiet); |
| 175 |
float SSE_CYKDivideAndConquer(CM_t *cm, ESL_DSQ *dsq, int L, int r, |
| 176 |
int i0, int j0, Parsetree_t **ret_tr); |
| 177 |
int SSE_CYKFilter_epi16(CM_OPTIMIZED *ocm, ESL_DSQ *dsq, int L, int vroot, int vend, int i0, int j0, |
| 178 |
int allow_begin, int *ret_b, int *ret_bsc, HitCoord_epi16 *ret_coord); |
| 179 |
|
| 180 |
|
| 181 |
|
| 182 |
__m128 alt_rightshift_ps(__m128 a, __m128 b); |
| 183 |
void vecprint_ps(__m128 a); |
| 184 |
|
| 185 |
|
| 186 |
|
| 187 |
|
| 188 |
|
| 189 |
|
| 190 |
|
| 191 |
|
| 192 |
|
| 193 |
|
| 194 |
|
| 195 |
|
| 196 |
|
| 197 |
static inline __m128i sse_setlw_neginfv(__m128i a) |
| 198 |
{ |
| 199 |
__m128i mask = _mm_setr_epi16(0x0000,0xffff,0xffff,0xffff,0xffff,0xffff,0xffff,0xffff); |
| 200 |
__m128i setv = _mm_setr_epi16(-32768,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000); |
| 201 |
|
| 202 |
return _mm_or_si128(_mm_and_si128(a,mask),setv); |
| 203 |
} |
| 204 |
|
| 205 |
|
| 206 |
|
| 207 |
|
| 208 |
|
| 209 |
|
| 210 |
static inline __m128i sse_select_si128(__m128i a, __m128i b, __m128i mask) |
| 211 |
{ |
| 212 |
b = _mm_and_si128(b, mask); |
| 213 |
a = _mm_andnot_si128(mask, a); |
| 214 |
return _mm_or_si128(a, b); |
| 215 |
} |
| 216 |
|
| 217 |
|
| 218 |
#endif |
| 219 |
|
| 220 |
|