
From: Wenkai Lin <linwenkai6@hisilicon.com> Several modifications have been added to the batch address index scheme. The new scheme requires the input of batch_row_size along with the batch addr, it is used to calculate the address of a batch line during the build hash phase. Previously, hash_slot_row_size was used to get the size of a batch line during the gather phase, but now batch_row_size is used instead. The index_batch_type is expanded by 2 bits to support three types of index. In scenarios with more than 2800 batches cannot use the batch number index by hardware tasks but it can still be utilized by software calculations. Therefore, the hashjoin check on the number of batches is removed. Signed-off-by: Wenkai Lin <linwenkai6@hisilicon.com> --- drv/hisi_dae.h | 11 +++++------ drv/hisi_dae_join_gather.c | 35 ++++++++++++++++++++++++----------- 2 files changed, 29 insertions(+), 17 deletions(-) diff --git a/drv/hisi_dae.h b/drv/hisi_dae.h index 1264813..050b872 100644 --- a/drv/hisi_dae.h +++ b/drv/hisi_dae.h @@ -108,7 +108,7 @@ struct dae_sqe { __u32 resv3 : 9; __u32 bd_invlid : 1; __u16 table_row_size; - __u16 resv4; + __u16 batch_row_size; __u32 batch_num; __u32 low_tag; __u32 hi_tag; @@ -122,12 +122,11 @@ struct dae_sqe { __u32 sva_prefetch_en : 1; __u32 counta_vld : 1; __u32 index_num : 5; - __u32 resv5 : 8; - __u32 index_batch_type : 1; - __u32 resv6 : 1; + __u32 resv4 : 8; + __u32 index_batch_type : 2; __u8 key_data_type[16]; __u8 agg_data_type[16]; - __u32 resv9[6]; + __u32 resv5[6]; __u64 addr_ext; __u16 key_col_bitmap; __u16 has_empty; @@ -141,7 +140,7 @@ struct dae_sqe { __u32 out_raw_num; __u32 data_row_offset; __u16 sum_overflow_cols; - __u16 resv10; + __u16 resv6; }; struct dae_ext_sqe { diff --git a/drv/hisi_dae_join_gather.c b/drv/hisi_dae_join_gather.c index db965d3..dcbeed4 100644 --- a/drv/hisi_dae_join_gather.c +++ b/drv/hisi_dae_join_gather.c @@ -43,6 +43,17 @@ enum dae_gather_stage { DAE_GATHER_COMPLETE = 0x7, }; +enum dae_join_index_type { + DAE_JOIN_BATCH_ADDR_INDEX = 0x1, + DAE_JOIN_BATCH_NUM_INDEX = 0x2, + DAE_JOIN_BATCH_ALL_INDEX = 0x3, +}; + +enum dae_gather_index_type { + DAE_GATHER_BATCH_NUM_INDEX = 0x0, + DAE_GATHER_BATCH_ADDR_INDEX = 0x1, +}; + enum dae_task_type { DAE_HASH_JOIN = 0x1, DAE_GATHER = 0x2, @@ -106,7 +117,10 @@ static void fill_join_gather_misc_field(struct wd_join_gather_msg *msg, sqe->index_num = cols_data->index_num; sqe->key_out_en = msg->key_out_en; sqe->break_point_en = sqe->init_row_num ? true : false; - sqe->index_batch_type = msg->index_type; + if (msg->index_type == WD_BATCH_ADDR_INDEX) + sqe->index_batch_type = DAE_JOIN_BATCH_ALL_INDEX; + else + sqe->index_batch_type = DAE_JOIN_BATCH_NUM_INDEX; break; case WD_JOIN_REHASH: sqe->task_type = DAE_HASH_JOIN; @@ -123,8 +137,11 @@ static void fill_join_gather_misc_field(struct wd_join_gather_msg *msg, sqe->task_type = DAE_GATHER; sqe->task_type_ext = DAE_GATHER_COMPLETE; sqe->multi_batch_en = msg->multi_batch_en; - sqe->index_batch_type = msg->index_type; sqe->data_row_num = msg->req.output_row_num; + if (msg->index_type == WD_BATCH_ADDR_INDEX) + sqe->index_batch_type = DAE_GATHER_BATCH_ADDR_INDEX; + else + sqe->index_batch_type = DAE_GATHER_BATCH_NUM_INDEX; break; default: break; @@ -199,8 +216,10 @@ static void fill_join_key_data(struct dae_sqe *sqe, struct dae_ext_sqe *ext_sqe, case WD_JOIN_BUILD_HASH: usr_key = req->key_cols; hw_key = addr_list->input_addr; - if (msg->index_type == WD_BATCH_ADDR_INDEX) + if (msg->index_type == WD_BATCH_ADDR_INDEX) { sqe->addr_ext = (__u64)(uintptr_t)req->build_batch_addr.addr; + sqe->batch_row_size = req->build_batch_addr.row_size; + } break; case WD_JOIN_PROBE: usr_key = req->key_cols; @@ -262,7 +281,7 @@ static void fill_gather_col_data(struct dae_sqe *sqe, struct dae_ext_sqe *ext_sq sqe->key_col_bitmap = GENMASK(cols_num - 1, 0); sqe->has_empty = cols_data->has_empty[table_index]; - sqe->table_row_size = ctx->batch_row_size[table_index]; + sqe->batch_row_size = ctx->batch_row_size[table_index]; usr_data = gather_req->data_cols; batch_addr = gather_req->row_batchs.batch_addr; @@ -362,13 +381,7 @@ static int check_join_gather_param(struct wd_join_gather_msg *msg) msg->req.input_row_num, DAE_JOIN_MAX_ROW_NUN); return -WD_EINVAL; } - if (msg->index_type == WD_BATCH_NUMBER_INDEX) { - if (msg->req.join_req.build_batch_index >= DAE_JOIN_MAX_BATCH_NUM) { - WD_ERR("invalid: input join batch index is more than %d!\n", - DAE_JOIN_MAX_BATCH_NUM - 1); - return -WD_EINVAL; - } - } else { + if (msg->index_type == WD_BATCH_ADDR_INDEX) { if (!msg->req.join_req.build_batch_addr.addr || !msg->req.join_req.build_batch_addr.row_num || !msg->req.join_req.build_batch_addr.row_size) { -- 2.33.0