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

Improve performance for replace-multi for long strings #12858

Merged
merged 29 commits into from
Mar 17, 2023

Conversation

davidwendt
Copy link
Contributor

@davidwendt davidwendt commented Feb 27, 2023

Description

Adds more efficient algorithm for multi-string version of cudf::strings::replace for longer strings (greater than 256 bytes on average in each row).

Checklist

  • I am familiar with the Contributing Guidelines.
  • New or existing tests cover these changes.
  • The documentation is up to date with these changes.

@davidwendt davidwendt added 2 - In Progress Currently a work in progress libcudf Affects libcudf (C++/CUDA) code. strings strings issues (C++ and Python) improvement Improvement / enhancement to an existing function non-breaking Non-breaking change labels Feb 27, 2023
@davidwendt davidwendt self-assigned this Feb 27, 2023
@github-actions github-actions bot added the CMake CMake build issue label Feb 27, 2023
@@ -704,92 +704,6 @@ std::unique_ptr<column> replace_slice(strings_column_view const& strings,
cudf::detail::copy_bitmask(strings.parent(), stream, mr));
}

namespace {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This code moved to the new multi.cu source file.

@davidwendt
Copy link
Contributor Author

Rows Width Baseline Change X
4096 32 0.134 0.114 1.18
4096 64 0.18 0.161 1.12
4096 128 0.291 0.269 1.08
4096 256 0.534 0.51 1.05
4096 512 1.01 0.396 2.55
4096 1024 2.03 0.496 4.09
4096 2048 4.05 0.717 5.65
4096 4096 8.4 1.13 7.43
4096 8192 16.7 2.49 6.71
32768 32 0.135 0.116 1.16
32768 64 0.189 0.172 1.10
32768 128 0.308 0.293 1.05
32768 256 0.565 0.549 1.03
32768 512 1.12 1.09 1.03
32768 1024 2.21 2.08 1.06
32768 2048 4.4 3.45 1.28
32768 4096 8.79 6.03 1.46
32768 8192 17.4 11.1 1.57
262144 32 0.219 0.204 1.07
262144 64 0.409 0.391 1.05
262144 128 0.855 0.834 1.03
262144 256 3.67 3.7 0.99
262144 512 11.9 6.18 1.93
262144 1024 27.8 11.8 2.36
262144 2048 68 23.4 2.91
262144 4096 136 49.1 2.77
2097152 32 0.94 0.91 1.03
2097152 64 2.23 2.2 1.01
2097152 128 5.21 5.12 1.02
2097152 256 15.9 15.7 1.01
2097152 512 52.6 46.8 1.12
16777216 32 6.88 6.81 1.01
16777216 64 17.1 16.9 1.01

Values are in ms and X column is improvement factor. The row-widths 32-256 use the existing code path (no change in performance). For row-widths >256 the new optimized code path is used.

@davidwendt davidwendt added 3 - Ready for Review Ready for review by team and removed 2 - In Progress Currently a work in progress labels Mar 6, 2023
@davidwendt davidwendt marked this pull request as ready for review March 7, 2023 12:52
@davidwendt davidwendt requested review from a team as code owners March 7, 2023 12:52
Copy link
Contributor

@hyperbolic2346 hyperbolic2346 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Mostly nits here. I like this change and think it will be a great addition!

cpp/benchmarks/string/replace.cpp Show resolved Hide resolved
cpp/src/strings/replace/multi.cu Outdated Show resolved Hide resolved
cpp/src/strings/replace/multi.cu Outdated Show resolved Hide resolved
cpp/src/strings/replace/multi.cu Outdated Show resolved Hide resolved
cpp/src/strings/replace/multi.cu Outdated Show resolved Hide resolved
cpp/src/strings/replace/multi.cu Outdated Show resolved Hide resolved
cpp/src/strings/replace/multi.cu Outdated Show resolved Hide resolved
cpp/src/strings/replace/multi.cu Outdated Show resolved Hide resolved
cpp/src/strings/replace/multi.cu Show resolved Hide resolved
cpp/tests/strings/replace_tests.cpp Show resolved Hide resolved
Copy link
Member

@PointKernel PointKernel left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks great with one minor non-blocking nit.

Thanks!

cpp/src/strings/replace/multi.cu Outdated Show resolved Hide resolved
Copy link
Contributor

@bdice bdice left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Approving CMake changes.

@davidwendt
Copy link
Contributor Author

/merge

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
3 - Ready for Review Ready for review by team CMake CMake build issue improvement Improvement / enhancement to an existing function libcudf Affects libcudf (C++/CUDA) code. non-breaking Non-breaking change strings strings issues (C++ and Python)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants