-
Notifications
You must be signed in to change notification settings - Fork 981
Remove unnecessary synchronization (miss-sync) during Parquet reading (Part 4: vector_factories) #20120
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
base: main
Are you sure you want to change the base?
Remove unnecessary synchronization (miss-sync) during Parquet reading (Part 4: vector_factories) #20120
Changes from 17 commits
4c860ec
28bb730
2febabb
c7ad2e8
64f98b5
2a1e294
4ccf8d9
b2c4e0c
81acfd5
c2feb39
ac5a34e
045e9aa
852e64e
4c8591b
09ed07e
4b1b0b5
1bb499f
9c537b1
7d462c5
b739be1
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This links back to the draft PR for reference, but covering the full change in |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -21,6 +21,7 @@ | |
| #include <cudf/column/column_factories.hpp> | ||
| #include <cudf/detail/device_scalar.hpp> | ||
| #include <cudf/detail/utilities/cast_functor.cuh> | ||
| #include <cudf/detail/utilities/vector_factories.hpp> | ||
| #include <cudf/utilities/memory_resource.hpp> | ||
| #include <cudf/utilities/type_dispatcher.hpp> | ||
|
|
||
|
|
@@ -65,8 +66,10 @@ std::unique_ptr<scalar> reduce(InputIterator d_in, | |
| { | ||
| auto const binary_op = cudf::detail::cast_functor<OutputType>(op.get_binary_op()); | ||
| auto const initial_value = init.value_or(op.template get_identity<OutputType>()); | ||
| auto pinned_initial = cudf::detail::make_pinned_vector_async<OutputType>(1, stream); | ||
JigaoLuo marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| pinned_initial[0] = initial_value; | ||
| using ScalarType = cudf::scalar_type_t<OutputType>; | ||
| auto result = std::make_unique<ScalarType>(initial_value, true, stream, mr); | ||
| auto result = std::make_unique<ScalarType>(pinned_initial[0], true, stream, mr); | ||
|
||
|
|
||
| // Allocate temporary storage | ||
| rmm::device_buffer d_temp_storage; | ||
|
|
@@ -77,7 +80,7 @@ std::unique_ptr<scalar> reduce(InputIterator d_in, | |
| result->data(), | ||
| num_items, | ||
| binary_op, | ||
| initial_value, | ||
| pinned_initial[0], | ||
| stream.value()); | ||
| d_temp_storage = rmm::device_buffer{temp_storage_bytes, stream}; | ||
|
|
||
|
|
@@ -88,7 +91,7 @@ std::unique_ptr<scalar> reduce(InputIterator d_in, | |
| result->data(), | ||
| num_items, | ||
| binary_op, | ||
| initial_value, | ||
| pinned_initial[0], | ||
| stream.value()); | ||
| return result; | ||
| } | ||
|
|
@@ -123,7 +126,9 @@ std::unique_ptr<scalar> reduce(InputIterator d_in, | |
| { | ||
| auto const binary_op = cudf::detail::cast_functor<OutputType>(op.get_binary_op()); | ||
| auto const initial_value = init.value_or(op.template get_identity<OutputType>()); | ||
| auto dev_result = cudf::detail::device_scalar<OutputType>{initial_value, stream}; | ||
| auto pinned_initial = cudf::detail::make_pinned_vector_async<OutputType>(1, stream); | ||
| pinned_initial[0] = initial_value; | ||
|
||
| auto dev_result = cudf::detail::device_scalar<OutputType>{pinned_initial[0], stream}; | ||
|
|
||
| // Allocate temporary storage | ||
| rmm::device_buffer d_temp_storage; | ||
|
|
@@ -134,7 +139,7 @@ std::unique_ptr<scalar> reduce(InputIterator d_in, | |
| dev_result.data(), | ||
| num_items, | ||
| binary_op, | ||
| initial_value, | ||
| pinned_initial[0], | ||
| stream.value()); | ||
| d_temp_storage = rmm::device_buffer{temp_storage_bytes, stream}; | ||
|
|
||
|
|
@@ -145,7 +150,7 @@ std::unique_ptr<scalar> reduce(InputIterator d_in, | |
| dev_result.data(), | ||
| num_items, | ||
| binary_op, | ||
| initial_value, | ||
| pinned_initial[0], | ||
| stream.value()); | ||
|
|
||
| return std::make_unique<cudf::string_scalar>(dev_result, true, stream, mr); | ||
|
|
@@ -185,8 +190,9 @@ std::unique_ptr<scalar> reduce(InputIterator d_in, | |
| { | ||
| auto const binary_op = cudf::detail::cast_functor<IntermediateType>(op.get_binary_op()); | ||
| auto const initial_value = op.template get_identity<IntermediateType>(); | ||
|
|
||
| cudf::detail::device_scalar<IntermediateType> intermediate_result{initial_value, stream}; | ||
| auto pinned_initial = cudf::detail::make_pinned_vector_async<IntermediateType>(1, stream); | ||
| pinned_initial[0] = initial_value; | ||
| cudf::detail::device_scalar<IntermediateType> intermediate_result{pinned_initial[0], stream}; | ||
|
|
||
| // Allocate temporary storage | ||
| rmm::device_buffer d_temp_storage; | ||
|
|
@@ -197,7 +203,7 @@ std::unique_ptr<scalar> reduce(InputIterator d_in, | |
| intermediate_result.data(), | ||
| num_items, | ||
| binary_op, | ||
| initial_value, | ||
| pinned_initial[0], | ||
| stream.value()); | ||
| d_temp_storage = rmm::device_buffer{temp_storage_bytes, stream}; | ||
|
|
||
|
|
@@ -208,7 +214,7 @@ std::unique_ptr<scalar> reduce(InputIterator d_in, | |
| intermediate_result.data(), | ||
| num_items, | ||
| binary_op, | ||
| initial_value, | ||
| pinned_initial[0], | ||
| stream.value()); | ||
|
|
||
| // compute the result value from intermediate value in device | ||
|
|
||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Change the type of There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. So no need to change the |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This links back to the draft PR for reference:
https://github.com/rapidsai/cudf/pull/18968/files#diff-b281f280563cbbee7c16afb29ef989d808476a355c9c36a8f4e27fc5dc2ca4fd