hashBuildProbeV4 - 2023.2 English

Vitis Libraries

Release Date
2023-12-20
Version
2023.2 English
#include "xf_database/hash_join_v4.hpp"
template <
    int KEYW,
    int PW,
    int S_PW,
    int B_PW,
    int HASHWH,
    int HASHWL,
    int HASHO,
    int ARW,
    int CH_NM,
    int BF_HASH_NM,
    int BFW,
    int EN_BF
    >
static void hashBuildProbeV4 (
    bool& build_probe_flag,
    hls::stream <ap_uint <KEYW>> k0_strm_arry [CH_NM],
    hls::stream <ap_uint <PW>> p0_strm_arry [CH_NM],
    hls::stream <bool> e0_strm_arry [CH_NM],
    ap_uint <64>* htb0_buf,
    ap_uint <64>* htb1_buf,
    ap_uint <64>* htb2_buf,
    ap_uint <64>* htb3_buf,
    ap_uint <64>* htb4_buf,
    ap_uint <64>* htb5_buf,
    ap_uint <64>* htb6_buf,
    ap_uint <64>* htb7_buf,
    ap_uint <64>* stb0_buf,
    ap_uint <64>* stb1_buf,
    ap_uint <64>* stb2_buf,
    ap_uint <64>* stb3_buf,
    ap_uint <64>* stb4_buf,
    ap_uint <64>* stb5_buf,
    ap_uint <64>* stb6_buf,
    ap_uint <64>* stb7_buf,
    hls::stream <ap_uint <32>>& pu_begin_status_strms,
    hls::stream <ap_uint <32>>& pu_end_status_strms,
    hls::stream <ap_uint <KEYW+S_PW+B_PW>>& j_strm,
    hls::stream <bool>& j_e_strm
    )

Hash-Build-Probe v4 primitive. Compared with HashBuildProbeV3 , it enables bloom filter to reduce redundant access to HBM which can further reduce run-time of hash join. Build and probe are separately performed and controlled by a boolean flag. Mutiple build and probe are also provided, and it should make sure all rows in build phase can be stored temporarily in HBM to maintain correctness.

The maximum size of small table is 256MBx8=2GB in this design. The total hash entries is equal to 1<<(HASHWH + HASHWL), and it is limitied to maximun of 1M entries because of the size of URAM in a single SLR.

Parameters:

KEYW width of key, in bit.
PW width of max payload, in bit.
S_PW width of payload of small table.
B_PW width of payload of big table.
HASHWH number of hash bits used for PU/buffer selection, 1~3.
HASHWL number of hash bits used for hash-table in PU.
HASHO number of hash bits used for overflow hash counter, 8-12.
ARW width of address, log2(small table max num of rows).
CH_NM number of input channels, 1,2,4.
BF_HASH_NM number of hash functions in bloom filter, 1,2,3.
BFW bloom-filter hash width.
EN_BF bloom-filter switch, 0 for off, 1 for on.
build_probe_flag 0:build 1:probe
k0_strm_arry input of key columns of both tables.
p0_strm_arry input of payload columns of both tables.
e0_strm_arry input of end signal of both tables.
htb0_buf HBM/DDR buffer of hash_table0
htb1_buf HBM/DDR buffer of hash_table1
htb2_buf HBM/DDR buffer of hash_table2
htb3_buf HBM/DDR buffer of hash_table3
htb4_buf HBM/DDR buffer of hash_table4
htb5_buf HBM/DDR buffer of hash_table5
htb6_buf HBM/DDR buffer of hash_table6
htb7_buf HBM/DDR buffer of hash_table7
stb0_buf HBM/DDR buffer of PU0
stb1_buf HBM/DDR buffer of PU1
stb2_buf HBM/DDR buffer of PU2
stb3_buf HBM/DDR buffer of PU3
stb4_buf HBM/DDR buffer of PU4
stb5_buf HBM/DDR buffer of PU5
stb6_buf HBM/DDR buffer of PU6
stb7_buf HBM/DDR buffer of PU7
pu_begin_status_strms contains build ID, probe ID, fixed hash depth, joined number of last probe and start addr of unused stb_buf for each PU
pu_end_status_strms returns next build ID, next probe ID, fixed hash depth, joined number of current probe and end addr of stb_buf for each PU
j_strm output of joined rows.
j_e_strm is the end flag of joined result.