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

Fix an issue with shared sum test #467

Merged
merged 1 commit into from
Feb 6, 2025
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
7 changes: 7 additions & 0 deletions crates/cubecl-reduce/src/shared_sum.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,13 @@ use crate::ReduceError;
///
/// Return an error if atomic addition is not supported for the type `N`.
///
/// # Important
///
/// This doesn't set the value of output to 0 before computing the sums.
/// It is the responsability of the caller to ensure that ouput is set to
/// the proper value. Basically, the behavior of this kernel is akin to the AddAssign operator
/// as it update the output instead of overwriting it.
///
/// # Example
///
/// This examples show how to sum all the elements of a small `2 x 2` matrix.
Expand Down
2 changes: 1 addition & 1 deletion crates/cubecl-reduce/src/test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -504,7 +504,7 @@ impl TestCase {
let client = R::client(device);

let input_handle = client.create(F::as_bytes(&input_values));
let output_handle = client.empty(size_of::<F>());
let output_handle = client.create(F::as_bytes(&[F::from_int(0)]));

let input = unsafe {
TensorHandleRef::<R>::from_raw_parts(
Expand Down