Skip to content

Commit

Permalink
Allow runtime has_nulls parameter for row operators (#9623)
Browse files Browse the repository at this point in the history
Closes #6952 

This PR allows the `has_nulls` template parameter for row operators to be used a runtime parameter in places where the null-handling logic has little to no affect on runtime performance. 
This can improve compile time as described in #6952.

This will also close #9152 and #9580

Authors:
  - David Wendt (https://github.com/davidwendt)

Approvers:
  - Jake Hemstad (https://github.com/jrhemstad)
  - Nghia Truong (https://github.com/ttnghia)
  - Conor Hoekstra (https://github.com/codereport)

URL: #9623
  • Loading branch information
davidwendt authored Dec 6, 2021
1 parent fdd9bb0 commit 8002cbd
Show file tree
Hide file tree
Showing 39 changed files with 542 additions and 931 deletions.
7 changes: 4 additions & 3 deletions cpp/benchmarks/groupby/group_sum_benchmark.cu
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,6 @@ void BM_basic_sum(benchmark::State& state)
{
using wrapper = cudf::test::fixed_width_column_wrapper<int64_t>;

// const cudf::size_type num_columns{(cudf::size_type)state.range(0)};
const cudf::size_type column_size{(cudf::size_type)state.range(0)};

auto data_it = cudf::detail::make_counting_transform_iterator(
Expand All @@ -53,7 +52,7 @@ void BM_basic_sum(benchmark::State& state)
wrapper keys(data_it, data_it + column_size);
wrapper vals(data_it, data_it + column_size);

cudf::groupby::groupby gb_obj(cudf::table_view({keys}));
cudf::groupby::groupby gb_obj(cudf::table_view({keys, keys, keys}));

std::vector<cudf::groupby::aggregation_request> requests;
requests.emplace_back(cudf::groupby::aggregation_request());
Expand All @@ -73,7 +72,9 @@ BENCHMARK_REGISTER_F(Groupby, Basic)
->UseManualTime()
->Unit(benchmark::kMillisecond)
->Arg(10000)
->Arg(10000000);
->Arg(1000000)
->Arg(10000000)
->Arg(100000000);

void BM_pre_sorted_sum(benchmark::State& state)
{
Expand Down
37 changes: 25 additions & 12 deletions cpp/benchmarks/hashing/hash_benchmark.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -25,27 +25,40 @@
class HashBenchmark : public cudf::benchmark {
};

static void BM_hash(benchmark::State& state, cudf::hash_id hid)
enum contains_nulls { no_nulls, nulls };

static void BM_hash(benchmark::State& state, cudf::hash_id hid, contains_nulls has_nulls)
{
cudf::size_type const n_rows{(cudf::size_type)state.range(0)};
auto const data = create_random_table({cudf::type_id::INT64}, 1, row_count{n_rows});
if (has_nulls == contains_nulls::no_nulls)
data->get_column(0).set_null_mask(rmm::device_buffer{}, 0);

for (auto _ : state) {
cuda_event_timer raii(state, true, rmm::cuda_stream_default);
cudf::hash(data->view(), hid);
}
}

#define HASH_BENCHMARK_DEFINE(name) \
BENCHMARK_DEFINE_F(HashBenchmark, name) \
(::benchmark::State & st) { BM_hash(st, cudf::hash_id::name); } \
BENCHMARK_REGISTER_F(HashBenchmark, name) \
->RangeMultiplier(4) \
->Ranges({{1 << 14, 1 << 24}}) \
->UseManualTime() \
#define concat(a, b, c) a##b##c

#define H_BENCHMARK_DEFINE(name, hid, n) \
BENCHMARK_DEFINE_F(HashBenchmark, name) \
(::benchmark::State & st) { BM_hash(st, cudf::hash_id::hid, contains_nulls::n); } \
BENCHMARK_REGISTER_F(HashBenchmark, name) \
->RangeMultiplier(4) \
->Ranges({{1 << 14, 1 << 24}}) \
->UseManualTime() \
->Unit(benchmark::kMillisecond);

HASH_BENCHMARK_DEFINE(HASH_MURMUR3)
HASH_BENCHMARK_DEFINE(HASH_MD5)
HASH_BENCHMARK_DEFINE(HASH_SERIAL_MURMUR3)
HASH_BENCHMARK_DEFINE(HASH_SPARK_MURMUR3)
#define HASH_BENCHMARK_DEFINE(hid, n) H_BENCHMARK_DEFINE(concat(hid, _, n), hid, n)

HASH_BENCHMARK_DEFINE(HASH_MURMUR3, nulls)
HASH_BENCHMARK_DEFINE(HASH_MD5, nulls)
HASH_BENCHMARK_DEFINE(HASH_SERIAL_MURMUR3, nulls)
HASH_BENCHMARK_DEFINE(HASH_SPARK_MURMUR3, nulls)

HASH_BENCHMARK_DEFINE(HASH_MURMUR3, no_nulls)
HASH_BENCHMARK_DEFINE(HASH_MD5, no_nulls)
HASH_BENCHMARK_DEFINE(HASH_SERIAL_MURMUR3, no_nulls)
HASH_BENCHMARK_DEFINE(HASH_SPARK_MURMUR3, no_nulls)
Loading

0 comments on commit 8002cbd

Please sign in to comment.