Skip to content
This repository has been archived by the owner on Mar 21, 2024. It is now read-only.

Fixes Issues #161 and #162 #163

Merged
merged 2 commits into from
Jul 30, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions cub/device/dispatch/dispatch_spmv_orig.cuh
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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

Expand Down
2 changes: 1 addition & 1 deletion cub/iterator/tex_obj_input_iterator.cuh
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,7 @@ public:
template <typename QualifiedT>
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<typename RemoveQualifiers<QualifiedT>::Type *>(ptr);
Expand Down
8 changes: 4 additions & 4 deletions cub/iterator/tex_ref_input_iterator.cuh
Original file line number Diff line number Diff line change
Expand Up @@ -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<TextureWord>();
ref.channelDesc = tex_desc;
return (CubDebug(cudaBindTexture(&offset, ref, d_in)));
return (CubDebug(cudaBindTexture(&offset, ref, d_in, bytes)));
}

return cudaSuccess;
Expand Down Expand Up @@ -275,12 +275,12 @@ public:
template <typename QualifiedT>
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<typename RemoveQualifiers<QualifiedT>::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;
}
Expand Down
2 changes: 1 addition & 1 deletion experimental/spmv_compare.cu
Original file line number Diff line number Diff line change
Expand Up @@ -193,7 +193,7 @@ float TestGpuCsrIoProxy(

typedef TexRefInputIterator<ValueT, 1234, int> 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;
Expand Down