Skip to content

Commit

Permalink
Merge branch 'main' into remove_debug_level
Browse files Browse the repository at this point in the history
  • Loading branch information
psvri authored May 11, 2024
2 parents 986d82f + 639cbdf commit 4e3d054
Show file tree
Hide file tree
Showing 50 changed files with 552 additions and 599 deletions.
4 changes: 2 additions & 2 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -24,4 +24,4 @@ pollster = "0.3.0"
bytemuck = "1.15.0"
futures-intrusive = "0.5.0"
log = { version = "0.4.21" }
hashbrown = "0.14.3"
hashbrown = "0.14.5"
50 changes: 25 additions & 25 deletions crates/arithmetic/src/f32.rs
Original file line number Diff line number Diff line change
Expand Up @@ -130,59 +130,59 @@ mod tests {
Float32ArrayGPU,
Float32ArrayGPU,
Float32ArrayGPU,
vec![0.0, 1.0, 2.0, 3.0, 104.0],
[0.0, 1.0, 2.0, 3.0, 104.0],
rem_scalar,
rem_scalar_dyn,
100.0,
vec![0.0, 1.0, 2.0, 3.0, 4.0]
[0.0, 1.0, 2.0, 3.0, 4.0]
);

test_scalar_op!(
test_add_f32_scalar_f32,
Float32ArrayGPU,
Float32ArrayGPU,
Float32ArrayGPU,
vec![0.0f32, 1.0, 2.0, 3.0, 4.0],
[0.0f32, 1.0, 2.0, 3.0, 4.0],
add_scalar,
add_dyn,
100.0,
vec![100.0, 101.0, 102.0, 103.0, 104.0]
[100.0, 101.0, 102.0, 103.0, 104.0]
);

test_scalar_op!(
test_div_f32_scalar_f32,
Float32ArrayGPU,
Float32ArrayGPU,
Float32ArrayGPU,
vec![0.0f32, 1.0, 2.0, 3.0, 4.0],
[0.0f32, 1.0, 2.0, 3.0, 4.0],
div_scalar,
div_scalar_dyn,
100.0,
vec![0.0, 0.01, 0.02, 0.03, 0.04]
[0.0, 0.01, 0.02, 0.03, 0.04]
);

test_scalar_op!(
test_mul_f32_scalar_f32,
Float32ArrayGPU,
Float32ArrayGPU,
Float32ArrayGPU,
vec![0.0f32, 1.0, 2.0, 3.0, 4.0],
[0.0f32, 1.0, 2.0, 3.0, 4.0],
mul_scalar,
mul_dyn,
100.0,
vec![0.0, 100.0, 200.0, 300.0, 400.0]
[0.0, 100.0, 200.0, 300.0, 400.0]
);

test_scalar_op!(
test_sub_f32_scalar_f32,
Float32ArrayGPU,
Float32ArrayGPU,
Float32ArrayGPU,
vec![0.0f32, 1.0, 2.0, 3.0, 4.0],
[0.0f32, 1.0, 2.0, 3.0, 4.0],
sub_scalar,
sub_scalar_dyn,
100.0,
vec![-100.0, -99.0, -98.0, -97.0, -96.0]
[-100.0, -99.0, -98.0, -97.0, -96.0]
);

#[test]
Expand All @@ -199,7 +199,7 @@ mod tests {
.collect::<Vec<f32>>(),
device.clone(),
);
let values_array = Float32ArrayGPU::from_slice(&vec![100.0], device);
let values_array = Float32ArrayGPU::from_slice(&[100.0], device);
let new_gpu_array = gpu_array.add_scalar(&values_array);
for (index, value) in new_gpu_array.raw_values().unwrap().into_iter().enumerate() {
assert_eq!((index as f32) + 100.0, value);
Expand All @@ -213,9 +213,9 @@ mod tests {
Float32ArrayGPU,
add,
add_dyn,
vec![Some(0.0), Some(1.0), None, None, Some(4.0)],
vec![Some(1.0), Some(2.0), None, Some(4.0), None],
vec![Some(1.0), Some(3.0), None, None, None]
[Some(0.0), Some(1.0), None, None, Some(4.0)],
[Some(1.0), Some(2.0), None, Some(4.0), None],
[Some(1.0), Some(3.0), None, None, None]
);

test_array_op!(
Expand All @@ -225,9 +225,9 @@ mod tests {
Float32ArrayGPU,
sub,
sub_dyn,
vec![Some(0.0), Some(1.0), None, None, Some(4.0), Some(10.0)],
vec![Some(1.0), Some(2.0), None, Some(4.0), None, Some(0.0)],
vec![Some(-1.0), Some(-1.0), None, None, None, Some(10.0)]
[Some(0.0), Some(1.0), None, None, Some(4.0), Some(10.0)],
[Some(1.0), Some(2.0), None, Some(4.0), None, Some(0.0)],
[Some(-1.0), Some(-1.0), None, None, None, Some(10.0)]
);

test_array_op!(
Expand All @@ -237,9 +237,9 @@ mod tests {
Float32ArrayGPU,
mul,
mul_dyn,
vec![Some(0.0), Some(1.0), None, None, Some(4.0)],
vec![Some(1.0), Some(2.0), None, Some(4.0), None],
vec![Some(0.0), Some(2.0), None, None, None]
[Some(0.0), Some(1.0), None, None, Some(4.0)],
[Some(1.0), Some(2.0), None, Some(4.0), None],
[Some(0.0), Some(2.0), None, None, None]
);

test_array_op!(
Expand All @@ -249,19 +249,19 @@ mod tests {
Float32ArrayGPU,
div,
div_dyn,
vec![Some(0.0), Some(1.0), None, None, Some(4.0)],
vec![Some(1.0), Some(2.0), None, Some(4.0), None],
vec![Some(0.0), Some(0.5), None, None, None]
[Some(0.0), Some(1.0), None, None, Some(4.0)],
[Some(1.0), Some(2.0), None, Some(4.0), None],
[Some(0.0), Some(0.5), None, None, None]
);

test_unary_op_float!(
test_f32_exp2,
Float32ArrayGPU,
Float32ArrayGPU,
vec![0.0, 1.0, 2.0, 3.0, -1.0, -2.0, -3.0],
[0.0, 1.0, 2.0, 3.0, -1.0, -2.0, -3.0],
neg,
neg_dyn,
vec![0.0, -1.0, -2.0, -3.0, 1.0, 2.0, 3.0]
[0.0, -1.0, -2.0, -3.0, 1.0, 2.0, 3.0]
);

test_sum!(
Expand Down
48 changes: 24 additions & 24 deletions crates/arithmetic/src/i32.rs
Original file line number Diff line number Diff line change
Expand Up @@ -132,106 +132,106 @@ mod tests {
Int32ArrayGPU,
Int32ArrayGPU,
Int32ArrayGPU,
vec![0, 1, 2, 3, 4],
[0, 1, 2, 3, 4],
add_scalar,
add_scalar_dyn,
100i32,
vec![100, 101, 102, 103, 104]
[100, 101, 102, 103, 104]
);

test_scalar_op!(
test_sub_i32_scalar_i32,
Int32ArrayGPU,
Int32ArrayGPU,
Int32ArrayGPU,
vec![0, 100, 200, 3, 104],
[0, 100, 200, 3, 104],
sub_scalar,
sub_scalar_dyn,
100,
vec![-100, 0, 100, -97, 4]
[-100, 0, 100, -97, 4]
);

test_scalar_op!(
test_mul_i32_scalar_i32,
Int32ArrayGPU,
Int32ArrayGPU,
Int32ArrayGPU,
vec![0, i32::MAX, 2, 3, 4],
[0, i32::MAX, 2, 3, 4],
mul_scalar,
mul_scalar_dyn,
100,
vec![0, -100, 200, 300, 400]
[0, -100, 200, 300, 400]
);

test_scalar_op!(
test_div_i32_scalar_i32,
Int32ArrayGPU,
Int32ArrayGPU,
Int32ArrayGPU,
vec![0, 1, 100, 260, 450],
[0, 1, 100, 260, 450],
div_scalar,
div_scalar_dyn,
100,
vec![0, 0, 1, 2, 4]
[0, 0, 1, 2, 4]
);

test_scalar_op!(
test_rem_i32_scalar_i32,
Int32ArrayGPU,
Int32ArrayGPU,
Int32ArrayGPU,
vec![0, 1, 2, 3, 104],
[0, 1, 2, 3, 104],
rem_scalar,
rem_scalar_dyn,
100i32,
vec![0, 1, 2, 3, 4]
[0, 1, 2, 3, 4]
);

test_scalar_op!(
test_rem_i32_scalar_date32,
Int32ArrayGPU,
Date32ArrayGPU,
Int32ArrayGPU,
vec![0, 1, 2, 3, 104],
[0, 1, 2, 3, 104],
rem_scalar,
rem_scalar_dyn,
100i32,
vec![0, 1, 2, 3, 4]
[0, 1, 2, 3, 4]
);

/*//ignore = "Not passing in linux CI but passes in windows 🤔"
#[cfg(not(target_os = "linux"))]
test_scalar_op!(
test_div_by_zero_i32_scalar_i32,
i32,
vec![0, 1, 100, 260, 450],
[0, 1, 100, 260, 450],
div_scalar,
0,
vec![-1; 5]
[-1; 5]
);*/

test_scalar_op!(
test_rem_date32_scalar_i32,
Date32ArrayGPU,
Int32ArrayGPU,
Date32ArrayGPU,
vec![0, 1, 2, 3, 104],
[0, 1, 2, 3, 104],
rem_scalar,
rem_scalar_dyn,
100i32,
vec![0, 1, 2, 3, 4]
[0, 1, 2, 3, 4]
);

test_scalar_op!(
test_rem_date32_scalar_date32,
Date32ArrayGPU,
Date32ArrayGPU,
Date32ArrayGPU,
vec![0, 1, 2, 3, 104],
[0, 1, 2, 3, 104],
rem_scalar,
rem_scalar_dyn,
100i32,
vec![0, 1, 2, 3, 4]
[0, 1, 2, 3, 4]
);

test_array_op!(
Expand All @@ -240,9 +240,9 @@ mod tests {
Int32ArrayGPU,
Int32ArrayGPU,
add,
vec![Some(0i32), Some(1), None, None, Some(4)],
vec![Some(1i32), Some(2), None, Some(4), None],
vec![Some(1), Some(3), None, None, None]
[Some(0i32), Some(1), None, None, Some(4)],
[Some(1i32), Some(2), None, Some(4), None],
[Some(1), Some(3), None, None, None]
);

test_array_op!(
Expand All @@ -251,9 +251,9 @@ mod tests {
Date32ArrayGPU,
Date32ArrayGPU,
add,
vec![Some(0i32), Some(1), None, None, Some(4)],
vec![Some(1i32), Some(2), None, Some(4), None],
vec![Some(1), Some(3), None, None, None]
[Some(0i32), Some(1), None, None, Some(4)],
[Some(1i32), Some(2), None, Some(4), None],
[Some(1), Some(3), None, None, None]
);

test_sum!(
Expand Down
4 changes: 2 additions & 2 deletions crates/arithmetic/src/u16.rs
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,10 @@ mod test {
UInt16ArrayGPU,
UInt16ArrayGPU,
UInt16ArrayGPU,
vec![0, 1, 2, 3, 4],
[0, 1, 2, 3, 4],
add_scalar,
add_scalar_dyn,
100u16,
vec![100, 101, 102, 103, 104]
[100, 101, 102, 103, 104]
);
}
Loading

0 comments on commit 4e3d054

Please sign in to comment.