aboutsummaryrefslogtreecommitdiff
path: root/bench
diff options
context:
space:
mode:
authorTom Smeding <t.j.smeding@uu.nl>2024-06-10 16:22:11 +0200
committerTom Smeding <t.j.smeding@uu.nl>2024-06-10 16:22:11 +0200
commitc6ac2b69e15ff09622ac2bbc40ede8331866a559 (patch)
tree9b9386b135c55a7bfa37864d03586ac9fe1b2c5d /bench
parentbb1e1fcd1b0f47747623f1497a4f4ae0f7a2a62d (diff)
Manual vectorisation of dot product for floating points
Diffstat (limited to 'bench')
-rw-r--r--bench/Main.hs13
1 files changed, 13 insertions, 0 deletions
diff --git a/bench/Main.hs b/bench/Main.hs
index eb3c6d7..cc4e11f 100644
--- a/bench/Main.hs
+++ b/bench/Main.hs
@@ -65,6 +65,14 @@ main = defaultMain
let n = 1_000_000
in nf (\a -> runScalar (rsumOuter1 a))
(riota @Double n)
+ ,bench "dotprod Float [1e6]" $
+ let n = 1_000_000
+ in nf (\(a, b) -> rdot a b)
+ (riota @Float n, riota @Float n)
+ ,bench "dotprod Float [1e6] stride 1; -1" $
+ let n = 1_000_000
+ in nf (\(a, b) -> rdot a b)
+ (riota @Float n, rrev1 (riota @Float n))
,bench "dotprod Double [1e6]" $
let n = 1_000_000
in nf (\(a, b) -> rdot a b)
@@ -103,6 +111,11 @@ main = defaultMain
let n = 1_000_000
in nf (\a -> LA.sumElements a)
(LA.linspace @Double n (0.0, fromIntegral (n - 1)))
+ ,bench "dotprod Float [1e6]" $
+ let n = 1_000_000
+ in nf (\(a, b) -> a LA.<.> b)
+ (LA.linspace @Double n (0.0, fromIntegral (n - 1))
+ ,LA.linspace @Double n (fromIntegral (n - 1), 0.0))
,bench "dotprod Double [1e6]" $
let n = 1_000_000
in nf (\(a, b) -> a LA.<.> b)