Skip to content

Commit

Permalink
updated the global linear kernel to its compiled version (the kernel/…
Browse files Browse the repository at this point in the history
… version is outdated).
  • Loading branch information
ioeddk committed May 27, 2024
1 parent e452caf commit b7f8e22
Showing 1 changed file with 17 additions and 38 deletions.
55 changes: 17 additions & 38 deletions kernels/global_linear/kernel_global_linear.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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)
{
Expand Down

0 comments on commit b7f8e22

Please sign in to comment.