Skip to content

Commit 971cbe2

Browse files
committed
ci: add runtime benchmarking to CI (and ViT)
1 parent f1547db commit 971cbe2

File tree

3 files changed

+41
-38
lines changed

3 files changed

+41
-38
lines changed

benchmark/Project.toml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@ BenchmarkTools = "6e4b80f9-dd63-53aa-95a3-0cdb28fa8baf"
33
Boltz = "4544d5e4-abc5-4dea-817f-29e4c205d9c8"
44
Enzyme = "7da242da-08ed-463a-9acd-ee780be4f1d9"
55
Lux = "b2108857-7c20-44ae-9111-449ecde12c47"
6-
LuxCUDA = "d0bbae9a-e099-4d5b-a835-1c6931763bda"
76
Random = "9a3f8284-a2c9-5f02-9a11-845980a1fd5c"
87
Reactant = "3c362404-f566-11ee-1572-e11a4b42c853"
98

benchmark/benchmarks.jl

Lines changed: 41 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ using Boltz, Lux, Random
55

66
const SUITE = BenchmarkGroup()
77

8+
SUITE["runtime"] = BenchmarkGroup()
89
SUITE["comptime"] = BenchmarkGroup()
910

1011
SUITE["comptime"]["basics"] = BenchmarkGroup()
@@ -20,18 +21,53 @@ end setup = begin
2021
a = Reactant.ConcreteRArray(ones(2, 10))
2122
end
2223

24+
SUITE["runtime"]["lux neural networks"] = BenchmarkGroup()
2325
SUITE["comptime"]["lux neural networks"] = BenchmarkGroup()
2426

25-
for depth in [11, 13, 16, 19]
26-
SUITE["comptime"]["lux neural networks"]["vgg$depth"] = @benchmarkable Reactant.compile(
27-
vgg, (x, ps_concrete, st_concrete)
28-
) setup = begin
29-
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))
3032
ps, st = Lux.setup(Random.default_rng(), vgg)
3133
ps_concrete = Reactant.to_rarray(ps)
3234
st_concrete = Reactant.to_rarray(Lux.testmode(st))
3335
x = Reactant.to_rarray(rand(Float32, 224, 224, 3, 16))
3436
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))
42+
ps, st = Lux.setup(Random.default_rng(), vgg)
43+
ps_concrete = Reactant.to_rarray(ps)
44+
st_concrete = Reactant.to_rarray(Lux.testmode(st))
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)
70+
end
3571
end
3672

3773
function sumcos(x)

benchmark/vit.jl

Lines changed: 0 additions & 32 deletions
This file was deleted.

0 commit comments

Comments
 (0)