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;