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

Inline functions that return static references must have default visibility #1653

Merged
merged 7 commits into from
Sep 6, 2024
Merged
Show file tree
Hide file tree
Changes from 5 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions doxygen/Doxyfile
Original file line number Diff line number Diff line change
Expand Up @@ -2176,7 +2176,11 @@ INCLUDE_FILE_PATTERNS =
# recursively expanded use the := operator instead of the = operator.
# This tag requires that the tag ENABLE_PREPROCESSING is set to YES.

PREDEFINED = RMM_NAMESPACE=rmm RMM_EXPORT
# These need to be kept in sync with set in rmm/detail/export.hpp
# Since we are excluding detail files in EXCLUDE_PATTERNS there
# appears to be no way of getting doxygen to still parse that file and
# make the definitions available via the preprocessor :(
PREDEFINED = RMM_EXPORT RMM_HIDDEN RMM_NAMESPACE=rmm

# If the MACRO_EXPANSION and EXPAND_ONLY_PREDEF tags are set to YES then this
# tag can be used to specify a list of macro names that should be expanded. The
Expand All @@ -2185,7 +2189,7 @@ PREDEFINED = RMM_NAMESPACE=rmm RMM_EXPORT
# definition found in the source code.
# This tag requires that the tag ENABLE_PREPROCESSING is set to YES.

EXPAND_AS_DEFINED = RMM_NAMESPACE
EXPAND_AS_DEFINED =

# If the SKIP_FUNCTION_MACROS tag is set to YES then doxygen's preprocessor will
# remove all references to function-like macros that are alone on a line, have
Expand Down
1 change: 1 addition & 0 deletions include/rmm/detail/export.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -24,4 +24,5 @@
#else
#define RMM_EXPORT
#define RMM_HIDDEN
#define RMM_NAMESPACE rmm
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 is necessary for anyone compiling with a compiler that doesn't advertise __GNUC__.

#endif
2 changes: 1 addition & 1 deletion include/rmm/logger.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ struct bytes {
*
* @return spdlog::logger& The logger.
*/
inline spdlog::logger& logger()
RMM_EXPORT inline spdlog::logger& logger()
{
static detail::logger_wrapper wrapped{};
return wrapped.logger_;
Expand Down
11 changes: 8 additions & 3 deletions include/rmm/mr/device/per_device_resource.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -90,14 +90,20 @@ namespace mr {

namespace detail {

// These symbols must have default visibility so that when they are
// referenced in multiple different DSOs the linker correctly
// determines that there is only a single unique reference to the
// function symbols (and hence they return unique static references
// across different DSOs).
wence- marked this conversation as resolved.
Show resolved Hide resolved
// See also https://github.com/rapidsai/rmm/issues/826
/**
* @brief Returns a pointer to the initial resource.
*
* Returns a global instance of a `cuda_memory_resource` as a function local static.
*
* @return Pointer to the static cuda_memory_resource used as the initial, default resource
*/
inline device_memory_resource* initial_resource()
RMM_EXPORT inline device_memory_resource* initial_resource()
{
static cuda_memory_resource mr{};
return &mr;
Expand All @@ -106,13 +112,12 @@ inline device_memory_resource* initial_resource()
/**
* @briefreturn{Reference to the lock}
*/
inline std::mutex& map_lock()
RMM_EXPORT inline std::mutex& map_lock()
{
static std::mutex map_lock;
return map_lock;
}

// This symbol must have default visibility, see: https://github.com/rapidsai/rmm/issues/826
/**
* @briefreturn{Reference to the map from device id -> resource}
*/
Expand Down
Loading