-
Notifications
You must be signed in to change notification settings - Fork 915
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
Fix calls to deprecated strings factory API #14771
Fix calls to deprecated strings factory API #14771
Conversation
@davidwendt Is there any planned refactoring for |
Yes, that is correct. |
jb, num_rows, cudf::get_default_stream(), rmm::mr::get_current_device_resource()); | ||
return cudf::make_strings_column( | ||
num_rows, std::move(children.first), std::move(children.second), 0, {}); | ||
num_rows, std::move(offsets), std::move(chars->release().data.release()[0]), 0, {}); |
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.
The repeating pattern chars->release().data.release()[0]
throughout this PR is a bit awkward. This relates to my comment about refactoring make_strings_children
to return a buffer.
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.
Hopefully the awkwardness is only temporary once the new utility is created.
auto chars_column = strings::detail::create_chars_child_column(bytes, stream, mr); | ||
// merge the strings | ||
auto d_chars = chars_column->mutable_view().template data<char>(); | ||
rmm::device_uvector<char> chars(bytes, stream, mr); |
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.
Why do we prefer a device_uvector
instead of a raw buffer
here, given that we want to hold character buffers at the end? (This pattern reoccurs.)
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.
On further thought, maybe it's just nicer to have the typed container than a raw buffer. It plays well with our sync/async vector factories and the .release()
is fairly easy to deal with when you're ready for a buffer. I'm okay with keeping this, just interested in hearing your thoughts.
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.
Typing aids in handling the remaining code that would have needed casting. Additionally, the inline call to release()
doesn't necessitate a call to std::move
.
std::get<0>(cudf::test::to_host<cudf::size_type>(str_col.offsets()))); | ||
col_data.emplace_back(std::get<0>(cudf::test::to_host<int8_t>(str_col.chars()))); | ||
} | ||
|
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 code was not involved in verifying the results.
I removed it because it was calling the deprecated chars()
function.
These deprecated warnings didn't show up, while compiling with rapids-compose. @trxcllnt |
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.
rmm::device_uvector<char> chars(size_t, stream, mr)
pattern works well (although I would prefer rmm buffer and chars_data = static_cast<char*>(buffer.data())
, and a std::move). But this is fine.
could we update cudf::strings::detail::make_strings_children
to return pair of column and rmm::device_buffer ? (perhaps, should this be part of another PR?). This should help us avoid the std::move(chars_column->release().data.release()[0])
.
Yes, a separate PR. See these comments/responses: |
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.
Great work. Thanks for explaining the next steps a bit more. I like that plan.
/merge |
Follow-up PR to #14771. I noticed the strings example code still had a deprecated function call: ``` -- Build files have been written to: /opt/conda/conda-bld/work/cpp/examples/strings/build [1/8] Building CXX object CMakeFiles/libcudf_apis.dir/libcudf_apis.cpp.o [2/8] Linking CXX executable libcudf_apis [3/8] Building CUDA object CMakeFiles/custom_prealloc.dir/custom_prealloc.cu.o [4/8] Building CUDA object CMakeFiles/custom_with_malloc.dir/custom_with_malloc.cu.o [5/8] Linking CUDA executable custom_prealloc [6/8] Linking CUDA executable custom_with_malloc [7/8] Building CUDA object CMakeFiles/custom_optimized.dir/custom_optimized.cu.o /opt/conda/conda-bld/work/cpp/examples/strings/custom_optimized.cu: In function 'std::unique_ptr<cudf::column> redact_strings(const cudf::column_view&, const cudf::column_view&)': /opt/conda/conda-bld/work/cpp/examples/strings/custom_optimized.cu:158:40: warning: 'std::unique_ptr<cudf::column> cudf::make_strings_column(cudf::size_type, rmm::device_uvector<int>&&, rmm::device_uvector<char>&&, rmm::device_buffer&&, cudf::size_type)' is deprecated [-Wdeprecated-declarations] 158 | auto result = | ~ ^ /opt/conda/conda-bld/work/cpp/include/cudf/column/column_factories.hpp:510:42: note: declared here 510 | [[deprecated]] std::unique_ptr<column> make_strings_column(size_type num_strings, | ^~~~~~~~~~~~~~~~~~~ [8/8] Linking CUDA executable custom_optimized ``` Authors: - Bradley Dice (https://github.com/bdice) Approvers: - David Wendt (https://github.com/davidwendt) - Vyas Ramasubramani (https://github.com/vyasr) - Mark Harris (https://github.com/harrism) URL: #14838
) Follow-up PR to rapidsai#14771. I noticed the strings example code still had a deprecated function call: ``` -- Build files have been written to: /opt/conda/conda-bld/work/cpp/examples/strings/build [1/8] Building CXX object CMakeFiles/libcudf_apis.dir/libcudf_apis.cpp.o [2/8] Linking CXX executable libcudf_apis [3/8] Building CUDA object CMakeFiles/custom_prealloc.dir/custom_prealloc.cu.o [4/8] Building CUDA object CMakeFiles/custom_with_malloc.dir/custom_with_malloc.cu.o [5/8] Linking CUDA executable custom_prealloc [6/8] Linking CUDA executable custom_with_malloc [7/8] Building CUDA object CMakeFiles/custom_optimized.dir/custom_optimized.cu.o /opt/conda/conda-bld/work/cpp/examples/strings/custom_optimized.cu: In function 'std::unique_ptr<cudf::column> redact_strings(const cudf::column_view&, const cudf::column_view&)': /opt/conda/conda-bld/work/cpp/examples/strings/custom_optimized.cu:158:40: warning: 'std::unique_ptr<cudf::column> cudf::make_strings_column(cudf::size_type, rmm::device_uvector<int>&&, rmm::device_uvector<char>&&, rmm::device_buffer&&, cudf::size_type)' is deprecated [-Wdeprecated-declarations] 158 | auto result = | ~ ^ /opt/conda/conda-bld/work/cpp/include/cudf/column/column_factories.hpp:510:42: note: declared here 510 | [[deprecated]] std::unique_ptr<column> make_strings_column(size_type num_strings, | ^~~~~~~~~~~~~~~~~~~ [8/8] Linking CUDA executable custom_optimized ``` Authors: - Bradley Dice (https://github.com/bdice) Approvers: - David Wendt (https://github.com/davidwendt) - Vyas Ramasubramani (https://github.com/vyasr) - Mark Harris (https://github.com/harrism) URL: rapidsai#14838
Description
Fixes deprecation warnings introduced when #14202 merged.
Most of these are for calls to
cudf::make_strings_column
which deprecated the chars-column function overload.Checklist