From b54be7dce34ae5e18ab83529ea3433b787692869 Mon Sep 17 00:00:00 2001 From: Georgy Evtushenko Date: Thu, 7 Jul 2022 14:14:08 +0400 Subject: [PATCH] Fix device-side debug synchronous usage for seg sort --- .../dispatch/dispatch_segmented_sort.cuh | 20 +++++++++---------- 1 file changed, 9 insertions(+), 11 deletions(-) diff --git a/cub/device/dispatch/dispatch_segmented_sort.cuh b/cub/device/dispatch/dispatch_segmented_sort.cuh index 6101695337..9f4b72cd2b 100644 --- a/cub/device/dispatch/dispatch_segmented_sort.cuh +++ b/cub/device/dispatch/dispatch_segmented_sort.cuh @@ -603,12 +603,14 @@ DeviceSegmentedSortContinuation( } // Sync the stream if specified to flush runtime errors - if (debug_synchronous) + if (CUB_IS_HOST_CODE && debug_synchronous) { + #if CUB_INCLUDE_HOST_CODE if (CubDebug(error = SyncStream(stream))) { return error; } + #endif } } @@ -664,12 +666,14 @@ DeviceSegmentedSortContinuation( } // Sync the stream if specified to flush runtime errors - if (debug_synchronous) + if (CUB_IS_HOST_CODE && debug_synchronous) { + #if CUB_INCLUDE_HOST_CODE if (CubDebug(error = SyncStream(stream))) { return error; } + #endif } } @@ -1664,14 +1668,6 @@ private: { return error; } - - if (debug_synchronous) - { - if (CubDebug(error = SyncStream(stream))) - { - return error; - } - } #else error = CubDebug(cudaErrorNotSupported); #endif @@ -1728,12 +1724,14 @@ private: } // Sync the stream if specified to flush runtime errors - if (debug_synchronous) + if (CUB_IS_HOST_CODE && debug_synchronous) { + #if CUB_INCLUDE_HOST_CODE if (CubDebug(error = SyncStream(stream))) { return error; } + #endif } return error;