Skip to content

Commit

Permalink
TEST: Layout benchmarks for the i32 kernel too
Browse files Browse the repository at this point in the history
Results shows the same information we know from packing from the other
implementations (the packing is all shared code and doesn't care about
the element. Only element size and kernel size).

running 8 tests
test layout_i32_032::ccc ... bench:       6,012 ns/iter (+/- 80)
test layout_i32_032::ccf ... bench:       6,010 ns/iter (+/- 68)
test layout_i32_032::cfc ... bench:       6,244 ns/iter (+/- 89)
test layout_i32_032::cff ... bench:       6,257 ns/iter (+/- 240)
test layout_i32_032::fcc ... bench:       5,806 ns/iter (+/- 320)
test layout_i32_032::fcf ... bench:       5,767 ns/iter (+/- 2,013)
test layout_i32_032::ffc ... bench:       6,005 ns/iter (+/- 187)
test layout_i32_032::fff ... bench:       6,031 ns/iter (+/- 187)
  • Loading branch information
bluss committed Nov 27, 2018
1 parent 8dca019 commit 6006cc3
Showing 1 changed file with 11 additions and 6 deletions.
17 changes: 11 additions & 6 deletions benches/benchmarks.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,10 @@ extern crate bencher;
benchmark_main!(
mat_mul_f32,
mat_mul_f64,
mat_mul_i32,
layout_f32_032,
layout_f64_032,
mat_mul_i32
layout_i32_032
);

macro_rules! mat_mul {
Expand Down Expand Up @@ -113,20 +114,20 @@ macro_rules! gemm_layout {

fn base(bench: &mut Bencher, al: Layout, bl: Layout, cl: Layout)
{
let a = vec![0.; $m * $m];
let b = vec![0.; $m * $m];
let mut c = vec![0.; $m * $m];
let a = vec![0 as _; $m * $m];
let b = vec![0 as _; $m * $m];
let mut c = vec![0 as _; $m * $m];
let (rsa, csa) = al.strides($m, 1);
let (rsb, csb) = bl.strides($m, 1);
let (rsc, csc) = cl.strides($m, 1);
bench.iter(|| {
unsafe {
$gemm(
$m, $m, $m,
1.,
1 as _,
a.as_ptr(), rsa, csa,
b.as_ptr(), rsb, csb,
0.,
0 as _,
c.as_mut_ptr(), rsc, csc,
)
}
Expand Down Expand Up @@ -164,6 +165,10 @@ gemm_layout!{layout_f64_032, dgemm,
(m032, 32)
}

gemm_layout!{layout_i32_032, igemm,
(m032, 32)
}


use std::ops::{Add, Mul};

Expand Down

0 comments on commit 6006cc3

Please sign in to comment.