Skip to content
Snippets Groups Projects

Set up cava benchmark

Merged rarbore2 requested to merge cava_opt_3 into main
3 files
+ 11
13
Compare changes
  • Side-by-side
  • Inline
Files
3
@@ -10,7 +10,7 @@ juno_build::juno!("matmul");
@@ -10,7 +10,7 @@ juno_build::juno!("matmul");
fn main() {
fn main() {
async_std::task::block_on(async {
async_std::task::block_on(async {
const I: usize = 256;
const I: usize = 256;
const J: usize = 8; // hardcoded constant in matmul.hir
const J: usize = 64;
const K: usize = 128;
const K: usize = 128;
let a: Box<[f32]> = (0..I * J).map(|_| random::<f32>()).collect();
let a: Box<[f32]> = (0..I * J).map(|_| random::<f32>()).collect();
let b: Box<[f32]> = (0..J * K).map(|_| random::<f32>()).collect();
let b: Box<[f32]> = (0..J * K).map(|_| random::<f32>()).collect();
@@ -22,8 +22,8 @@ fn main() {
@@ -22,8 +22,8 @@ fn main() {
}
}
}
}
}
}
let a = HerculesImmBox::from(&a as &[f32]);
let a = HerculesImmBox::from(a.as_ref());
let b = HerculesImmBox::from(&b as &[f32]);
let b = HerculesImmBox::from(b.as_ref());
let mut r = runner!(matmul);
let mut r = runner!(matmul);
let mut c = HerculesMutBox::from(r.run(I as u64, J as u64, K as u64, a.to(), b.to()).await);
let mut c = HerculesMutBox::from(r.run(I as u64, J as u64, K as u64, a.to(), b.to()).await);
for (calc, correct) in zip(c.as_slice().into_iter().map(|x: &mut f32| *x), correct_c) {
for (calc, correct) in zip(c.as_slice().into_iter().map(|x: &mut f32| *x), correct_c) {
Loading