Skip to content

Commit d968d90

Browse files
authored
remove is_padded check (#988)
1 parent fd56bff commit d968d90

File tree

3 files changed

+19
-2
lines changed

3 files changed

+19
-2
lines changed

crates/cubecl-matmul/src/tests/naive/macros.rs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,13 @@ macro_rules! testgen_matmul_simple {
2121
)
2222
}
2323

24+
#[test]
25+
pub fn test_odd() {
26+
cubecl_matmul::tests::naive::tests::test_odd::<TestRuntime, FloatT>(
27+
&Default::default(),
28+
)
29+
}
30+
2431
#[test]
2532
pub fn test_simple_matmul_large() {
2633
cubecl_matmul::tests::naive::tests::test_large::<TestRuntime, FloatT>(

crates/cubecl-matmul/src/tests/naive/tests.rs

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,17 @@ pub fn test_small<R: Runtime, F: Float + CubeElement + Display + Sample>(device:
2323
test_simple::<R, F>(case, device);
2424
}
2525

26+
pub fn test_odd<R: Runtime, F: Float + CubeElement + Display + Sample>(device: &R::Device) {
27+
let case = MatmulTestCase {
28+
m: 1,
29+
k: 101,
30+
n: 255,
31+
batch: 1,
32+
};
33+
34+
test_simple::<R, F>(case, device);
35+
}
36+
2637
pub fn test_large<R: Runtime, F: Float + CubeElement + Display + Sample>(device: &R::Device) {
2738
let case = MatmulTestCase {
2839
m: 256,

crates/cubecl-std/src/tensor/contiguous.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -332,10 +332,9 @@ pub fn into_contiguous_ref<R: Runtime, E: CubePrimitive>(
332332
let mut num_elems_per_unit = line_size as u32 * elems_per_unit;
333333

334334
let last_dim = output.shape[rank - 1];
335-
let is_padded = rank > 1 && last_dim != output.strides[rank - 2];
336335

337336
// If tensor is strided, elems_per_unit must be compatible with last dim
338-
while is_padded && !last_dim.is_multiple_of(num_elems_per_unit as usize) {
337+
while !last_dim.is_multiple_of(num_elems_per_unit as usize) {
339338
elems_per_unit /= 2;
340339
num_elems_per_unit /= 2;
341340
}

0 commit comments

Comments
 (0)