Skip to content

Fix warnings due to compiler regression with if constexpr - #11581

Merged
rapids-bot[bot] merged 3 commits into
NVIDIA:branch-22.10from
ttnghia:fix_warning
Aug 25, 2022
Merged

rapids-bot[bot] merged 3 commits into
NVIDIA:branch-22.10from
ttnghia:fix_warning

Conversation

@ttnghia

@ttnghia ttnghia commented Aug 23, 2022 •

Copy link
Copy Markdown
Contributor

On some systems, CUDA compiler may have an issue such that it will throw unused variables warnings into your face if you use if constexpr with an else branch. Such warnings were reported due to a recent merged PR (#10548).

This PR rewrites the else branch of the if constexpr in lists/contains.cu into a second if constexpr statement with opposite condition to avoid the warnings.

@ttnghia ttnghia added 3 - Ready for Review Ready for review by team libcudf Affects libcudf (C++/CUDA) code. improvement Improvement / enhancement to an existing function non-breaking Non-breaking change not a bug labels Aug 23, 2022
@ttnghia ttnghia self-assigned this Aug 23, 2022
@ttnghia
ttnghia requested a review from a team as a code owner August 23, 2022 04:50
@ttnghia
ttnghia requested review from harrism and jrhemstad August 23, 2022 04:50
@ttnghia ttnghia changed the title Fix warnings due to compiler regression Fix warnings due to compiler regression with if constexpr having else branch Aug 23, 2022
@ttnghia
ttnghia requested a review from bdice August 23, 2022 04:50

@bdice bdice 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.

@ttnghia Were you able to reproduce the warning? I’d like to make this change for only cases that show the warning rather than every if constexpr in the previous PR.

@codecov

codecov Bot commented Aug 23, 2022 •

Copy link
Copy Markdown

Codecov Report

❗ No coverage uploaded for pull request base (branch-22.10@2c06e51). Click here to learn what that means.
The diff coverage is n/a.

@@               Coverage Diff               @@
##             branch-22.10   #11581   +/-   ##
===============================================
  Coverage                ?   86.40%           
===============================================
  Files                   ?      145           
  Lines                   ?    22960           
  Branches                ?        0           
===============================================
  Hits                    ?    19839           
  Misses                  ?     3121           
  Partials                ?        0           

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

@davidwendt davidwendt 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.

Comment thread cpp/src/lists/contains.cu Resolved
Comment thread cpp/src/lists/contains.cu Outdated
return {table_view{{tmp_column->view()}}, std::move(tmp_column)};
}

// Using `if constexpr` again instead of `else` branch to avoid incorrect compiler warning about

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.

After the removal of the variable above, can we bring this back into an else clause?

@ttnghia ttnghia Aug 23, 2022 •

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Let's try that...

This reverts commit e61ef8a.

Signed-off-by: Nghia Truong <[email protected]>

# Conflicts:
#	cpp/src/lists/contains.cu

@davidwendt davidwendt 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.

Looks like that worked.

@ttnghia ttnghia changed the title Fix warnings due to compiler regression with if constexpr having else branch Fix warnings due to compiler regression with if constexpr Aug 23, 2022
Comment thread cpp/src/lists/contains.cu Resolved
@ttnghia
ttnghia requested a review from bdice August 24, 2022 14:41

@bdice bdice 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.

Thanks to all who weighed in on this PR -- it feels small, but it is nice that we came up with a workaround for the erroneous compiler warning and an improvement in code quality.

@ttnghia

ttnghia commented Aug 25, 2022

Copy link
Copy Markdown
Contributor Author

@gpucibot merge

@rapids-bot
rapids-bot Bot merged commit 8410fc1 into NVIDIA:branch-22.10 Aug 25, 2022
@ttnghia
ttnghia deleted the fix_warning branch September 2, 2022 20:54
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 improvement Improvement / enhancement to an existing function libcudf Affects libcudf (C++/CUDA) code. non-breaking Non-breaking change

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants