Skip to content

Commit

Permalink
applied a fix for https://github.com/NVlabs/cub/issues/162 to cub_sem…
Browse files Browse the repository at this point in the history
…iring
  • Loading branch information
seunghwak committed May 10, 2019
1 parent e3399a2 commit abb3dc8
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -762,7 +762,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)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,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
Original file line number Diff line number Diff line change
Expand Up @@ -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<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 @@ -245,12 +245,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

0 comments on commit abb3dc8

Please sign in to comment.