From 5b25b782048d313ca3741b3d2e38101e9a402279 Mon Sep 17 00:00:00 2001 From: Bernhard Manfred Gruber Date: Mon, 6 May 2024 20:53:22 +0200 Subject: [PATCH] Simplify code around castIfHalfPointer --- cub/test/test_device_histogram.cu | 26 +++++++------------------- 1 file changed, 7 insertions(+), 19 deletions(-) diff --git a/cub/test/test_device_histogram.cu b/cub/test/test_device_histogram.cu index 8a128f324e3..2c4b591e19c 100644 --- a/cub/test/test_device_histogram.cu +++ b/cub/test/test_device_histogram.cu @@ -75,23 +75,11 @@ auto castIfHalfPointer(It it) -> It return it; } -template -auto castIfArrayOfHalfPointers(T** p) -> T** -{ - return p; -} - #if TEST_HALF_T auto castIfHalfPointer(half_t* p) -> __half* { return reinterpret_cast<__half*>(p); } - -template -auto castIfArrayOfHalfPointers(half_t** a) -> __half** -{ - return reinterpret_cast<__half**>(a); -} #endif //--------------------------------------------------------------------- @@ -135,7 +123,7 @@ struct Dispatch castIfHalfPointer(d_samples), d_histogram, num_levels, - castIfArrayOfHalfPointers(d_levels), + castIfHalfPointer(d_levels), num_row_pixels, num_rows, row_stride_bytes); @@ -211,9 +199,9 @@ struct Dispatch<1, 1> int* num_levels, ///< [in] The number of boundaries (levels) for delineating histogram samples in each active ///< channel. Implies that the number of bins for channeli is ///< num_levels[i] - 1. - LevelT* d_levels, ///< [in] The pointers to the arrays of boundaries (levels), one for each active channel. Bin - ///< ranges are defined by consecutive boundary pairings: lower sample value boundaries are - ///< inclusive and upper sample value boundaries are exclusive. + LevelT** d_levels, ///< [in] The pointers to the arrays of boundaries (levels), one for each active channel. Bin + ///< ranges are defined by consecutive boundary pairings: lower sample value boundaries are + ///< inclusive and upper sample value boundaries are exclusive. OffsetT num_row_pixels, ///< [in] The number of multi-channel pixels per row in the region of interest OffsetT num_rows, ///< [in] The number of rows in the region of interest OffsetT row_stride_bytes) ///< [in] The number of bytes between starts of consecutive rows in the region of interest @@ -226,7 +214,7 @@ struct Dispatch<1, 1> castIfHalfPointer(d_samples), d_histogram[0], num_levels[0], - *castIfHalfPointer(&d_levels[0]), + castIfHalfPointer(d_levels)[0], num_row_pixels, num_rows, row_stride_bytes); @@ -270,8 +258,8 @@ struct Dispatch<1, 1> castIfHalfPointer(d_samples), d_histogram[0], num_levels[0], - *castIfHalfPointer(&lower_level[0]), - *castIfHalfPointer(&upper_level[0]), + castIfHalfPointer(lower_level)[0], + castIfHalfPointer(upper_level)[0], num_row_pixels, num_rows, row_stride_bytes);