-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Add column-valued PRECEDING/FOLLOWING bounds to range rolling windows #22922
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
Open
pramodsatya
wants to merge
6
commits into
NVIDIA:main
Choose a base branch
from
pramodsatya:range-column-bounds
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
3d16ff7
Add column-valued PRECEDING/FOLLOWING bounds to range rolling windows
pramodsatya adefd33
Replace PerRow tag with scalar_delta/column_delta accessors
pramodsatya 3fd185f
Normalize range-window delta to a single typed source before dispatch
pramodsatya 99ecd43
Keep public delta() accessors unchanged and normalize delta internally
pramodsatya b5494e4
Document that column-valued RANGE bounds do not support fixed-point o…
pramodsatya 629eb9d
Merge branch 'main' into range-column-bounds
mythrocks File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
76 changes: 76 additions & 0 deletions
76
cpp/benchmarks/rolling/range_rolling_column_bounds_sum.cpp
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,76 @@ | ||
| /* | ||
| * SPDX-FileCopyrightText: Copyright (c) 2026, NVIDIA CORPORATION & AFFILIATES. All rights reserved. | ||
| * SPDX-License-Identifier: Apache-2.0 | ||
| */ | ||
|
|
||
| #include <benchmarks/common/generate_input.hpp> | ||
| #include <benchmarks/common/memory_stats.hpp> | ||
|
|
||
| #include <cudf/aggregation.hpp> | ||
| #include <cudf/column/column_factories.hpp> | ||
| #include <cudf/filling.hpp> | ||
| #include <cudf/rolling.hpp> | ||
| #include <cudf/scalar/scalar.hpp> | ||
| #include <cudf/table/table_view.hpp> | ||
| #include <cudf/types.hpp> | ||
| #include <cudf/utilities/default_stream.hpp> | ||
|
|
||
| #include <nvbench/nvbench.cuh> | ||
|
|
||
| #include <cstdint> | ||
| #include <vector> | ||
|
|
||
| // Per-row (column-valued) RANGE bounds: `bounded_closed_column`. This mirrors the scalar | ||
| // `range_rolling_sum` benchmark so the two can be compared directly to quantify the overhead of | ||
| // reading a per-row delta instead of broadcasting a single scalar. Constant delta columns keep the | ||
| // window sizes (and therefore the aggregation work) identical to the scalar case, isolating the | ||
| // cost of the per-row read. | ||
| void bench_range_rolling_column_bounds_sum(nvbench::state& state) | ||
| { | ||
| auto const num_rows = static_cast<cudf::size_type>(state.get_int64("num_rows")); | ||
| auto const preceding_range = state.get_int64("preceding_range"); | ||
| auto const following_range = state.get_int64("following_range"); | ||
|
|
||
| auto vals = [&] { | ||
| data_profile const profile = data_profile_builder().cardinality(0).no_validity().distribution( | ||
| cudf::type_to_id<std::int32_t>(), distribution_id::UNIFORM, 0, 100); | ||
| return create_random_column(cudf::type_to_id<std::int32_t>(), row_count{num_rows}, profile); | ||
| }(); | ||
|
|
||
| // Equally-spaced ascending integer orderby (1 unit apart), so `preceding_range`/`following_range` | ||
| // approximately control the number of rows in each window. | ||
| auto const orderby = cudf::sequence( | ||
| num_rows, cudf::numeric_scalar<std::int64_t>(0), cudf::numeric_scalar<std::int64_t>(1)); | ||
|
|
||
| // Per-row delta columns (matching the orderby type), each filled with a single constant. | ||
| auto const preceding_col = | ||
| cudf::make_column_from_scalar(cudf::numeric_scalar<std::int64_t>(preceding_range), num_rows); | ||
| auto const following_col = | ||
| cudf::make_column_from_scalar(cudf::numeric_scalar<std::int64_t>(following_range), num_rows); | ||
|
|
||
| std::vector<cudf::rolling_request> requests; | ||
| requests.push_back({vals->view(), 1, cudf::make_sum_aggregation<cudf::rolling_aggregation>()}); | ||
|
|
||
| auto const mem_stats_logger = cudf::memory_stats_logger(); | ||
| state.set_cuda_stream(nvbench::make_cuda_stream_view(cudf::get_default_stream().value())); | ||
| state.exec(nvbench::exec_tag::sync, [&](nvbench::launch& launch) { | ||
| auto const result = | ||
| cudf::grouped_range_rolling_window(cudf::table_view{}, | ||
| orderby->view(), | ||
| cudf::order::ASCENDING, | ||
| cudf::null_order::BEFORE, | ||
| cudf::bounded_closed_column{preceding_col->view()}, | ||
| cudf::bounded_closed_column{following_col->view()}, | ||
| requests); | ||
| }); | ||
| auto const elapsed_time = state.get_summary("nv/cold/time/gpu/mean").get_float64("value"); | ||
| state.add_element_count(static_cast<double>(num_rows) / elapsed_time / 1'000'000., "Mrows/s"); | ||
| state.add_buffer_size( | ||
| mem_stats_logger.peak_memory_usage(), "peak_memory_usage", "peak_memory_usage"); | ||
| } | ||
|
|
||
| NVBENCH_BENCH(bench_range_rolling_column_bounds_sum) | ||
| .set_name("range_rolling_column_bounds_sum") | ||
| .add_int64_power_of_two_axis("num_rows", {14, 22, 28}) | ||
| .add_int64_axis("preceding_range", {100}) | ||
| .add_int64_axis("following_range", {100}); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.