Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixing small bug in CUSPARSE spmm w/ CUDA 12.2 #2117

Merged
merged 1 commit into from
Jan 24, 2024

Conversation

cjnolet
Copy link
Member

@cjnolet cjnolet commented Jan 23, 2024

No description provided.

@cjnolet cjnolet added bug Something isn't working non-breaking Non-breaking change labels Jan 23, 2024
@cjnolet cjnolet self-assigned this Jan 23, 2024
@cjnolet cjnolet requested a review from a team as a code owner January 23, 2024 22:50
@github-actions github-actions bot added the cpp label Jan 23, 2024
@cjnolet
Copy link
Member Author

cjnolet commented Jan 24, 2024

/merge

@rapids-bot rapids-bot bot merged commit 70e806a into rapidsai:branch-24.02 Jan 24, 2024
61 checks passed
auto z_tmp = raft::make_device_matrix<ValueType, IndexType>(handle, z.extent(0), z.extent(1));
auto z_tmp_view = raft::make_device_strided_matrix_view<ValueType, IndexType, LayoutPolicyZ>(
z_tmp.data_handle(), z.extent(0), z.extent(1), is_row_major ? z.stride(0) : z.stride(1));

Copy link
Collaborator

@trxcllnt trxcllnt Jan 24, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we also need to copy z into z_tmp, since it's an in/out buffer in cuSparse?

Suggested change
raft::copy(
z_tmp_view.data_handle(), z.data_handle(), z.size(), raft::resource::get_cuda_stream(handle));

rapids-bot bot pushed a commit that referenced this pull request Jan 24, 2024
With the bug fix #2117 there can be an issue with `z_tmp` memory being uninitialized.
SPMM formula is `Z = alpha . X * Y + beta . Z` so when `beta` is not zero, Z is being read.
The proposed solution in this PR remove the need for an extra allocation and a copy from/to an external buffer, by creating a strided view of the original Z.

Authors:
  - Micka (https://github.com/lowener)

Approvers:
  - Corey J. Nolet (https://github.com/cjnolet)

URL: #2124
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working cpp non-breaking Non-breaking change
Projects
Development

Successfully merging this pull request may close these issues.

3 participants