@@ -5,27 +5,68 @@ using Boltz, Lux, Random
5
5
6
6
const SUITE = BenchmarkGroup ()
7
7
8
+ SUITE[" runtime" ] = BenchmarkGroup ()
8
9
SUITE[" comptime" ] = BenchmarkGroup ()
9
10
10
11
SUITE[" comptime" ][" basics" ] = BenchmarkGroup ()
11
12
SUITE[" comptime" ][" basics" ][" 2D sum" ] = @benchmarkable Reactant. compile (sum, (a,)) setup = (
12
13
a = Reactant. ConcreteRArray (ones (2 , 10 ))
13
14
)
14
- SUITE[" comptime" ][" basics" ][" Basic cos" ] = @benchmarkable Reactant. compile (cos, (a,)) setup = (
15
+
16
+ bcast_cos (x) = cos .(x)
17
+
18
+ SUITE[" comptime" ][" basics" ][" cos.(x)" ] = @benchmarkable begin
19
+ Reactant. compile (bcast_cos, (a,))
20
+ end setup = begin
15
21
a = Reactant. ConcreteRArray (ones (2 , 10 ))
16
- )
22
+ end
17
23
24
+ SUITE[" runtime" ][" lux neural networks" ] = BenchmarkGroup ()
18
25
SUITE[" comptime" ][" lux neural networks" ] = BenchmarkGroup ()
19
26
20
- for depth in [11 , 13 , 16 , 19 ]
21
- SUITE[" comptime" ][" lux neural networks" ][" vgg$depth " ] = @benchmarkable Reactant. compile (
22
- vgg, (x, ps_concrete, st_concrete)
23
- ) setup = begin
24
- vgg = Vision. VGG ($ depth; pretrained= false , batchnorm= false )
27
+ for depth in [11 , 13 , 16 , 19 ], batchnorm in [false ]# true] <-- not working yet
28
+ SUITE[" comptime" ][" lux neural networks" ][" vgg$(depth) bn=$(batchnorm) " ] = @benchmarkable begin
29
+ @compile vgg (x, ps_concrete, st_concrete)
30
+ end setup = begin
31
+ vgg = Vision. VGG ($ depth; pretrained= false , batchnorm= $ (batchnorm))
32
+ ps, st = Lux. setup (Random. default_rng (), vgg)
33
+ ps_concrete = Reactant. to_rarray (ps)
34
+ st_concrete = Reactant. to_rarray (Lux. testmode (st))
35
+ x = Reactant. to_rarray (rand (Float32, 224 , 224 , 3 , 16 ))
36
+ end
37
+
38
+ SUITE[" runtime" ][" lux neural networks" ][" vgg$(depth) bn=$(batchnorm) (compiled)" ] = @benchmarkable begin
39
+ vgg_compiled (x, ps_concrete, st_concrete)
40
+ end setup = begin
41
+ vgg = Vision. VGG ($ depth; pretrained= false , batchnorm= $ (batchnorm))
25
42
ps, st = Lux. setup (Random. default_rng (), vgg)
26
43
ps_concrete = Reactant. to_rarray (ps)
27
44
st_concrete = Reactant. to_rarray (Lux. testmode (st))
28
45
x = Reactant. to_rarray (rand (Float32, 224 , 224 , 3 , 16 ))
46
+ vgg_compiled = @compile vgg (x, ps_concrete, st_concrete)
47
+ end
48
+ end
49
+
50
+ for version in (:tiny , :base )
51
+ SUITE[" comptime" ][" lux neural networks" ][" ViT $(version) " ] = @benchmarkable begin
52
+ @compile vit (x, ps_concrete, st_concrete)
53
+ end setup = begin
54
+ vit = Vision. ViT ($ (Meta. quot (version)))
55
+ ps, st = Lux. setup (Random. default_rng (), vit)
56
+ ps_concrete = Reactant. to_rarray (ps)
57
+ st_concrete = Reactant. to_rarray (Lux. testmode (st))
58
+ x = Reactant. to_rarray (rand (Float32, 256 , 256 , 3 , 16 ))
59
+ end
60
+
61
+ SUITE[" runtime" ][" lux neural networks" ][" ViT $(version) (compiled)" ] = @benchmarkable begin
62
+ vit_compiled (x, ps_concrete, st_concrete)
63
+ end setup = begin
64
+ vit = Vision. ViT ($ (Meta. quot (version)))
65
+ ps, st = Lux. setup (Random. default_rng (), vit)
66
+ ps_concrete = Reactant. to_rarray (ps)
67
+ st_concrete = Reactant. to_rarray (Lux. testmode (st))
68
+ x = Reactant. to_rarray (rand (Float32, 256 , 256 , 3 , 16 ))
69
+ vit_compiled = @compile vit (x, ps_concrete, st_concrete)
29
70
end
30
71
end
31
72
0 commit comments