From 4aaed71de53ed68f5eb17b04b2ae1088c9982d69 Mon Sep 17 00:00:00 2001 From: Seunghwa Kang Date: Wed, 8 May 2019 20:13:12 -0700 Subject: [PATCH 1/2] fix issue #161 (warning in cub/device/dispatch/dispatch_spmv_orig.cuh) --- cub/device/dispatch/dispatch_spmv_orig.cuh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cub/device/dispatch/dispatch_spmv_orig.cuh b/cub/device/dispatch/dispatch_spmv_orig.cuh index fc920fd047..a9e7ca5973 100644 --- a/cub/device/dispatch/dispatch_spmv_orig.cuh +++ b/cub/device/dispatch/dispatch_spmv_orig.cuh @@ -539,7 +539,7 @@ struct DispatchSpmv // Get max x-dimension of grid int max_dim_x; - if (CubDebug(error = cudaDeviceGetAttribute(&max_dim_x, cudaDevAttrMaxGridDimX, device_ordinal))) break;; + if (CubDebug(error = cudaDeviceGetAttribute(&max_dim_x, cudaDevAttrMaxGridDimX, device_ordinal))) break; // Total number of spmv work items int num_merge_items = spmv_params.num_rows + spmv_params.num_nonzeros; From 01980f99afe30cdfb93264a5b5c384eccb020a5d Mon Sep 17 00:00:00 2001 From: Seunghwa Kang Date: Wed, 8 May 2019 23:12:50 -0700 Subject: [PATCH 2/2] fix issue #162 (cudaBindTexture returns cudaErrorInvalidValue if a memory block from a pool allocator is passed) --- cub/device/dispatch/dispatch_spmv_orig.cuh | 2 +- cub/iterator/tex_obj_input_iterator.cuh | 2 +- cub/iterator/tex_ref_input_iterator.cuh | 8 ++++---- experimental/spmv_compare.cu | 2 +- 4 files changed, 7 insertions(+), 7 deletions(-) diff --git a/cub/device/dispatch/dispatch_spmv_orig.cuh b/cub/device/dispatch/dispatch_spmv_orig.cuh index a9e7ca5973..a750d382c4 100644 --- a/cub/device/dispatch/dispatch_spmv_orig.cuh +++ b/cub/device/dispatch/dispatch_spmv_orig.cuh @@ -607,7 +607,7 @@ struct DispatchSpmv if (CUB_IS_HOST_CODE) { // Init textures - if (CubDebug(error = spmv_params.t_vector_x.BindTexture(spmv_params.d_vector_x))) break; + if (CubDebug(error = spmv_params.t_vector_x.BindTexture(spmv_params.d_vector_x, spmv_params.num_cols * sizeof(ValueT)))) break; } #endif diff --git a/cub/iterator/tex_obj_input_iterator.cuh b/cub/iterator/tex_obj_input_iterator.cuh index 255e6da0b9..b3695a719e 100644 --- a/cub/iterator/tex_obj_input_iterator.cuh +++ b/cub/iterator/tex_obj_input_iterator.cuh @@ -157,7 +157,7 @@ public: template cudaError_t BindTexture( QualifiedT *ptr, ///< Native pointer to wrap that is aligned to cudaDeviceProp::textureAlignment - size_t bytes = size_t(-1), ///< Number of bytes in the range + size_t bytes, ///< Number of bytes in the range size_t tex_offset = 0) ///< OffsetT (in items) from \p ptr denoting the position of the iterator { this->ptr = const_cast::Type *>(ptr); diff --git a/cub/iterator/tex_ref_input_iterator.cuh b/cub/iterator/tex_ref_input_iterator.cuh index f02dc431be..2080bd41dc 100644 --- a/cub/iterator/tex_ref_input_iterator.cuh +++ b/cub/iterator/tex_ref_input_iterator.cuh @@ -99,13 +99,13 @@ struct CUB_DEPRECATED IteratorTexRef static TexRef ref; /// Bind texture - static cudaError_t BindTexture(void *d_in, size_t &offset) + static cudaError_t BindTexture(void *d_in, size_t &bytes, size_t &offset) { if (d_in) { cudaChannelFormatDesc tex_desc = cudaCreateChannelDesc(); ref.channelDesc = tex_desc; - return (CubDebug(cudaBindTexture(&offset, ref, d_in))); + return (CubDebug(cudaBindTexture(&offset, ref, d_in, bytes))); } return cudaSuccess; @@ -275,12 +275,12 @@ public: template cudaError_t BindTexture( QualifiedT *ptr, ///< Native pointer to wrap that is aligned to cudaDeviceProp::textureAlignment - size_t /*bytes*/ = size_t(-1), ///< Number of bytes in the range + size_t bytes, ///< Number of bytes in the range size_t tex_offset = 0) ///< OffsetT (in items) from \p ptr denoting the position of the iterator { this->ptr = const_cast::Type *>(ptr); size_t offset; - cudaError_t retval = TexId::BindTexture(this->ptr + tex_offset, offset); + cudaError_t retval = TexId::BindTexture(this->ptr + tex_offset, bytes, offset); this->tex_offset = (difference_type) (offset / sizeof(QualifiedT)); return retval; } diff --git a/experimental/spmv_compare.cu b/experimental/spmv_compare.cu index 8b623a5e56..5e0b87d674 100644 --- a/experimental/spmv_compare.cu +++ b/experimental/spmv_compare.cu @@ -193,7 +193,7 @@ float TestGpuCsrIoProxy( typedef TexRefInputIterator TexItr; TexItr x_itr; - CubDebugExit(x_itr.BindTexture(params.d_vector_x)); + CubDebugExit(x_itr.BindTexture(params.d_vector_x, params.num_cols * sizeof(ValueT))); // Get device ordinal int device_ordinal;