File tree Expand file tree Collapse file tree 1 file changed +33
-0
lines changed Expand file tree Collapse file tree 1 file changed +33
-0
lines changed Original file line number Diff line number Diff line change @@ -32,3 +32,36 @@ x = MyStruct(1.0, zeros(3))
3232
3333SUITE[" basics" ][" make_zero" ][" struct" ] = @benchmarkable Enzyme. make_zero ($ x)
3434SUITE[" basics" ][" remake_zero!" ][" struct" ] = @benchmarkable Enzyme. remake_zero! (dx) setup = (dx = Enzyme. make_zero (x))
35+
36+
37+
38+ @noinline function sass (σ, x)
39+ z = σ / x
40+ return z
41+ end
42+
43+ @noinline function multidim_sum_bcast0 (dist, x, res)
44+ broadcasted = Broadcast. broadcasted (sass, dist, x)
45+ lp = sum (Broadcast. instantiate (broadcasted))
46+ res[] = lp
47+ nothing
48+ end
49+
50+ function multidim_sum_bcast (dist, y)
51+ tmp = Ref {Float64} (0.0 )
52+ multidim_sum_bcast0 (dist, y, tmp)
53+ return tmp[]:: Float64
54+ end
55+
56+
57+ y1d = rand (10 , 40 );
58+ dist1d = fill (10.0 , 40 );
59+
60+ SUITE[" fold_broadcast" ][" multidim_sum_bcast" ][" 1D" ] = @benchmarkable multidim_sum_bcast ($ dist1d, $ y1d)
61+
62+ y2d = rand (10 , 4 );
63+ dist2d = fill (10.0 , 10 , 4 );
64+
65+ SUITE[" fold_broadcast" ][" multidim_sum_bcast" ][" 2D" ] = @benchmarkable multidim_sum_bcast ($ dist2d, $ y2d)
66+
67+
You can’t perform that action at this time.
0 commit comments