BWA-FastAlign/ksw_align_avx.h

74 lines
2.5 KiB
C
Raw Normal View History

#pragma once
#include <emmintrin.h>
#include <immintrin.h>
#include <stdint.h>
#include "ksw.h"
#define AMBIG_ 4 // ambiguous base
// for 16 bit
#define DUMMY1_ 4
#define DUMMY2_ 5
#define DUMMY3 26
#define AMBR16 15
#define AMBQ16 16
// for 8-bit
#define DUMMY8 8
#define DUMMY5 5
#define AMBRQ 0xFF
#define AMBR 4
#define AMBQ 8
#define min_(x, y) ((x) > (y) ? (y) : (x))
#define max_(x, y) ((x) > (y) ? (x) : (y))
typedef struct {
int score; // best score
int te, qe; // target end and query end
int score2, te2; // second best score and ending position on the target
int tb, qb; // target start and query start
} kswr_avx_t;
typedef struct {
int seq_len;
int ref_len;
uint8_t* H0;
uint8_t* H1;
uint8_t* Hmax;
uint8_t* F;
uint8_t* rowMax;
uint8_t* seqArr;
uint8_t* refArr;
} msw_buf_t; // inter-query算法的mate sw计算过程需要用到的缓存空间
#ifdef __cplusplus
extern "C" {
#endif
void ksw_align_avx2_u8(int qlen, uint8_t* query, int tlen, uint8_t* target, int m, const int8_t* mat, int gapo, int gape, int xtra, kswq_t** qry);
void ksw_align_avx2_i16(int qlen, uint8_t* query, int tlen, uint8_t* target, int m, const int8_t* mat, int gapo, int gape, int xtra, kswq_t** qry);
void ksw_align_avx512_u8(int8_t w_match, // match分数正数
int8_t w_mismatch, // 错配罚分,负数
int8_t o_ins, // 开始一个insert罚分正数
int8_t e_ins, // 延续一个insert罚分正数
int8_t o_del, // 开始一个delete罚分正数
int8_t e_del, // 延续一个delete罚分正数
msw_buf_t* cache, // 计算用到的一些数据
uint8_t* seq1SoA, // ref序列已经pack好了
uint8_t* seq2SoA, // seq序列
int16_t nrow, // 最长的行数对应ref长度
int16_t ncol, // 最长的列数对应seq长度
int* xtras, // 每个seq对应一个xtra
int* rlenA, // ref真实长度
kswr_avx_t* alns, // 存放结果
int phase); // 正向阶段0反向阶段1
void ksw_align_avx512_i16(int qlen, uint8_t* query, int tlen, uint8_t* target, int m, const int8_t* mat, int gapo, int gape, int xtra, kswq_t** qry);
#ifdef __cplusplus
}
#endif