Skip to content

Fix compile warning in search.cu - #10827

Merged
rapids-bot[bot] merged 1 commit into
NVIDIA:branch-22.06from
davidwendt:fix-search-compile-warning
May 11, 2022
Merged

rapids-bot[bot] merged 1 commit into
NVIDIA:branch-22.06from
davidwendt:fix-search-compile-warning

Conversation

@davidwendt

@davidwendt davidwendt commented May 11, 2022 •

Copy link
Copy Markdown
Contributor

Compile warning introduced with merge of PR #10802

10 warnings like this:
12:43:23 $SRC_DIR/cpp/src/search/search.cu(108): warning #177-D: parameter "args" was declared but never referenced
12:43:23           detected during instantiation of function "lambda [](auto &&...)->auto [with <auto-1>=<rmm::exec_policy, const
thrust::counting_iterator<cudf::size_type, thrust::use_default, thrust::use_default, thrust::use_default> &, 
thrust::counting_iterator<cudf::size_type, thrust::use_default, thrust::use_default, thrust::use_default>, const 
thrust::counting_iterator<cudf::size_type, thrust::use_default, thrust::use_default, thrust::use_default> &, 
thrust::counting_iterator<cudf::size_type, thrust::use_default, thrust::use_default, thrust::use_default>, cudf::size_type *const &, 
const cudf::row_lexicographic_comparator<cudf::nullate::DYNAMIC> &>]" 
12:43:23 (121): here

Line 108 has a lambda refactoring that seems to confuse the compiler.

  auto const do_search = [find_first](auto&&... args) {
    if (find_first) {
      thrust::lower_bound(std::forward<decltype(args)>(args)...);
    } else {
      thrust::upper_bound(std::forward<decltype(args)>(args)...);
    }
  };
  do_search(rmm::exec_policy(stream),
            count_it,  count_it + haystack.num_rows(), count_it, count_it + needles.num_rows(),
            out_it, comp);

The warning is wrong and the compiler generates the correct code so this is likely a compiler bug.

This PR fixes the warning by replacing the lambda with an if statement.

@davidwendt davidwendt added bug Something isn't working 3 - Ready for Review Ready for review by team libcudf Affects libcudf (C++/CUDA) code. non-breaking Non-breaking change labels May 11, 2022
@davidwendt
davidwendt requested a review from a team as a code owner May 11, 2022 12:55
@davidwendt davidwendt self-assigned this May 11, 2022

@ttnghia ttnghia left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Oh I'm sorry about this. I saw the warning but ignored it as I thought this is a compiler bug and it will be fixed on the cuda sdk side.

@codecov

codecov Bot commented May 11, 2022

Copy link
Copy Markdown

Codecov Report

Merging #10827 (f44ee3b) into branch-22.06 (8d861ce) will decrease coverage by 0.09%.
The diff coverage is 94.84%.

❗ Current head f44ee3b differs from pull request most recent head 5c53edf. Consider uploading reports for the commit 5c53edf to get more accurate results

@@               Coverage Diff                @@
##           branch-22.06   #10827      +/-   ##
================================================
- Coverage         86.40%   86.31%   -0.10%     
================================================
  Files               143      144       +1     
  Lines             22448    22648     +200     
================================================
+ Hits              19396    19548     +152     
- Misses             3052     3100      +48     
Impacted Files Coverage Δ
python/cudf/cudf/core/column/string.py 88.78% <ø> (-0.31%) ⬇️
python/cudf/cudf/core/frame.py 93.41% <ø> (ø)
python/cudf/cudf/core/indexed_frame.py 91.70% <ø> (ø)
python/cudf/cudf/io/__init__.py 100.00% <ø> (ø)
python/cudf/cudf/testing/testing.py 81.81% <50.00%> (+0.12%) ⬆️
python/cudf/cudf/io/parquet.py 90.83% <86.60%> (-1.87%) ⬇️
python/cudf/cudf/core/index.py 92.06% <88.88%> (-0.25%) ⬇️
python/cudf/cudf/core/scalar.py 89.01% <90.90%> (-0.31%) ⬇️
python/cudf/cudf/core/dataframe.py 93.78% <96.36%> (+0.08%) ⬆️
python/cudf/cudf/__init__.py 90.69% <100.00%> (+0.22%) ⬆️
... and 29 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update efd2c39...5c53edf. Read the comment docs.

@davidwendt

Copy link
Copy Markdown
Contributor Author

@gpucibot merge

@rapids-bot
rapids-bot Bot merged commit 2b204d0 into NVIDIA:branch-22.06 May 11, 2022
@davidwendt
davidwendt deleted the fix-search-compile-warning branch May 11, 2022 15:39
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 bug Something isn't working libcudf Affects libcudf (C++/CUDA) code. non-breaking Non-breaking change

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants