diff --git a/cub/device/dispatch/dispatch_spmv_orig.cuh b/cub/device/dispatch/dispatch_spmv_orig.cuh index 3388f536ac..9cef0e7760 100644 --- a/cub/device/dispatch/dispatch_spmv_orig.cuh +++ b/cub/device/dispatch/dispatch_spmv_orig.cuh @@ -702,7 +702,7 @@ struct DispatchSpmv #if (CUB_PTX_ARCH == 0) // 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 if (search_grid_size < sm_count) diff --git a/cub/iterator/tex_obj_input_iterator.cuh b/cub/iterator/tex_obj_input_iterator.cuh index b99103ec55..7f8fa84c5b 100644 --- a/cub/iterator/tex_obj_input_iterator.cuh +++ b/cub/iterator/tex_obj_input_iterator.cuh @@ -161,7 +161,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 95d0ffbc96..08e2d149f2 100644 --- a/cub/iterator/tex_ref_input_iterator.cuh +++ b/cub/iterator/tex_ref_input_iterator.cuh @@ -91,13 +91,13 @@ struct 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; @@ -245,12 +245,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 b64297d8db..11c5803711 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;