@@ -5,27 +5,68 @@ using Boltz, Lux, Random
55
66const SUITE = BenchmarkGroup ()
77
8+ SUITE[" runtime" ] = BenchmarkGroup ()
89SUITE[" comptime" ] = BenchmarkGroup ()
910
1011SUITE[" comptime" ][" basics" ] = BenchmarkGroup ()
1112SUITE[" comptime" ][" basics" ][" 2D sum" ] = @benchmarkable Reactant. compile (sum, (a,)) setup = (
1213 a = Reactant. ConcreteRArray (ones (2 , 10 ))
1314)
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
1521 a = Reactant. ConcreteRArray (ones (2 , 10 ))
16- )
22+ end
1723
24+ SUITE[" runtime" ][" lux neural networks" ] = BenchmarkGroup ()
1825SUITE[" comptime" ][" lux neural networks" ] = BenchmarkGroup ()
1926
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))
2542 ps, st = Lux. setup (Random. default_rng (), vgg)
2643 ps_concrete = Reactant. to_rarray (ps)
2744 st_concrete = Reactant. to_rarray (Lux. testmode (st))
2845 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)
2970 end
3071end
3172
0 commit comments