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

[REVIEW] Enforce default visibility for get_map. #833

Merged

Conversation

trivialfis
Copy link
Member

Define macros used for specifying symbol visibility and use it on get_map. The macros are only useful for gcc/clang with glibc on Linux. Sorry I'm not familiar with other platforms.

Close #826 .

  1. Please ensure that you have written units tests for the changes made and/or features added.

I'm not sure how to test this on CI.

@trivialfis trivialfis requested a review from a team as a code owner July 22, 2021 10:13
@github-actions github-actions bot added the cpp Pertains to C++ code label Jul 22, 2021
@trivialfis
Copy link
Member Author

trivialfis commented Jul 22, 2021

Please help with the label, I don't have permission to edit the label on GitHub.

Other CI errors should be unrelated.

@harrism
Copy link
Member

harrism commented Jul 22, 2021

@trivialfis we are one day from code freeze for 21.08 so please retarget to 21.10. Thanks!

@trivialfis
Copy link
Member Author

Got it, will reopen the PR.

@trivialfis trivialfis closed this Jul 22, 2021
@@ -95,7 +96,8 @@ inline std::mutex& map_lock()
return map_lock;
}

inline auto& get_map()
// Must have default visibility, see: https://github.com/rapidsai/rmm/issues/826
RMM_EXPORT inline auto& get_map()
Copy link
Member

Choose a reason for hiding this comment

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

Don't you need this on all functions in this file?

Copy link
Member Author

Choose a reason for hiding this comment

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

I tested it with XGBoost and it works fine. I'm not entirely sure what's happening exactly during runtime linking. I guess as long as this function is not inlined and the linker can find the right symbol it should be fine?

Copy link
Contributor

@jrhemstad jrhemstad Jul 22, 2021

Choose a reason for hiding this comment

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

This is the only one that matters as the function local static is the only symbol that need be shared across DLLs.

@harrism harrism requested a review from jrhemstad July 22, 2021 10:54
@trivialfis
Copy link
Member Author

I moved the PR to #834 as requested.

@harrism
Copy link
Member

harrism commented Jul 22, 2021

You don't need a new PR. You could have just clicked "edit" next to the title and selected 21.10. Then merge 21.10 into your branch.

@trivialfis
Copy link
Member Author

Let me try that.

@trivialfis trivialfis reopened this Jul 22, 2021
@trivialfis trivialfis changed the base branch from branch-21.08 to branch-21.10 July 22, 2021 11:08
@trivialfis
Copy link
Member Author

You don't need a new PR. You could have just clicked "edit" next to the title and selected 21.10. Then merge 21.10 into your branch.

Good to learn something new every day. ;-)

@jrhemstad jrhemstad added improvement Improvement / enhancement to an existing function non-breaking Non-breaking change labels Jul 22, 2021
@jrhemstad
Copy link
Contributor

rerun tests

@trivialfis
Copy link
Member Author

rerun tests

@jrhemstad
Copy link
Contributor

@gpucibot merge

@rapids-bot rapids-bot bot merged commit 4dc3625 into rapidsai:branch-21.10 Jul 23, 2021
@trivialfis trivialfis deleted the bug-export-global-variable branch July 24, 2021 05:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cpp Pertains to C++ code improvement Improvement / enhancement to an existing function non-breaking Non-breaking change
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[BUG] Global static variable in inlined function.
4 participants