Skip to content

Commit

Permalink
WARPCORE_BLOCKSIZE in bucket list hash table. Prevent out-of-bounds a…
Browse files Browse the repository at this point in the history
…ccess in host-side insert function of BucketListHashTable
  • Loading branch information
fkallen committed Nov 23, 2020
1 parent 650a54a commit 32f7dd4
Showing 1 changed file with 22 additions and 16 deletions.
38 changes: 22 additions & 16 deletions include/bucket_list_hash_table.cuh
Original file line number Diff line number Diff line change
Expand Up @@ -300,26 +300,32 @@ public:
}
else
{
append_status = value_store_.append(
*(handles[btid]),
values_in[block_offset + btid],
max_values_per_key_);
if(block_offset + btid < num_in){
append_status = value_store_.append(
*(handles[btid]),
values_in[block_offset + btid],
max_values_per_key_);
}
}
if(append_status.has_any())
{
device_join_status(append_status);
}
// TODO not zero-cost
if(!std::is_same<
StatusHandler,
status_handlers::ReturnNothing>::value)
{
StatusHandler::handle(
status[btid]+append_status,
status_out,
block_offset + btid);
if(block_offset + btid < num_in){
// TODO not zero-cost
if(!std::is_same<
StatusHandler,
status_handlers::ReturnNothing>::value)
{
StatusHandler::handle(
status[btid]+append_status,
status_out,
block_offset + btid);
}
}
}
}
Expand Down Expand Up @@ -449,7 +455,7 @@ public:
}
kernels::retrieve<BucketListHashTable, StatusHandler>
<<<SDIV(num_in * cg_size(), MAXBLOCKSIZE), MAXBLOCKSIZE, 0, stream>>>
<<<SDIV(num_in * cg_size(), WARPCORE_BLOCKSIZE), WARPCORE_BLOCKSIZE, 0, stream>>>
(
keys_in,
num_in,
Expand All @@ -465,7 +471,7 @@ public:
if(status_out != nullptr)
{
helpers::lambda_kernel
<<<SDIV(num_in, MAXBLOCKSIZE), MAXBLOCKSIZE, 0, stream>>>
<<<SDIV(num_in, WARPCORE_BLOCKSIZE), WARPCORE_BLOCKSIZE, 0, stream>>>
([=, *this] DEVICEQUALIFIER
{
const index_type tid = helpers::global_thread_id();
Expand Down Expand Up @@ -793,7 +799,7 @@ public:
cudaMemsetAsync(tmp, 0, sizeof(index_type), stream);
kernels::num_values<BucketListHashTable, StatusHandler>
<<<SDIV(num_in * cg_size(), MAXBLOCKSIZE), MAXBLOCKSIZE, 0, stream>>>
<<<SDIV(num_in * cg_size(), WARPCORE_BLOCKSIZE), WARPCORE_BLOCKSIZE, 0, stream>>>
(keys_in, num_in, tmp, num_per_key_out, *this, probing_length, status_out);
cudaMemcpyAsync(&num_out, tmp, sizeof(index_type), D2H, stream);
Expand Down

0 comments on commit 32f7dd4

Please sign in to comment.