Skip to content

Commit

Permalink
Add the new benchmarks to the unit test suite.
Browse files Browse the repository at this point in the history
  • Loading branch information
axch committed Sep 6, 2022
1 parent 3e8795d commit 08c91ed
Show file tree
Hide file tree
Showing 9 changed files with 35 additions and 1 deletion.
4 changes: 4 additions & 0 deletions benchmarks/gaussian.dx
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,7 @@ n = if dex_test_mode() then 100 else 1000 * 1000

%bench "Gaussian"
res = rand_vec n randn (new_key 0)
>
> Gaussian
> Compile time: 40.102 ms
> Run time: 8.517 us (based on 1 run)
4 changes: 4 additions & 0 deletions benchmarks/jvp_matmul.dx
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,7 @@ def mmp' {l m n} (m1:l=>m=>Float) (m2:m=>n=>Float) : l=>n=>Float =

%bench "jvp_matmul"
res = mmp' m1 m2
>
> jvp_matmul
> Compile time: 82.255 ms
> Run time: 7.298 us (based on 1 run)
4 changes: 4 additions & 0 deletions benchmarks/matmul_big.dx
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,7 @@ m2 = rand_mat n n randn (new_key 1)

%bench "matmul_big"
res = m1 ** m2
>
> matmul_big
> Compile time: 27.431 ms
> Run time: 4.406 us (based on 1 run)
4 changes: 4 additions & 0 deletions benchmarks/matmul_small.dx
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,8 @@ m2 = for i:(Fin width). rand_mat n n randn (new_key 1)

%bench "matmul_small"
res = for i. (m1.i ** m2.i)
>
> matmul_small
> Compile time: 33.241 ms
> Run time: 358.211 us (based on 1 run)

4 changes: 4 additions & 0 deletions benchmarks/matvec_big.dx
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,7 @@ v = rand_vec n randn (new_key 1)

%bench "matvec_big"
res = m **. v
>
> matvec_big
> Compile time: 23.898 ms
> Run time: 4.682 us (based on 1 run)
4 changes: 4 additions & 0 deletions benchmarks/matvec_small.dx
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,7 @@ vs = for i:(Fin width). rand_vec n randn (new_key 1)

%bench "matvec_small"
res = for i. ms.i **. vs.i
>
> matvec_small
> Compile time: 29.506 ms
> Run time: 387.630 us (based on 1 run)
4 changes: 4 additions & 0 deletions benchmarks/poly.dx
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,7 @@ a = for i:(Fin n). n_to_f $ ordinal i

%bench "poly"
res = poly a
>
> poly
> Compile time: 44.950 ms
> Run time: 11.224 us (based on 1 run)
4 changes: 4 additions & 0 deletions benchmarks/vjp_matmul.dx
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,7 @@ def mmp' {l m n} (m1:l=>m=>Float) (m2:m=>n=>Float) : l=>n=>Float =

%bench "jvp_matmul"
res = mmp' m1 m2
>
> jvp_matmul
> Compile time: 130.231 ms
> Run time: 7.178 us (based on 1 run)
4 changes: 3 additions & 1 deletion makefile
Original file line number Diff line number Diff line change
Expand Up @@ -216,7 +216,9 @@ test-names = uexpr-tests adt-tests type-tests eval-tests show-tests read-tests \

doc-names = conditionals functions

benchmark-names = fused_sum
benchmark-names = \
fused_sum gaussian jvp_matmul matmul_big matmul_small matvec_big matvec_small \
poly vjp_matmul

quine-test-targets = \
$(test-names:%=run-tests/%) \
Expand Down

0 comments on commit 08c91ed

Please sign in to comment.