diff --git a/benchmark/gendoc.sh b/benchmark/gendoc.sh index 76b37d3..1f4525e 100755 --- a/benchmark/gendoc.sh +++ b/benchmark/gendoc.sh @@ -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 diff --git a/benchmark/matmul.fs b/benchmark/matmul.fs new file mode 100644 index 0000000..080c8fa --- /dev/null +++ b/benchmark/matmul.fs @@ -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