Skip to content
This repository was archived by the owner on Mar 21, 2024. It is now read-only.

Commit 92b3aaf

Browse files
committed
Merge branch 'ctk12_cdp_updates' into staging/ctk_12.0
2 parents d6e9274 + 3c9c838 commit 92b3aaf

File tree

2 files changed

+23
-7
lines changed

2 files changed

+23
-7
lines changed

thrust/system/cuda/detail/cdp_dispatch.h

Lines changed: 22 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -42,13 +42,29 @@
4242
* \endcode
4343
*/
4444

45-
#ifdef THRUST_RDC_ENABLED
45+
#if defined(CUB_DETAIL_CDPv1)
4646

47-
// seq_impl unused.
47+
// Special case for NVCC -- need to inform the device path about the kernels
48+
// that are launched from the host path.
49+
#if defined(__CUDACC__) && defined(__CUDA_ARCH__)
50+
51+
// seq_impl only used on platforms that do not support device synchronization.
4852
#define THRUST_CDP_DISPATCH(par_impl, seq_impl) \
49-
NV_IF_TARGET(NV_ANY_TARGET, par_impl, par_impl)
53+
if (false) \
54+
{ /* Without this, the device pass won't compile any kernels. */ \
55+
NV_IF_TARGET(NV_ANY_TARGET, par_impl); \
56+
} \
57+
NV_DISPATCH_TARGET(NV_PROVIDES_SM_90, seq_impl, NV_ANY_TARGET, par_impl)
5058

51-
#else // THRUST_RDC_ENABLED
59+
#else // NVCC device pass
60+
61+
// seq_impl only used on platforms that do not support device synchronization.
62+
#define THRUST_CDP_DISPATCH(par_impl, seq_impl) \
63+
NV_DISPATCH_TARGET(NV_PROVIDES_SM_90, seq_impl, NV_ANY_TARGET, par_impl)
64+
65+
#endif // NVCC device pass
66+
67+
#else // CDPv1 unavailable. Always fallback to serial on device:
5268

5369
// Special case for NVCC -- need to inform the device path about the kernels
5470
// that are launched from the host path.
@@ -62,11 +78,11 @@
6278
} \
6379
NV_IF_TARGET(NV_IS_HOST, par_impl, seq_impl)
6480

65-
#else // NVCC device pass
81+
#else // !(NVCC device pass):
6682

6783
#define THRUST_CDP_DISPATCH(par_impl, seq_impl) \
6884
NV_IF_TARGET(NV_IS_HOST, par_impl, seq_impl)
6985

7086
#endif // NVCC device pass
7187

72-
#endif // THRUST_RDC_ENABLED
88+
#endif // CDP version

0 commit comments

Comments
 (0)