From b7f8e2257ad56d5cc7a09d12bd79d5f1fd470971 Mon Sep 17 00:00:00 2001 From: Yingqi Cao Date: Mon, 27 May 2024 05:34:13 +0000 Subject: [PATCH] updated the global linear kernel to its compiled version (the kernel/ version is outdated). --- .../global_linear/kernel_global_linear.cpp | 55 ++++++------------- 1 file changed, 17 insertions(+), 38 deletions(-) diff --git a/kernels/global_linear/kernel_global_linear.cpp b/kernels/global_linear/kernel_global_linear.cpp index 2a509ece..1ffedbac 100644 --- a/kernels/global_linear/kernel_global_linear.cpp +++ b/kernels/global_linear/kernel_global_linear.cpp @@ -51,57 +51,36 @@ void GlobalLinear::PE::Compute(char_t local_query_val, } void GlobalLinear::UpdatePEMaximum( - wavefront_scores_inf_t scores, + const wavefront_scores_inf_t scores, ScorePack (&max)[PE_NUM], - idx_t (&ics)[PE_NUM], idx_t (&jcs)[PE_NUM], - idx_t (&p_col)[PE_NUM], idx_t ck_idx, - bool (&predicate)[PE_NUM], - idx_t query_len, idx_t ref_len){ - -// for (int i = 0; i < PE_NUM; i++) -// { -// #pragma HLS unroll -// if (predicate[i]) -// { -// if (scores[i + 1][LAYER_MAXIMIUM] > max[i].score) -// { -// // Notice this filtering condition compared to the Local Affine kernel. -// // if ((chunk_offset + i == query_len - 1) || (pe_offset[i] == ref_len - 1)) // last row or last column -// if ( (ics[i] == query_len - 1) && (jcs[i] == ref_len - 1) ) -// { // So we are at the last row or last column -// max[i].score = scores[i + 1][LAYER_MAXIMIUM]; -// max[i].row = ics[i]; -// max[i].col = jcs[i]; -// max[i].p_col = p_col[i]; -// max[i].ck = ck_idx; -// max[i].pe = i; -// } -// } -// } -// } + const idx_t chunk_row_offset, const idx_t wavefront, + const idx_t p_cols, const idx_t ck_idx, + const bool (&predicate)[PE_NUM], + const idx_t query_len, const idx_t ref_len){ + + + // PE maximum doesn't need to be updated for the global affine kernels since + // we know that the traceback starts from the bottom right element of the score matrix } -void GlobalLinear::InitializeMaxScores(ScorePack (&max)[PE_NUM], idx_t qry_len, idx_t ref_len){ + +void GlobalLinear::InitializeMaxScores(ScorePack (&max)[PE_NUM], idx_t qry_len, idx_t ref_len) +{ for (int i = 0; i < PE_NUM; i++) { #pragma HLS unroll - max[i].score = 0; // Need a custom struct for finding the negative infinity - max[i].row = 0; - max[i].col = 0; + max[i].score = NINF; max[i].p_col = 0; max[i].ck = 0; - max[i].pe = i; } idx_t max_pe = (qry_len - 1) % PE_NUM; - idx_t max_ck = (qry_len - 1)/ PE_NUM; - max[max_pe].score = INF; // This is dummy score by I just represent the idea it's maximum - max[max_pe].row = qry_len - 1; - max[max_pe].col = ref_len - 1; - max[max_pe].p_col = (max_ck + 1) * ref_len - 1; // FIXME + idx_t max_ck = (qry_len - 1) / PE_NUM; + max[max_pe].score = INF; + max[max_pe].p_col = (max_ck) * (MAX_REFERENCE_LENGTH + PE_NUM - 1) + max_pe + ref_len - 1; max[max_pe].ck = max_ck; - max[max_pe].pe = max_pe; } + void GlobalLinear::Traceback::StateInit(tbp_t tbp, TB_STATE &state){ if (tbp == TB_DIAG) {