DP-HLS
 All Classes Namespaces Files Functions Variables Typedefs Macros Pages
align.h File Reference
#include <ap_int.h>
#include <hls_vector.h>
#include <hls_stream.h>
#include "dp_hls_common.h"
#include "PE.h"
#include "utils.h"
#include "frontend.h"

Go to the source code of this file.

Namespaces

 Align
 Namespace including the functions of the kernel architecture.
 
 Align::FindMax
 Namespace related to functions used to find the maximum elements in in the score matrix.
 
 Align::Rectangular
 This namespace contains functions to define the core architectures used in the non-banding alignment kernel.
 
 Align::Fixed
 This namespace contains functions to define the core architectures used in the fixed banding alignment kernel.
 

Functions

void Align::PrepareLocalQuery (char_t(&query)[MAX_QUERY_LENGTH], char_t(&local_query)[PE_NUM], const idx_t offset)
 At beginning of the computation of each strip, it copy a PE_NUM number of the global query characters into the local query buffer. More...
 
void Align::InitializeChunkColScore (score_vec_t(&init_col_scr)[PE_NUM], stream_of_blocks< dp_mem_block_t > &dp_mem_out)
 
void Align::PrepareScoresArr (dp_mem_block_t &dp_mem_in, score_vec_t(&init_col_scr)[PE_NUM], int id, score_vec_t(&last_chunk_scr)[2], wavefront_scores_t &up_out, wavefront_scores_t &diag_out, wavefront_scores_t &left_out)
 
template<int PE_NUM_T>
void Align::PrepareLocals (const char_t(&query)[MAX_QUERY_LENGTH], char_t(&local_query)[PE_NUM_T], score_vec_t(&init_col_scr)[MAX_QUERY_LENGTH], chunk_col_scores_inf_t &init_col_scr_local, bool(&col_pred)[PE_NUM], const idx_t local_query_len, const idx_t idx)
 This function merge PrepareLocalQuery function and CopyColScore function into one, where CopyColScore is a function to copy a column of initial scores from the global buffer to each PE's local buffer before the computation of each chunk. More...
 
void Align::InitializeChunkCoordinates (idx_t chunk_row_offset, idx_t chunk_col_offset, hls::vector< idx_t, PE_NUM > &ic, hls::vector< idx_t, PE_NUM > &jc)
 Initialize two lists of coordinates, x coordinate and y coordinate, for each chunk. Theis function is called within the chunk compute function. This is especially useful if the chunk doesn't start at the beginning, i.e. after chunk column offset is developed. More...
 
void Align::ArrangeTBP (const tbp_vec_t &tbp_in, const idx_t &p_col_offset, const bool(&predicate)[PE_NUM], tbp_t(&chunk_tbp_out)[PE_NUM][TBMEM_SIZE])
 
void Align::ShiftPredicate (bool(&predicate)[PE_NUM], int idx, int query_len, int reference_len)
 Determine the predicate values by constantantly shifting the predicate array with truth values. More...
 
void Align::ShiftReference (char_t(&local_reference)[PE_NUM], const char_t(&reference)[MAX_REFERENCE_LENGTH], int idx, int ref_len)
 Shift into the local reference buffer a new reference element, given current wavefront index and reference length. More...
 
void Align::PreserveRowScore (score_vec_t(&preserved_row_scr)[MAX_REFERENCE_LENGTH], const score_vec_t score_vec, const bool predicate_pe_last, const idx_t idx)
 Write the last PE's output score to the preserved_row_score buffer to be used in the next chunk. More...
 
void Align::UpdateDPMem (dp_mem_block_t &dp_mem, idx_t i, chunk_col_scores_inf_t &init_col_scr, score_vec_t(&init_row_scr)[MAX_REFERENCE_LENGTH])
 Updated the content of the DP Memory with the new scores. It saparates the step of shifting and setting the specific cell with initial scores. More...
 
void Align::UpdateDPMemShift (dp_mem_block_t &dp_mem)
 
void Align::UpdateDPMemSet (dp_mem_block_t &dp_mem, idx_t i, chunk_col_scores_inf_t &init_col_scr, score_vec_t(&init_row_scr)[MAX_REFERENCE_LENGTH])
 
void Align::FindMax::ReductionMaxScores (ScorePack(&max)[PE_NUM], ScorePack &chunk_max, idx_t &max_pe)
 Compare the local maximum of each PE after the score computation and keep the global maximum score. More...
 
void Align::Rectangular::AlignStatic (const char_t(&querys)[MAX_QUERY_LENGTH], const char_t(&references)[MAX_REFERENCE_LENGTH], const idx_t query_length, const idx_t reference_length, const Penalties &penalties, idx_t &tb_i, idx_t &tb_j, tbr_t(&tb_out)[MAX_REFERENCE_LENGTH+MAX_QUERY_LENGTH])
 Perform Pairwise alignment for two sequences in rectangular grid, with virtual coordinates. More...
 
void Align::Rectangular::ChunkCompute (idx_t chunk_row_offset, input_char_block_t &query, const char_t(&reference)[MAX_REFERENCE_LENGTH], chunk_col_scores_inf_t &init_col_scr, score_vec_t(&init_row_scr)[MAX_REFERENCE_LENGTH], idx_t &p_col_offset, idx_t ck_idx, idx_t global_query_length, idx_t query_length, idx_t reference_length, const bool(&col_pred)[PE_NUM], const Penalties &penalties, ScorePack(&max)[PE_NUM], tbp_t(&chunk_tbp_out)[PE_NUM][TBMEM_SIZE])
 Compute the traceback pointers for a chunk of the size PE_NUM * REFERENCE_LENGTH, with rectangular grid and virtual coordinates. More...
 
void Align::Rectangular::MapPredicate (const idx_t wavefront, const idx_t ref_len, const idx_t qry_len, bool(&row_pred)[PE_NUM], const bool(&col_pred)[PE_NUM], bool(&pred)[PE_NUM])
 Logics to map the global coordinates of a wavefront of PE to their prediate values. MapPredicateSquare is a function F: (pe_row: int, pe_col: int) -> (predicate_balue: boolean) It's unrolled for PE_NUM applying to each PE. More...
 
void Align::Fixed::AlignStatic (const char_t(&querys)[MAX_QUERY_LENGTH], const char_t(&references)[MAX_REFERENCE_LENGTH], const idx_t query_length, const idx_t reference_length, const Penalties &penalties, idx_t &tb_i, idx_t &tb_j, tbr_t(&tb_out)[MAX_REFERENCE_LENGTH+MAX_QUERY_LENGTH])
 Perform Pairwise alignment for two sequences, in fixed banding with virtual coordinates. More...
 
void Align::Fixed::ChunkCompute (const idx_t chunk_row_offset, const input_char_block_t &query, const char_t(&reference)[MAX_REFERENCE_LENGTH], const chunk_col_scores_inf_t &init_col_scr, score_vec_t(&init_row_scr)[MAX_REFERENCE_LENGTH], idx_t p_cols, const idx_t ck_idx, idx_t &l_lim_reg, idx_t &u_lim_reg, const bool(&col_pred)[PE_NUM], const idx_t global_query_length, const idx_t local_query_length, const idx_t reference_length, const Penalties &penalties, ScorePack(&max)[PE_NUM], tbp_t(&chunk_tbp_out)[PE_NUM][TBMEM_SIZE])
 Compute the traceback pointers for a chunk of the size PE_NUM * REFERENCE_LENGTH, with fixed banding and virtual coordinates. More...
 
void Align::Fixed::MapPredicate (const idx_t(&local_l_lim)[PE_NUM], const idx_t(&local_u_lim)[PE_NUM], const idx_t(&virtual_cols)[PE_NUM], const bool(&col_pred)[PE_NUM], bool(&predicate)[PE_NUM])
 Logics to map the global coordinates of a wavefront of PE to their prediate values. MapPredicateSquare is a function F: (pe_row: int, pe_col: int) -> (predicate_balue: boolean) It's unrolled for PE_NUM applying to each PE. More...
 
template<int PE_NUM_, int MAX_QUERY_LENGTH_>
void Align::Fixed::PrepareLocals (const char_t(&query)[MAX_QUERY_LENGTH_], const score_vec_t(&init_col_scr)[MAX_QUERY_LENGTH_], char_t(&local_query)[PE_NUM_], chunk_col_scores_inf_t &init_col_scr_local, bool(&col_pred)[PE_NUM_], const idx_t local_query_len, const idx_t idx)
 
void Align::InitializeScores (score_vec_t(&init_col_scr)[MAX_QUERY_LENGTH], score_vec_t(&init_row_scr)[MAX_REFERENCE_LENGTH], const Penalties &penalties)
 Initialize initial scores for the first column and row on the device. More...
 
void Align::ChunkMax (ScorePack &max, ScorePack new_scr)
 
void Align::UpdatePEOffset (idx_t(&pe_offset)[PE_NUM], bool(&predicate)[PE_NUM])
 
void Align::CopyColScore (chunk_col_scores_inf_t &init_col_scr_local, score_vec_t(&init_col_scr)[MAX_QUERY_LENGTH], idx_t i)
 
void Align::UpdateDPMemSep (score_vec_t(&dp_mem)[PE_NUM+1][2], score_vec_t(&score_in)[PE_NUM+1])
 
void Align::PrepareScoreBuffer (score_vec_t(&score_buff)[PE_NUM+1], const idx_t i, const chunk_col_scores_inf_t(&init_col_scr), const score_vec_t(&init_row_scr)[MAX_REFERENCE_LENGTH])