Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support min and max operations for structs in rolling window #10332

Merged
merged 29 commits into from
Mar 7, 2022
Merged
Show file tree
Hide file tree
Changes from 22 commits
Commits
Show all changes
29 commits
Select commit Hold shift + click to select a range
4a6df3c
WIP
ttnghia Feb 16, 2022
470ff8d
WIP
ttnghia Feb 18, 2022
a21fc94
Draft implementation is complete
ttnghia Feb 18, 2022
f7647dc
Remove redundant kernel added
ttnghia Feb 24, 2022
5f74ff3
Further unify functions
ttnghia Feb 24, 2022
b62dff6
Rename typename and variable
ttnghia Feb 24, 2022
9ca04b4
Fix link
ttnghia Feb 24, 2022
07068d0
Rewrite `DeviceRollingArgMinMax`
ttnghia Feb 25, 2022
040d9b6
Rewrite specialization
ttnghia Feb 25, 2022
571ac44
Re-order code
ttnghia Feb 25, 2022
11ac1f9
Combine partial specializations
ttnghia Feb 25, 2022
32c409f
Simplify code
ttnghia Feb 25, 2022
4758ea5
Remove redundant template parameters
ttnghia Feb 25, 2022
a5cf49b
Rename variable
ttnghia Feb 25, 2022
4f2205c
Complete unit tests
ttnghia Feb 25, 2022
251626a
Fix copyright year
ttnghia Feb 25, 2022
05f791f
Remove comments
ttnghia Feb 25, 2022
b5f2bc4
Merge branch 'branch-22.04' into structs_window_ops
ttnghia Feb 25, 2022
9504181
Fix enum reference
ttnghia Feb 25, 2022
2d0d0d6
Separate implementation for string and struct
ttnghia Feb 28, 2022
242c493
Merge branch 'branch-22.04' into structs_window_ops
ttnghia Feb 28, 2022
d7eeb49
Rewrite if-else into ternary expression
ttnghia Feb 28, 2022
b201df2
Use sentinel instead of literal value
ttnghia Feb 28, 2022
d21d7e0
Fix comments
ttnghia Feb 28, 2022
08d694a
Avoid using static variable in tests
ttnghia Feb 28, 2022
d0458e5
Merge branch 'branch-22.04' into structs_window_ops
ttnghia Mar 7, 2022
290126a
Remove redundant headers
ttnghia Mar 7, 2022
440c819
Fix stale comments
ttnghia Mar 7, 2022
1d6f1d7
Address review comments
ttnghia Mar 7, 2022
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions cpp/src/reductions/struct_minmax_util.cuh
Original file line number Diff line number Diff line change
Expand Up @@ -35,15 +35,15 @@ namespace detail {
struct row_arg_minmax_fn {
size_type const num_rows;
row_lexicographic_comparator<nullate::DYNAMIC> const comp;
bool const arg_min;
bool const is_arg_min;

row_arg_minmax_fn(table_device_view const& table,
bool has_nulls,
null_order const* null_precedence,
bool const arg_min)
bool const is_arg_min)
: num_rows(table.num_rows()),
comp(nullate::DYNAMIC{has_nulls}, table, table, nullptr, null_precedence),
arg_min(arg_min)
is_arg_min(is_arg_min)
{
}

Expand All @@ -53,7 +53,7 @@ struct row_arg_minmax_fn {
// `thrust::reduce_by_key` or `thrust::scan_by_key` will result in significant compile time.
__attribute__((noinline)) __device__ auto operator()(size_type lhs_idx, size_type rhs_idx) const
{
// The extra bounds checking is due to issue github.com/rapidsai/cudf/9156 and
// The extra bounds checking is due to issue github.com/rapidsai/cudf/issues/9156 and
// github.com/NVIDIA/thrust/issues/1525
// where invalid random values may be passed here by thrust::reduce_by_key
if (lhs_idx < 0 || lhs_idx >= num_rows) { return rhs_idx; }
Expand All @@ -62,7 +62,7 @@ struct row_arg_minmax_fn {
// Return `lhs_idx` iff:
// row(lhs_idx) < row(rhs_idx) and finding ArgMin, or
// row(lhs_idx) >= row(rhs_idx) and finding ArgMax.
return comp(lhs_idx, rhs_idx) == arg_min ? lhs_idx : rhs_idx;
return comp(lhs_idx, rhs_idx) == is_arg_min ? lhs_idx : rhs_idx;
}
};

Expand Down
Loading