Skip to content

Commit 8cfddfa

Browse files
committed
Merge remote-tracking branch 'origin' into type_date
2 parents c7853d6 + 1a701f7 commit 8cfddfa

23 files changed

Lines changed: 348 additions & 603 deletions

CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,7 @@ set(EXTENSION_SOURCES
5959
src/gpu_buffer_manager.cpp
6060
src/gpu_columns.cpp
6161
src/gpu_expression_executor.cpp
62+
src/gpu_query_result.cpp
6263
)
6364
add_subdirectory(src/operator)
6465
add_subdirectory(src/plan)

docs/README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -43,12 +43,12 @@ conda install -c rapidsai -c conda-forge -c nvidia rapidsai::libcudf
4343
Set the environment variables `USE_CUDF` to 1 and `LIBCUDF_ENV_PREFIX` to the conda environment's path. For example, if we installed miniconda in `~/miniconda3` and installed libcudf in the conda environment `libcudf-env`, then we would set the `LIBCUDF_ENV_PREFIX` to `~/miniconda3/envs/libcudf-env`.
4444
```
4545
export USE_CUDF=1
46-
export LIBCUDF_ENV_PREFIX = {PATH to libcudf-env}
46+
export LIBCUDF_ENV_PREFIX={PATH to libcudf-env}
4747
```
4848

4949
### Clone the Sirius repository
5050
```
51-
git clone --recurse-submodules https://github.com/bwyogatama/sirius.git
51+
git clone --recurse-submodules https://github.com/sirius-db/sirius.git
5252
cd sirius
5353
export SIRIUS_HOME_PATH=`pwd`
5454
cd duckdb
@@ -146,4 +146,4 @@ Sirius is still under major development and we are working on adding more featur
146146

147147
Sirius always welcomes new contributors! If you are interested, check our [website](https://www.sirius-db.com/), reach out to our [email](siriusdb@cs.wisc.edu), or join our [slack channel](https://join.slack.com/t/sirius-db/shared_invite/zt-33tuwt1sk-aa2dk0EU_dNjklSjIGW3vg).
148148

149-
**Let's kickstart the GPU eras for Data Analytics!**
149+
**Let's kickstart the GPU eras for Data Analytics!**

queries/devesh_test_queries/q10_group_by_test.sql

Lines changed: 0 additions & 31 deletions
This file was deleted.

queries/devesh_test_queries/string_group_and_order_by.txt

Lines changed: 0 additions & 11 deletions
This file was deleted.

src/cuda/cudf/cudf_aggregate.cu

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ void cudf_aggregate(vector<shared_ptr<GPUColumn>>& column, uint64_t num_aggregat
4747

4848
uint64_t size = 0;
4949
for (int agg = 0; agg < num_aggregates; agg++) {
50-
if (column[agg]->data_wrapper.data != nullptr) {
50+
if (column[agg]->data_wrapper.data != nullptr || (column[agg]->data_wrapper.data == nullptr && agg_mode[agg] == AggregationType::COUNT_STAR && column[agg]->column_length > 0)) {
5151
size = column[agg]->column_length;
5252
break;
5353
}

src/cuda/cudf/cudf_groupby.cu

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -60,29 +60,22 @@ void cudf_groupby(vector<shared_ptr<GPUColumn>>& keys, vector<shared_ptr<GPUColu
6060
for (int agg = 0; agg < num_aggregates; agg++) {
6161
requests.emplace_back(cudf::groupby::aggregation_request());
6262
if (aggregate_keys[agg]->data_wrapper.data == nullptr && agg_mode[agg] == AggregationType::COUNT && aggregate_keys[agg]->column_length == 0) {
63-
SIRIUS_LOG_DEBUG("Count aggregation");
6463
auto aggregate = cudf::make_sum_aggregation<cudf::groupby_aggregation>();
6564
requests[agg].aggregations.push_back(std::move(aggregate));
66-
// auto const_scalar = cudf::make_fixed_width_scalar<uint64_t>(static_cast<uint64_t>(0));
67-
// requests[agg].values = cudf::make_column_from_scalar(*const_scalar, size)->view();
6865
uint64_t* temp = gpuBufferManager->customCudaMalloc<uint64_t>(size, 0, 0);
6966
cudaMemset(temp, 0, size * sizeof(uint64_t));
7067
shared_ptr<GPUColumn> temp_column = make_shared_ptr<GPUColumn>(size, ColumnType::INT64, reinterpret_cast<uint8_t*>(temp));
7168
requests[agg].values = temp_column->convertToCudfColumn();
7269
} else if (aggregate_keys[agg]->data_wrapper.data == nullptr && agg_mode[agg] == AggregationType::SUM && aggregate_keys[agg]->column_length == 0) {
7370
auto aggregate = cudf::make_sum_aggregation<cudf::groupby_aggregation>();
7471
requests[agg].aggregations.push_back(std::move(aggregate));
75-
// auto const_scalar = cudf::make_fixed_width_scalar<uint64_t>(static_cast<uint64_t>(0));
76-
// requests[agg].values = cudf::make_column_from_scalar(*const_scalar, size)->view();
7772
uint64_t* temp = gpuBufferManager->customCudaMalloc<uint64_t>(size, 0, 0);
7873
cudaMemset(temp, 0, size * sizeof(uint64_t));
7974
shared_ptr<GPUColumn> temp_column = make_shared_ptr<GPUColumn>(size, ColumnType::INT64, reinterpret_cast<uint8_t*>(temp));
8075
requests[agg].values = temp_column->convertToCudfColumn();
8176
} else if (aggregate_keys[agg]->data_wrapper.data == nullptr && agg_mode[agg] == AggregationType::COUNT_STAR && aggregate_keys[agg]->column_length != 0) {
8277
auto aggregate = cudf::make_count_aggregation<cudf::groupby_aggregation>(cudf::null_policy::EXCLUDE);
8378
requests[agg].aggregations.push_back(std::move(aggregate));
84-
// auto const_scalar = cudf::make_fixed_width_scalar<uint64_t>(static_cast<uint64_t>(1));
85-
// requests[agg].values = cudf::make_column_from_scalar(*const_scalar, size)->view();
8679
uint64_t* temp = gpuBufferManager->customCudaMalloc<uint64_t>(size, 0, 0);
8780
cudaMemset(temp, 0, size * sizeof(uint64_t));
8881
shared_ptr<GPUColumn> temp_column = make_shared_ptr<GPUColumn>(size, ColumnType::INT64, reinterpret_cast<uint8_t*>(temp));

src/cuda/operator/hash_join_inner.cu

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -199,8 +199,8 @@ __global__ void probe_multikey<BLOCK_THREADS, ITEMS_PER_THREAD>(uint64_t **keys,
199199

200200
void buildHashTable(uint8_t **keys, unsigned long long* ht, uint64_t ht_len, uint64_t N, int* condition_mode, int num_keys, bool is_right) {
201201
CHECK_ERROR();
202-
if (N == 0) {
203-
SIRIUS_LOG_DEBUG("Input size is 0");
202+
if (N == 0 || ht_len == 0) {
203+
SIRIUS_LOG_DEBUG("Input size is 0 or hash table is empty");
204204
return;
205205
}
206206
SIRIUS_LOG_DEBUG("Launching Build Kernel");
@@ -239,11 +239,11 @@ void buildHashTable(uint8_t **keys, unsigned long long* ht, uint64_t ht_len, uin
239239
void probeHashTable(uint8_t **keys, unsigned long long* ht, uint64_t ht_len, uint64_t* &row_ids_left, uint64_t* &row_ids_right, uint64_t* &count, uint64_t N, int* condition_mode, int num_keys, bool is_right) {
240240
CHECK_ERROR();
241241
GPUBufferManager* gpuBufferManager = &(GPUBufferManager::GetInstance());
242-
if (N == 0) {
242+
if (N == 0 || ht_len == 0) {
243243
uint64_t* h_count = gpuBufferManager->customCudaHostAlloc<uint64_t>(1);
244244
h_count[0] = 0;
245245
count = h_count;
246-
SIRIUS_LOG_DEBUG("Input size is 0");
246+
SIRIUS_LOG_DEBUG("Input size is 0 or hash table is empty");
247247
return;
248248
}
249249
SIRIUS_LOG_DEBUG("Launching Probe Kernel");

src/cuda/operator/hash_join_right.cu

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -181,8 +181,8 @@ void scanHashTableRight(unsigned long long* ht, uint64_t ht_len, uint64_t* &row_
181181

182182
void probeHashTableRightSemiAnti(uint8_t **keys, unsigned long long* ht, uint64_t ht_len, uint64_t N, int* condition_mode, int num_keys) {
183183
CHECK_ERROR();
184-
if (N == 0) {
185-
SIRIUS_LOG_DEBUG("Input size is 0");
184+
if (N == 0 || ht_len == 0) {
185+
SIRIUS_LOG_DEBUG("Input size is 0 or hash table is empty");
186186
return;
187187
}
188188
SIRIUS_LOG_DEBUG("Launching Probe Kernel");

src/cuda/operator/hash_join_single.cu

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -224,11 +224,11 @@ void probeHashTableSingleMatch(uint8_t **keys, unsigned long long* ht, uint64_t
224224
uint64_t* &count, uint64_t N, int* condition_mode, int num_keys, int join_mode) {
225225
CHECK_ERROR();
226226
GPUBufferManager* gpuBufferManager = &(GPUBufferManager::GetInstance());
227-
if (N == 0) {
227+
if (N == 0 || ht_len == 0) {
228228
uint64_t* h_count = gpuBufferManager->customCudaHostAlloc<uint64_t>(1);
229229
h_count[0] = 0;
230230
count = h_count;
231-
SIRIUS_LOG_DEBUG("Input size is 0");
231+
SIRIUS_LOG_DEBUG("Input size is 0 or hash table is empty");
232232
return;
233233
}
234234
SIRIUS_LOG_DEBUG("Launching Probe Kernel Unique Join");
@@ -292,8 +292,8 @@ void probeHashTableSingleMatch(uint8_t **keys, unsigned long long* ht, uint64_t
292292

293293
void probeHashTableRightSemiAntiSingleMatch(uint8_t **keys, unsigned long long* ht, uint64_t ht_len, uint64_t N, int* condition_mode, int num_keys) {
294294
CHECK_ERROR();
295-
if (N == 0) {
296-
SIRIUS_LOG_DEBUG("Input size is 0");
295+
if (N == 0 || ht_len == 0) {
296+
SIRIUS_LOG_DEBUG("Input size is 0 or hash table is empty");
297297
return;
298298
}
299299
SIRIUS_LOG_DEBUG("Launching Probe Kernel Unique Join");
@@ -332,14 +332,16 @@ void probeHashTableRightSemiAntiSingleMatch(uint8_t **keys, unsigned long long*
332332

333333
void probeHashTableMark(uint8_t **keys, unsigned long long* ht, uint64_t ht_len, uint8_t* &output, uint64_t N, int* condition_mode, int num_keys) {
334334
CHECK_ERROR();
335-
if (N == 0) {
336-
SIRIUS_LOG_DEBUG("Input size is 0");
335+
GPUBufferManager* gpuBufferManager = &(GPUBufferManager::GetInstance());
336+
if (N == 0 || ht_len == 0) {
337+
output = gpuBufferManager->customCudaMalloc<uint8_t>(N, 0, 0);
338+
cudaMemset(output, 0, N * sizeof(uint8_t));
339+
SIRIUS_LOG_DEBUG("Input size is 0 or hash table is empty");
337340
return;
338341
}
339342
SIRIUS_LOG_DEBUG("Launching Probe Kernel Mark");
340343
SETUP_TIMING();
341344
START_TIMER();
342-
GPUBufferManager* gpuBufferManager = &(GPUBufferManager::GetInstance());
343345

344346
//reinterpret cast the keys to uint64_t
345347
uint64_t** keys_data = gpuBufferManager->customCudaHostAlloc<uint64_t*>(num_keys);

src/cuda/operator/materialize.cu

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -153,7 +153,7 @@ __global__ void create_cpu_strings(duckdb_string_type* gpu_strings, char* cpu_ch
153153
}
154154
}
155155

156-
void materializeStringColumnToDuckdbFormat(GPUColumn* column, char* column_char_write_buffer, string_t* column_string_write_buffer) {
156+
void materializeStringColumnToDuckdbFormat(shared_ptr<GPUColumn> column, char* column_char_write_buffer, string_t* column_string_write_buffer) {
157157
// First copy the characters from the GPU to the CPU
158158
SIRIUS_LOG_DEBUG("Materialize String Column to Duckdb format");
159159
SETUP_TIMING();

0 commit comments

Comments
 (0)