Add benchmark/matmul.fs

This commit is contained in:
Koichi Nakamura 2021-01-11 21:03:56 +09:00
parent cfc1cb81a0
commit dfffc47d16
2 changed files with 34 additions and 0 deletions

View file

@ -44,3 +44,4 @@ echo "# Benchmarks"
generate-table "Bootstrap Time" "./planck < bootstrap.fs benchmark/nop.fs" 1
generate-table "Fib(30)" "./planck < bootstrap.fs benchmark/fib.fs" 1
generate-table "Matmul" "./planck < bootstrap.fs benchmark/matmul.fs" 1

33
benchmark/matmul.fs Normal file
View file

@ -0,0 +1,33 @@
60 constant M
90 constant K
60 constant N
M K * cells allocate throw constant mat1
K N * cells allocate throw constant mat2
M N * cells allocate throw constant mat3
:noname
M 0 do
K 0 do
i j + 1+ mat1 K j * i + cells + !
loop
loop
K 0 do
N 0 do
i j + 1+ mat2 N j * i + cells + !
loop
loop
M 0 do
N 0 do
0
K 0 do
mat1 K k * i + cells + @
mat2 N i * j + cells + @
* +
loop
mat3 N i * j + cells + !
loop
loop
; execute