Skip to content

Commit

Permalink
Make get_global_resource host/device
Browse files Browse the repository at this point in the history
The function is called from a host/device constructors and may be invoked from the device code.

As it happens neither NVCC nor clang diagnose such an invalid call.
llvm/llvm-project#118415

As the result, in unoptimized builds we end up with ptxas failing with
an unresolved reference to this function because it is never generated
during GPU-side compilation.
#2813 (comment)
  • Loading branch information
Artem-B committed Dec 3, 2024
1 parent 642976c commit 7eee05d
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion thrust/thrust/mr/memory_resource.h
Original file line number Diff line number Diff line change
Expand Up @@ -204,7 +204,7 @@ _CCCL_HOST_DEVICE bool operator!=(const memory_resource<Pointer>& lhs, const mem
* \return a pointer to a global instance of \p MR.
*/
template <typename MR>
_CCCL_HOST MR* get_global_resource()
_CCCL_HOST_DEVICE MR* get_global_resource()
{
static MR resource;
return &resource;
Expand Down

0 comments on commit 7eee05d

Please sign in to comment.