DP-HLS
 All Classes Namespaces Files Functions Variables Typedefs Macros Pages
Align Namespace Reference

Namespace including the functions of the kernel architecture. More...

Namespaces

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

Functions

void 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 InitializeChunkColScore (score_vec_t(&init_col_scr)[PE_NUM], stream_of_blocks< dp_mem_block_t > &dp_mem_out)
 
void 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 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 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 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 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 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 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 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 UpdateDPMemShift (dp_mem_block_t &dp_mem)
 
void 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 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 ChunkMax (ScorePack &max, ScorePack new_scr)
 
void UpdatePEOffset (idx_t(&pe_offset)[PE_NUM], bool(&predicate)[PE_NUM])
 
void CopyColScore (chunk_col_scores_inf_t &init_col_scr_local, score_vec_t(&init_col_scr)[MAX_QUERY_LENGTH], idx_t i)
 
void UpdateDPMemSep (score_vec_t(&dp_mem)[PE_NUM+1][2], score_vec_t(&score_in)[PE_NUM+1])
 
void 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])
 

Detailed Description

Namespace including the functions of the kernel architecture.

Function Documentation

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] 
)

Store the traceback pointers of PE at the correct location in the traceback pointer matrix, based on the predicate and current p_col_offset.

Parameters
tbp_inThe buffer receiving the traceback pointer from the PE output.
p_col_offsetPhysical column of a wavefront of traceback pointers.
predicatePredicates.
chunk_tbp_outThe traceback pointer memory.
void Align::ChunkMax ( ScorePack max,
ScorePack  new_scr 
)
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::InitializeChunkColScore ( score_vec_t(&)  init_col_scr[PE_NUM],
stream_of_blocks< dp_mem_block_t > &  dp_mem_out 
)
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.

Parameters
chunk_row_offsetInitial Row of a Chunk
chunk_col_offsetInitial Column of a Chunk.
icActual Global Coordinates for i.
jcActual Global Coordinates for j.
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.

Parameters
init_col_scr,:Initial scores for the first column.
init_row_scr,:Initial scores for the first row.
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.

Parameters
queryQuery sequence
local_queryLocal query is a buffer of PE_NUM length that is read in parallel by PEs during the wavefront computation.
offsetThe offset in the global query to start copying.
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.

Template Parameters
PE_NUM_TNumber of PE
Parameters
queryQuery Sequence
local_queryLocal Query Buffer
init_col_scrInitial Column Scores
init_col_scr_localLocal Initial Column Score Buffer.
idxThe offset in the global buffer to copy.
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] 
)
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 
)
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.

Parameters
score_vecThe last PE's output score.
predicate_pe_lastThe last PE's predicate value. Write out the score only if the predicate is true.
idxThe index in the buffer to write.
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.

Parameters
predicatePredicate Array.
idxWavefront Index.
query_lenActual query Length.
reference_lenActual reference Length.
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.

Parameters
local_referenceThe local reference buffer.
referenceThe reference.
idxWavefront index.
ref_lenActual reference length.
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.

Deprecated:
This function is deprecated. Please see UpdateDPMemSep which is used in the kernel. .
Parameters
dp_memDP Memory
iThe index of the wavefront.
init_col_scrInitial Column Scores
init_row_scrInitial Row Scores
void Align::UpdateDPMemSep ( score_vec_t(&)  dp_mem[PE_NUM+1][2],
score_vec_t(&)  score_in[PE_NUM+1] 
)
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::UpdateDPMemShift ( dp_mem_block_t dp_mem)
void Align::UpdatePEOffset ( idx_t(&)  pe_offset[PE_NUM],
bool(&)  predicate[PE_NUM] 
)