[BUG] Not all global static references are __attribute__((visibility(default)))
#1651
Labels
bug
Something isn't working
__attribute__((visibility(default)))
#1651
Describe the bug
In #826, it was noted that the
std::map
inper_device_resource.hpp
is a global static reference returned from an inline function. This causes issues with the RMM-defaultvisibility(hidden)
attribute of functions in the RMM headers, since although when compiling within a single library, the linker will uniquify the references to the function, when RMM is included in two separate libraries, this does not occur.As a consequence, with
visibility(hidden)
, the static reference will be unique per library, but differ across libraries.#833 fixed this for the particular case of
rmm::mr::detail::get_map
, by making that functionRMM_EXPORT
.However, there are other static references returned from inline functions in that file that were not exported. These should also be
RMM_EXPORT
.In particular
rmm::mr::detail::map_lock
returns a static reference to a mutex that protects accesses to the per-device-resource map. However, since it is visibility(hidden), we actually don't have a single map lock, and so we are actually not protecting concurrent access to the per-device-resource map from different libraries.An example, printing the address of the map lock:
We see, when cudf is compiled and used from cudf python (the python bindings build a separate library that includes RMM):
prints
The text was updated successfully, but these errors were encountered: