Skip to content

Commit 6f86670

Browse files
penelopeysmwsmoses
andauthored
add Enzyme benchmarks and incorporate some CompatHelper bits (#1056)
* Add Enzyme to benchmark tests * Add compat entries, format * restrict to smorgasbord for now * add enzyme to the correct env --------- Co-authored-by: William Moses <[email protected]>
1 parent fcdfe03 commit 6f86670

File tree

5 files changed

+10
-1
lines changed

5 files changed

+10
-1
lines changed

benchmarks/Project.toml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ ADTypes = "47edcb42-4c32-4615-8424-f2b9edc5f35b"
77
BenchmarkTools = "6e4b80f9-dd63-53aa-95a3-0cdb28fa8baf"
88
Distributions = "31c24e10-a181-5473-b8eb-7969acd0382f"
99
DynamicPPL = "366bfd00-2699-11ea-058f-f148b4cae6d8"
10+
Enzyme = "7da242da-08ed-463a-9acd-ee780be4f1d9"
1011
ForwardDiff = "f6369f11-7733-5829-9624-2563aa707210"
1112
LinearAlgebra = "37e2e46d-f89d-539d-b4ee-838fcccc9c8e"
1213
LogDensityProblems = "6fdf6af0-433a-55f7-b3ed-c6c6e0b8df7c"
@@ -23,6 +24,7 @@ ADTypes = "1.14.0"
2324
BenchmarkTools = "1.6.0"
2425
Distributions = "0.25.117"
2526
DynamicPPL = "0.37"
27+
Enzyme = "0.13"
2628
ForwardDiff = "0.10.38, 1"
2729
LogDensityProblems = "2.1.2"
2830
Mooncake = "0.4"

benchmarks/benchmarks.jl

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@ chosen_combinations = [
4343
("Smorgasbord", smorgasbord_instance, :simple_dict, :forwarddiff, true),
4444
("Smorgasbord", smorgasbord_instance, :typed, :reversediff, true),
4545
("Smorgasbord", smorgasbord_instance, :typed, :mooncake, true),
46+
("Smorgasbord", smorgasbord_instance, :typed, :enzyme, true),
4647
("Loop univariate 1k", loop_univariate1k, :typed, :mooncake, true),
4748
("Multivariate 1k", multivariate1k, :typed, :mooncake, true),
4849
("Loop univariate 10k", loop_univariate10k, :typed, :mooncake, true),

benchmarks/src/DynamicPPLBenchmarks.jl

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ using StableRNGs: StableRNG
1313

1414
include("./Models.jl")
1515
using .Models: Models
16-
16+
using Enzyme: Enzyme
1717
export Models, make_suite, model_dimension
1818

1919
"""
@@ -37,6 +37,10 @@ const SYMBOL_TO_BACKEND = Dict(
3737
:reversediff => ADTypes.AutoReverseDiff(; compile=false),
3838
:reversediff_compiled => ADTypes.AutoReverseDiff(; compile=true),
3939
:mooncake => ADTypes.AutoMooncake(; config=nothing),
40+
:enzyme => ADTypes.AutoEnzyme(;
41+
mode=Enzyme.set_runtime_activity(Enzyme.Reverse),
42+
function_annotation=Enzyme.Const,
43+
),
4044
)
4145

4246
to_backend(x) = error("Unknown backend: $x")

docs/Project.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,5 +24,6 @@ FillArrays = "0.13, 1"
2424
ForwardDiff = "0.10, 1"
2525
JET = "0.9, 0.10"
2626
LogDensityProblems = "2"
27+
MarginalLogDensities = "0.4"
2728
MCMCChains = "5, 6, 7"
2829
StableRNGs = "1"

test/Project.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@ EnzymeCore = "0.6 - 0.8"
4444
ForwardDiff = "0.10.12, 1"
4545
JET = "0.9 - 0.10.6"
4646
LogDensityProblems = "2"
47+
MarginalLogDensities = "0.4"
4748
MCMCChains = "7.2.1"
4849
MacroTools = "0.5.6"
4950
OrderedCollections = "1"

0 commit comments

Comments
 (0)