Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
294 commits
Select commit Hold shift + click to select a range
38662a8
Fix API docs
mhauru Nov 27, 2025
e41afca
Fix a bug and a docstring
mhauru Nov 27, 2025
8c50bbb
Apply suggestions from code review
mhauru Nov 28, 2025
cae8864
Fix VNT docs
mhauru Nov 28, 2025
c27f5e0
Make threadsafe evaluation opt-in (#1151)
penelopeysm Dec 1, 2025
993cc5b
Merge remote-tracking branch 'origin/main' into breaking
penelopeysm Dec 1, 2025
54ae7e3
Standardise `:lp` -> `:logjoint` (#1161)
penelopeysm Dec 1, 2025
1bb97ae
Bump minor version to 0.40
mhauru Dec 3, 2025
6012b11
Merge branch 'tmp2' into mhauru/vnt-for-fastldf
mhauru Dec 3, 2025
f114e40
Merge commit 'ee863d6' into mhauru/vnt-for-fastldf
mhauru Dec 3, 2025
bccfdf0
Merge branch 'breaking' into mhauru/vnt-for-fastldf
mhauru Dec 3, 2025
384e3ac
Apply suggestions from code review
mhauru Dec 3, 2025
9d61a54
Add a microoptimisation
mhauru Dec 3, 2025
8c8e39f
Improve docstrings
mhauru Dec 3, 2025
c818bf8
Simplify use of QuoteNodes
mhauru Dec 3, 2025
3c02da4
Improve equality tests
mhauru Dec 11, 2025
35c3e20
ArrayLikeBlock WIP
mhauru Dec 11, 2025
4253e9b
ArrayLikeBlock WIP2
mhauru Dec 12, 2025
5cb3916
Improve type stability of ArrayLikeBlock stuff
mhauru Dec 12, 2025
a96bb44
Test more invariants
mhauru Dec 15, 2025
a8014e6
Actually run VNT tests
mhauru Dec 15, 2025
cfc6041
Implement show for ArrayLikeBlock
mhauru Dec 15, 2025
e198fbb
Change keys on VNT to return an array
mhauru Dec 15, 2025
b77b0af
Fix keys and some tests for PartialArray
mhauru Dec 15, 2025
633e920
Improve type stability
mhauru Dec 15, 2025
222334a
Fix keys for PartialArray
mhauru Dec 15, 2025
d22face
More ArrayLikeBlock tests
mhauru Dec 15, 2025
4cb49e1
Add docstrings
mhauru Dec 15, 2025
420a6b2
Remove redundant code, improve documentation
mhauru Dec 15, 2025
62e0da8
Merge remote-tracking branch 'origin/main' into breaking
mhauru Dec 15, 2025
44be19d
Merge branch 'breaking' into mhauru/vnt-for-fastldf
mhauru Dec 15, 2025
d2f58d7
Merge branch 'mhauru/vnt-for-fastldf' into mhauru/arraylikeblock
mhauru Dec 15, 2025
ce9da19
Add Base.size(::RangeAndLinked)
mhauru Dec 15, 2025
4eb33e9
Fix issues with RangeAndLinked and VNT
mhauru Dec 15, 2025
51b399a
Write more design doc for ArrayLikeBlocks
mhauru Dec 15, 2025
57fd11a
Make VNT support concretized slices
mhauru Dec 16, 2025
7bdce5c
Start the VNT HISTORY.md entry
mhauru Dec 16, 2025
9992051
Skip a type stability test on 1.10
mhauru Dec 16, 2025
753ca81
Fix test_skip
mhauru Dec 16, 2025
34c42af
Change Base.keys on PartialArrays to be more type stable
mhauru Dec 1, 2025
262e303
Implement Base.values for VNT
mhauru Dec 1, 2025
1f2cd8b
Implement isempty and empty for VNT
mhauru Dec 1, 2025
1debab1
Use VNT in VAIMAcc
mhauru Dec 1, 2025
1db910c
WIP implementation of empty!! for VNT
mhauru Dec 3, 2025
b02d014
Make to_samples use VNT and fix related tests
mhauru Dec 17, 2025
ea807fc
Add hasvalue and getvalue to VNT
mhauru Dec 17, 2025
f2d0c33
Improve keys and values for VNT
mhauru Dec 17, 2025
086fd7c
Add length and _to_dense_array for VNT
mhauru Dec 17, 2025
e98b0e8
Fix empty and friends for VNT, add tests
mhauru Dec 17, 2025
07bf11f
Add tests of VNT densification
mhauru Dec 17, 2025
852609d
Fix some comments
mhauru Dec 17, 2025
4a585ad
Apply polish
mhauru Dec 17, 2025
34ad663
Fix and improve map!! and apply!!
mhauru Dec 18, 2025
dc6291d
mapreduce and nested PartialArrays
mhauru Dec 18, 2025
20ed575
Test invariants more
mhauru Dec 18, 2025
477b715
Work-in-progress VNTVarInfo
mhauru Dec 18, 2025
7aa6013
Fix a bug in link
mhauru Dec 18, 2025
d9e5405
Mark a test as broken on 1.10
mhauru Dec 19, 2025
05dd3af
Fix hasvalue and getvalue for VNT
mhauru Dec 19, 2025
267c554
Trivial bug fix
mhauru Dec 19, 2025
6a4c148
Merge branch 'mhauru/vnt-concretized-slices' into mhauru/vnt-for-vaimacc
mhauru Dec 19, 2025
76ac5b6
Use skip rather than broken for an inference test
mhauru Dec 19, 2025
c917266
Merge branch 'mhauru/vnt-concretized-slices' into mhauru/vnt-for-vaimacc
mhauru Dec 19, 2025
9ae56ab
Merge branch 'mhauru/vnt-for-vaimacc' into mhauru/vnt-for-varinfo
mhauru Dec 19, 2025
f3f866b
Merge branch 'main' into breaking
penelopeysm Jan 2, 2026
0c50bd7
Fix a docs typo
mhauru Jan 6, 2026
6b211b1
Use floatmin in test_utils
mhauru Jan 6, 2026
57fd84b
Narrow a skip clause
mhauru Jan 6, 2026
345b605
Use vnt_size instead of Base.size
mhauru Jan 6, 2026
4f12e99
Bugfix
mhauru Jan 6, 2026
60b2399
Style improvements
mhauru Jan 6, 2026
e603229
Remove to_dict on VNT
mhauru Jan 6, 2026
21ba31d
Remove unneeded Union
penelopeysm Jan 6, 2026
bb22bc3
Merge branch 'mhauru/vnt-for-vaimacc' into mhauru/vnt-for-fastldf
mhauru Jan 7, 2026
cacd426
Add vnt_size docstring to API docs
mhauru Jan 7, 2026
a848290
Merge branch 'mhauru/vnt-vntsize' into mhauru/vnt-for-fastldf
mhauru Jan 7, 2026
bdeeb4a
Update map!! to operate on pairs
mhauru Jan 8, 2026
5498d82
Split map!! into map_pairs!! and map_values!!, fix some bugs
mhauru Jan 8, 2026
81be716
Make mapreduce operate on pairs
mhauru Jan 8, 2026
37f4adf
Implement keys and values using mapreduce
mhauru Jan 8, 2026
fc29cc6
Add more VNT constructors
mhauru Jan 9, 2026
c6d0677
Add VNT subset
mhauru Jan 9, 2026
c18258c
Make _compose_no_identity handle typed_identity too
mhauru Jan 9, 2026
b91e6ff
Myriad improvements to VNTVarInfo, overhaul varinfo.jl tests to use V…
mhauru Jan 9, 2026
4b1a8f5
Merge remote-tracking branch 'origin/mhauru/vnt-for-fastldf' into mha…
mhauru Jan 9, 2026
8018f45
Fix a couple of ArrayLikeBlock bugs
mhauru Jan 9, 2026
1cbcda7
Fix PartialArray map bug
mhauru Jan 9, 2026
573cd5a
In VNTVarInfo, handle variables with varying dimensions correctly
mhauru Jan 9, 2026
c353cbc
Fix two small bugs
mhauru Jan 9, 2026
a36bb15
Allow nested PartialArrays with ArrayLikeBlocks
mhauru Jan 9, 2026
bf05554
Stop testing for NamedDist with unconcrete VarName
mhauru Jan 9, 2026
7857eae
Misc bugfixes
mhauru Jan 9, 2026
16fe150
Stop running SVI and VNT tests
mhauru Jan 9, 2026
51a518f
Fix LDF bug
mhauru Jan 12, 2026
1950a93
Fix some bugs, simplify (inv)linking
mhauru Jan 12, 2026
051521a
Fix some tests
mhauru Jan 12, 2026
9812ad0
Comment back in include of old VI files
mhauru Jan 12, 2026
6d44954
Remote JET extension and experimental.jl
mhauru Jan 12, 2026
d5bfa2c
Reimplement bijector.jl
mhauru Jan 12, 2026
eb903e1
Move linking code to VarInfo, fix ProductNamedDistribution bijector, etc
mhauru Jan 12, 2026
469a715
Mark a test as broken
mhauru Jan 12, 2026
89a8396
Various bugfixes
mhauru Jan 12, 2026
8cf8ab0
Remove SimpleVarInfo, VarNamedVector, and the old VarInfo type
mhauru Jan 12, 2026
8ba36f6
Fix a lot of doctests
mhauru Jan 13, 2026
1f6335d
Rename vntvarinfo.jl to varinfo.jl
mhauru Jan 13, 2026
dbcf5f6
Rename VNTVarInfo to VarInfo
mhauru Jan 13, 2026
0edaa53
Remove (un)typed_varinfo
mhauru Jan 13, 2026
c2748a7
Add docstrings to varinfo.jl
mhauru Jan 13, 2026
6dbae23
Simplify transformations
mhauru Jan 13, 2026
2fa7333
Fix docs
mhauru Jan 13, 2026
7cbc4a7
Mark some inference tests as broken on 1.10
mhauru Jan 13, 2026
b4361c0
Polish VNT and tests
mhauru Jan 13, 2026
73e50df
Fix broken test marking
mhauru Jan 13, 2026
922fbb6
Polish varinfo.jl
mhauru Jan 13, 2026
66c7970
Polish internal docs
mhauru Jan 13, 2026
51fdcbe
More broken inference tests on v1.10
mhauru Jan 13, 2026
07a13c4
Export VarNamedTuple and its functions
mhauru Jan 14, 2026
92dd490
Add HISTROY.md entry on the new VarInfo
mhauru Jan 14, 2026
06f6c1e
Apply suggestions from code review
mhauru Jan 14, 2026
4f893bc
Use SkipSizeCheck rather than Val(:pass)
mhauru Jan 14, 2026
fdb1373
Remove getindex with dist argument
mhauru Jan 14, 2026
a023a7f
Simplify map and mapreduce for VNT
mhauru Jan 14, 2026
c369b09
Remove unused utility functions
mhauru Jan 15, 2026
6128a56
Use OnlyAccsVarInfo in extract_priors
mhauru Jan 15, 2026
8fddfef
Make linking status a type parameter of VarInfo
mhauru Jan 15, 2026
aa3adb3
Fix a typo
mhauru Jan 15, 2026
0c03233
Simplify code
mhauru Jan 15, 2026
39df57b
Fix comments, remove dead line
mhauru Jan 15, 2026
6ee7187
Merge branch 'mhauru/vnt-for-fastldf' into breaking
penelopeysm Jan 17, 2026
2a2af08
Merge remote-tracking branch 'origin/main' into breaking
penelopeysm Jan 17, 2026
ea9b07a
fix broken test
penelopeysm Jan 17, 2026
65173b6
AbstractPPL 0.14 - new VarName optics & modifications to VNT (#1203)
penelopeysm Jan 17, 2026
fdbc542
Shadow arrays -- up to GrowableArray
penelopeysm Jan 18, 2026
72a4499
GrowableArray
penelopeysm Jan 18, 2026
1b4c29f
bad bad bad abd badbaadbadbabdabs
penelopeysm Jan 19, 2026
e00ac6c
error on z[1:2] ~ whatever
penelopeysm Jan 19, 2026
7e902dc
Merge PAs where necessary.
penelopeysm Jan 19, 2026
26d1fb3
Fix values(vi)
penelopeysm Jan 19, 2026
a633440
improve comments
penelopeysm Jan 19, 2026
710abd9
bunch of fixes
penelopeysm Jan 19, 2026
4734d7d
Fix for type stability on things like x[1][1]
penelopeysm Jan 19, 2026
65530f4
remove printing test, it prints differently
penelopeysm Jan 19, 2026
13d750b
More type stability fixes
penelopeysm Jan 19, 2026
785bd92
Remove refs
penelopeysm Jan 19, 2026
7121f57
fix typo
penelopeysm Jan 19, 2026
9d95c4e
okay really fix that
penelopeysm Jan 19, 2026
b3003b1
mark invertedindices as type unstable
penelopeysm Jan 19, 2026
d68fccf
simplify merge
penelopeysm Jan 19, 2026
1f8b5d7
Fix templates with PrefixContext
penelopeysm Jan 19, 2026
d19387f
fix some tests
penelopeysm Jan 19, 2026
98ea2dc
fix
penelopeysm Jan 19, 2026
5246f18
Fix VNT tests
penelopeysm Jan 19, 2026
c6580dd
fix tests
penelopeysm Jan 19, 2026
e6e73ca
Add more tests for merging different ALBs
penelopeysm Jan 19, 2026
bef1795
More tests.
penelopeysm Jan 19, 2026
8a9beb6
Add some fallbacks and more tests
penelopeysm Jan 20, 2026
8219e90
Start on docs
penelopeysm Jan 20, 2026
0949fdf
Finish design docs
penelopeysm Jan 20, 2026
93bb7b3
Add implementation notes
penelopeysm Jan 20, 2026
94abe21
don't hide the old docs
penelopeysm Jan 20, 2026
35d1f06
Performance optimisations
penelopeysm Jan 20, 2026
02436a4
use Base.broadcastable
penelopeysm Jan 21, 2026
e8b8790
Expand on implementation docs
penelopeysm Jan 21, 2026
315daac
More notes
penelopeysm Jan 21, 2026
552aa09
notes
penelopeysm Jan 21, 2026
72e0a3b
Tidy up implementation
penelopeysm Jan 21, 2026
9afea8b
Fix definition of `empty(::PartialArray)`
penelopeysm Jan 23, 2026
e5e4b4b
Fix hash on PartialArray
penelopeysm Jan 23, 2026
9b22727
docs: fix setindex!! argument order
penelopeysm Jan 23, 2026
66a2545
Tighten docs language
penelopeysm Jan 23, 2026
6a5675b
Remove SkipSizeCheck
penelopeysm Jan 23, 2026
ee3d5ca
VNT performance optimisations (#1211)
penelopeysm Jan 23, 2026
9cf4706
Pretty-print VNTs, accs, and VarInfo (#1218)
penelopeysm Jan 24, 2026
bf65b48
organise accumulator code in a single folder
penelopeysm Jan 24, 2026
f60050b
shorten name
penelopeysm Jan 24, 2026
1482ac0
fix bug
penelopeysm Jan 24, 2026
0be39c1
Apply SkipTemplate to := inside submodels (#1220)
penelopeysm Jan 24, 2026
3fd21eb
Grow GrowableArrays where needed (#1222)
penelopeysm Jan 25, 2026
74ce18f
Merge GrowableArrays by expanding them when needed (#1223)
penelopeysm Jan 25, 2026
d86b1e7
Remove dead code
penelopeysm Jan 25, 2026
941ef67
Include `x := y` in outputs of predict (#1224)
penelopeysm Jan 25, 2026
ec83e09
Update changelog
penelopeysm Jan 26, 2026
1fb3f52
Explain ALBs more thoroughly
penelopeysm Jan 26, 2026
6d1875b
Anotehr tip
penelopeysm Jan 26, 2026
b03d531
fix pretty-printing
penelopeysm Jan 27, 2026
27a0b3b
Accumulators for linked VarInfo (#1212)
penelopeysm Jan 28, 2026
2085606
Fixes for upstream Turing (#1229)
penelopeysm Jan 28, 2026
d3ac68a
add DoNotAccumulate
penelopeysm Jan 29, 2026
6af99e3
Accumulator docs
penelopeysm Jan 30, 2026
b59d4cb
docstring for PriorDistributionAcc
penelopeysm Jan 30, 2026
1e0732d
Document initialisation strategies
penelopeysm Jan 31, 2026
ad5e550
Make `rand(model)` return a VNT (#1233)
penelopeysm Jan 31, 2026
399bf16
Implement `@vnt` macro (#1236)
penelopeysm Feb 1, 2026
32559bc
Use VNT for `FixedContext` and `ConditionContext` (and unify them int…
penelopeysm Feb 2, 2026
472d9c9
allow conditioning on individual subvalues of a lhs variable
penelopeysm Feb 2, 2026
59c18c8
changelog
penelopeysm Feb 2, 2026
adeaf67
Export & document more of accs interface (#1250)
penelopeysm Feb 2, 2026
f519c50
Warn on fewer occasions with GrowableArray
penelopeysm Feb 2, 2026
fef1ee6
Merge remote-tracking branch 'origin/main' into breaking
penelopeysm Feb 3, 2026
e14912c
Fix allocations in LDF
penelopeysm Feb 3, 2026
803a2fb
Principled link statuses (#1231)
penelopeysm Feb 4, 2026
8577d8d
Warn when concretising a dynamic index on a GrowableArray & when crea…
penelopeysm Feb 4, 2026
53c5aac
organise tests into modules
penelopeysm Feb 4, 2026
dcfaed7
Reorganise InitContext tests, update for linking
penelopeysm Feb 4, 2026
1add301
Remove infer_nested_eltype & other old things
penelopeysm Feb 4, 2026
5b3fd07
Improve InitContext tests
penelopeysm Feb 4, 2026
0887ebe
remove CRC dep properly
penelopeysm Feb 4, 2026
30505f2
fix doctests
penelopeysm Feb 4, 2026
27b7a6d
accs->accumulators
penelopeysm Feb 4, 2026
50b2bc1
Remove `setindex!!` on VarInfo, `maybe_invlink_before_eval!!`, `updat…
penelopeysm Feb 4, 2026
881e11c
fix addlogprob tests
penelopeysm Feb 4, 2026
de94918
fix InitFromUniform for non-1D Bijectors.output_size
penelopeysm Feb 5, 2026
4b2714f
make LDF transform strategy public
penelopeysm Feb 5, 2026
8501847
fix haskey on VNT
penelopeysm Feb 5, 2026
f889180
Correctly fix haskey
penelopeysm Feb 5, 2026
76f33bd
fix tests
penelopeysm Feb 5, 2026
ff38fac
add multi-argument merge methods
penelopeysm Feb 5, 2026
0b82c1a
Rename `ValuesAsInModelAccumulator` -> `RawValueAccumulator`; change …
penelopeysm Feb 6, 2026
fd3d280
rename file
penelopeysm Feb 6, 2026
567d0fb
Include templating info when calling `to_samples` (#1261)
penelopeysm Feb 6, 2026
81c319c
simplify hasvalue methods
penelopeysm Feb 6, 2026
eed3180
push people towards `init!!` with explicit accs/init strategy/transfo…
penelopeysm Feb 7, 2026
06b2ef5
outline for more docs
penelopeysm Feb 8, 2026
a487329
loads of docs
penelopeysm Feb 9, 2026
8333dea
Expand LogDensityFunction constructors
penelopeysm Feb 9, 2026
30a6809
Remove dead code
penelopeysm Feb 9, 2026
10deb5a
Add more docs
penelopeysm Feb 9, 2026
19c0400
fix ci
penelopeysm Feb 9, 2026
ff9db34
Add docs
penelopeysm Feb 9, 2026
19f8140
Add more LDF docs
penelopeysm Feb 9, 2026
7188386
Implement `densify!!` (#1268)
penelopeysm Feb 10, 2026
7d83bd4
Extra translations between LogDensityFunctions and models (#1267)
penelopeysm Feb 10, 2026
8b4735a
Fix VarInfo constructors
penelopeysm Feb 10, 2026
0641a45
Add more docs
penelopeysm Feb 10, 2026
e4caa2f
import
penelopeysm Feb 10, 2026
e8e0ebd
Add ignore_missing_accumulator keyword argument to acclogX
penelopeysm Feb 10, 2026
5be4513
remove test
penelopeysm Feb 10, 2026
41ada45
VectorParamAccumulator (#1273)
penelopeysm Feb 11, 2026
edecbc9
to_vector_input -> to_vector_params (for consistency)
penelopeysm Feb 11, 2026
d0c34b5
Refactor DebugAccumulator (#1274)
penelopeysm Feb 12, 2026
d089228
Store a full transform strategy in VarInfo rather than just `true`/`f…
penelopeysm Feb 13, 2026
63588db
Use templates in observe pipeline, make pointwise_logprobs return VNT…
penelopeysm Feb 21, 2026
d7d3b31
Remove `vnt_size` and size checks when setting in VNT (#1281)
penelopeysm Feb 21, 2026
af2598b
Merge remote-tracking branch 'origin/main' into breaking
penelopeysm Feb 23, 2026
0f9a868
Generalise TSVI accumulator type when necessary (#1284)
penelopeysm Feb 24, 2026
62381b8
Let Claude reorganise the changelog
penelopeysm Feb 24, 2026
3e59e48
Add migration guide.
penelopeysm Feb 24, 2026
6fad4a7
Fix typo
penelopeysm Feb 24, 2026
0f79d1f
Improve error messages
penelopeysm Feb 24, 2026
b1583ba
Cover Missing as well
penelopeysm Feb 24, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
497 changes: 395 additions & 102 deletions HISTORY.md

Large diffs are not rendered by default.

13 changes: 3 additions & 10 deletions Project.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name = "DynamicPPL"
uuid = "366bfd00-2699-11ea-058f-f148b4cae6d8"
version = "0.39.14"
version = "0.40"

[deps]
ADTypes = "47edcb42-4c32-4615-8424-f2b9edc5f35b"
Expand All @@ -9,7 +9,6 @@ AbstractPPL = "7a57a42e-76ec-4ea3-a279-07e840d6d9cf"
Accessors = "7d9f7c33-5ae7-4f3b-8dc6-eff91059b697"
BangBang = "198e06fe-97b7-11e9-32a5-e1d131e6ad66"
Bijectors = "76274a88-744f-5084-9051-94815aaf08c4"
ChainRulesCore = "d360d2e6-b24c-11e9-a2a3-2a2ae2dbcce4"
Chairmarks = "0ca39b1e-fe0b-4e98-acfc-b1656634c4de"
Compat = "34da2185-b29b-5c13-b0c7-acf172513d20"
ConstructionBase = "187b0558-2788-49d3-abe0-74a17ed4e7c9"
Expand All @@ -27,34 +26,29 @@ Statistics = "10745b16-79ce-11e8-11f9-7d13ad32a3b2"
Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40"

[weakdeps]
ChainRulesCore = "d360d2e6-b24c-11e9-a2a3-2a2ae2dbcce4"
EnzymeCore = "f151be2c-9106-41f4-ab19-57ee4f262869"
ForwardDiff = "f6369f11-7733-5829-9624-2563aa707210"
JET = "c3a54625-cd67-489e-a8e7-0a5a0ff4e31b"
KernelAbstractions = "63c18a36-062a-441e-b654-da1e3ab1ce7c"
MCMCChains = "c7f686f2-ff18-58e9-bc7b-31028e88f75d"
MarginalLogDensities = "f0c3360a-fb8d-11e9-1194-5521fd7ee392"
Mooncake = "da2b9cff-9c12-43a0-ae48-6db2b0edb7d6"
ReverseDiff = "37e2e3b7-166d-5795-8a7a-e32c996b4267"

[extensions]
DynamicPPLChainRulesCoreExt = ["ChainRulesCore"]
DynamicPPLEnzymeCoreExt = ["EnzymeCore"]
DynamicPPLForwardDiffExt = ["ForwardDiff"]
DynamicPPLJETExt = ["JET"]
DynamicPPLMCMCChainsExt = ["MCMCChains"]
DynamicPPLMarginalLogDensitiesExt = ["MarginalLogDensities"]
DynamicPPLMooncakeExt = ["Mooncake"]
DynamicPPLReverseDiffExt = ["ReverseDiff"]

[compat]
ADTypes = "1"
AbstractMCMC = "5.10"
AbstractPPL = "0.13.1"
AbstractMCMC = "5.14"
AbstractPPL = "0.14.1"
Accessors = "0.1"
BangBang = "0.4.1"
Bijectors = "0.15.11"
ChainRulesCore = "1"
Chairmarks = "1.3.1"
Compat = "4"
ConstructionBase = "1.5.4"
Expand All @@ -64,7 +58,6 @@ DocStringExtensions = "0.9"
EnzymeCore = "0.6 - 0.8"
ForwardDiff = "0.10.12, 1"
InteractiveUtils = "1"
JET = "0.9, 0.10, 0.11"
KernelAbstractions = "0.9.33"
LinearAlgebra = "1.6"
LogDensityProblems = "2"
Expand Down
2 changes: 1 addition & 1 deletion benchmarks/Project.toml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ DynamicPPL = {path = "../"}
ADTypes = "1.14.0"
Chairmarks = "1.3.1"
Distributions = "0.25.117"
DynamicPPL = "0.39"
DynamicPPL = "0.40"
Enzyme = "0.13"
ForwardDiff = "1"
JSON = "1.3.0"
Expand Down
61 changes: 25 additions & 36 deletions benchmarks/benchmarks.jl
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,7 @@ using StableRNGs: StableRNG

rng = StableRNG(23)

colnames = [
"Model", "Dim", "AD Backend", "VarInfo", "Linked", "t(eval)/t(ref)", "t(grad)/t(eval)"
]
colnames = ["Model", "Dim", "AD Backend", "Linked", "t(eval)/t(ref)", "t(grad)/t(eval)"]
function print_results(results_table; to_json=false)
if to_json
# Print to the given file as JSON
Expand Down Expand Up @@ -58,31 +56,26 @@ function run(; to_json=false)
end

# Specify the combinations to test:
# (Model Name, model instance, VarInfo choice, AD backend, linked)
# (Model Name, model instance, AD backend, linked)
chosen_combinations = [
(
"Simple assume observe",
Models.simple_assume_observe(randn(rng)),
:typed,
:forwarddiff,
false,
),
("Smorgasbord", smorgasbord_instance, :typed, :forwarddiff, false),
("Smorgasbord", smorgasbord_instance, :simple_namedtuple, :forwarddiff, true),
("Smorgasbord", smorgasbord_instance, :untyped, :forwarddiff, true),
("Smorgasbord", smorgasbord_instance, :simple_dict, :forwarddiff, true),
("Smorgasbord", smorgasbord_instance, :typed_vector, :forwarddiff, true),
("Smorgasbord", smorgasbord_instance, :untyped_vector, :forwarddiff, true),
("Smorgasbord", smorgasbord_instance, :typed, :reversediff, true),
("Smorgasbord", smorgasbord_instance, :typed, :mooncake, true),
("Smorgasbord", smorgasbord_instance, :typed, :enzyme, true),
("Loop univariate 1k", loop_univariate1k, :typed, :mooncake, true),
("Multivariate 1k", multivariate1k, :typed, :mooncake, true),
("Loop univariate 10k", loop_univariate10k, :typed, :mooncake, true),
("Multivariate 10k", multivariate10k, :typed, :mooncake, true),
("Dynamic", Models.dynamic(), :typed, :mooncake, true),
("Submodel", Models.parent(randn(rng)), :typed, :mooncake, true),
("LDA", lda_instance, :typed, :reversediff, true),
("Smorgasbord", smorgasbord_instance, :forwarddiff, false),
("Smorgasbord", smorgasbord_instance, :forwarddiff, true),
("Smorgasbord", smorgasbord_instance, :reversediff, true),
("Smorgasbord", smorgasbord_instance, :mooncake, true),
("Smorgasbord", smorgasbord_instance, :enzyme, true),
("Loop univariate 1k", loop_univariate1k, :mooncake, true),
("Multivariate 1k", multivariate1k, :mooncake, true),
("Loop univariate 10k", loop_univariate10k, :mooncake, true),
("Multivariate 10k", multivariate10k, :mooncake, true),
("Dynamic", Models.dynamic(), :mooncake, true),
("Submodel", Models.parent(randn(rng)), :mooncake, true),
("LDA", lda_instance, :reversediff, true),
]

# Time running a model-like function that does not use DynamicPPL, as a reference point.
Expand All @@ -94,13 +87,13 @@ function run(; to_json=false)
@info "Reference evaluation time: $(reference_time) seconds"

results_table = Tuple{
String,Int,String,String,Bool,Union{Float64,Missing},Union{Float64,Missing}
String,Int,String,Bool,Union{Float64,Missing},Union{Float64,Missing}
}[]

for (model_name, model, varinfo_choice, adbackend, islinked) in chosen_combinations
@info "Running benchmark for $model_name, $varinfo_choice, $adbackend, $islinked"
for (model_name, model, adbackend, islinked) in chosen_combinations
@info "Running benchmark for $model_name, $adbackend, $islinked"
relative_eval_time, relative_ad_eval_time = try
results = benchmark(model, varinfo_choice, adbackend, islinked)
results = benchmark(model, adbackend, islinked)
@info " t(eval) = $(results.primal_time)"
@info " t(grad) = $(results.grad_time)"
(results.primal_time / reference_time),
Expand All @@ -115,7 +108,6 @@ function run(; to_json=false)
model_name,
model_dimension(model, islinked),
string(adbackend),
string(varinfo_choice),
islinked,
relative_eval_time,
relative_ad_eval_time,
Expand All @@ -131,9 +123,8 @@ struct TestCase
model_name::String
dim::Integer
ad_backend::String
varinfo::String
linked::Bool
TestCase(d::Dict{String,Any}) = new((d[c] for c in colnames[1:5])...)
TestCase(d::Dict{String,Any}) = new((d[c] for c in colnames[1:4])...)
end
function combine(head_filename::String, base_filename::String)
head_results = try
Expand All @@ -148,23 +139,22 @@ function combine(head_filename::String, base_filename::String)
Dict{String,Any}[]
end
@info "Loaded $(length(base_results)) results from $base_filename"
# Identify unique combinations of (Model, Dim, AD Backend, VarInfo, Linked)
# Identify unique combinations of (Model, Dim, AD Backend, Linked)
head_testcases = Dict(
TestCase(d) => (d[colnames[6]], d[colnames[7]]) for d in head_results
TestCase(d) => (d[colnames[5]], d[colnames[6]]) for d in head_results
)
base_testcases = Dict(
TestCase(d) => (d[colnames[6]], d[colnames[7]]) for d in base_results
TestCase(d) => (d[colnames[5]], d[colnames[6]]) for d in base_results
)
all_testcases = union(Set(keys(head_testcases)), Set(keys(base_testcases)))
@info "$(length(all_testcases)) unique test cases found"
sorted_testcases = sort(
collect(all_testcases); by=(c -> (c.model_name, c.linked, c.varinfo, c.ad_backend))
collect(all_testcases); by=(c -> (c.model_name, c.linked, c.ad_backend))
)
results_table = Tuple{
String,
Int,
String,
String,
Bool,
String,
String,
Expand All @@ -179,12 +169,12 @@ function combine(head_filename::String, base_filename::String)
sublabels = ["base", "this PR", "speedup"]
results_colnames = [
[
EmptyCells(5),
EmptyCells(4),
MultiColumn(3, "t(eval) / t(ref)"),
MultiColumn(3, "t(grad) / t(eval)"),
MultiColumn(3, "t(grad) / t(ref)"),
],
[colnames[1:5]..., sublabels..., sublabels..., sublabels...],
[colnames[1:4]..., sublabels..., sublabels..., sublabels...],
]
sprint_float(x::Float64) = @sprintf("%.2f", x)
sprint_float(m::Missing) = "err"
Expand All @@ -211,7 +201,6 @@ function combine(head_filename::String, base_filename::String)
c.model_name,
c.dim,
c.ad_backend,
c.varinfo,
c.linked,
sprint_float(base_eval),
sprint_float(head_eval),
Expand Down
52 changes: 12 additions & 40 deletions benchmarks/src/DynamicPPLBenchmarks.jl
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
module DynamicPPLBenchmarks

using DynamicPPL: VarInfo, SimpleVarInfo, VarName
using DynamicPPL: VarInfo, VarName
using DynamicPPL: DynamicPPL
using DynamicPPL.TestUtils.AD: run_ad, NoTest
using ADTypes: ADTypes
Expand All @@ -22,11 +22,12 @@ export Models, benchmark, model_dimension
Return the dimension of `model`, accounting for linking, if any.
"""
function model_dimension(model, islinked)
vi = VarInfo()
model(StableRNG(23), vi)
if islinked
vi = DynamicPPL.link(vi, model)
end
tfm_strategy = islinked ? DynamicPPL.LinkAll() : DynamicPPL.UnlinkAll()
vi = last(
DynamicPPL.init!!(
StableRNG(23), model, VarInfo(), DynamicPPL.InitFromPrior(), tfm_strategy
),
)
return length(vi[:])
end

Expand All @@ -52,53 +53,24 @@ function to_backend(x::Union{AbstractString,Symbol})
end

"""
benchmark(model, varinfo_choice::Symbol, adbackend::Symbol, islinked::Bool)
benchmark(model, adbackend::Symbol, islinked::Bool)

Benchmark evaluation and gradient calculation for `model` using the selected varinfo type
and AD backend.

Available varinfo choices:
• `:untyped` → uses `DynamicPPL.untyped_varinfo(model)`
• `:typed` → uses `DynamicPPL.typed_varinfo(model)`
• `:simple_namedtuple` → uses `SimpleVarInfo{Float64}(model())`
• `:simple_dict` → builds a `SimpleVarInfo{Float64}` from a Dict (pre-populated with the model’s outputs)
Benchmark evaluation and gradient calculation for `model` using the selected AD backend.

The AD backend should be specified as a Symbol (e.g. `:forwarddiff`, `:reversediff`, `:zygote`).

`islinked` determines whether to link the VarInfo for evaluation.
"""
function benchmark(model, varinfo_choice::Symbol, adbackend::Symbol, islinked::Bool)
function benchmark(model, adbackend::Symbol, islinked::Bool)
rng = StableRNG(23)

vi = VarInfo(rng, model)
adbackend = to_backend(adbackend)

vi = if varinfo_choice == :untyped
DynamicPPL.untyped_varinfo(rng, model)
elseif varinfo_choice == :typed
DynamicPPL.typed_varinfo(rng, model)
elseif varinfo_choice == :simple_namedtuple
SimpleVarInfo{Float64}(model(rng))
elseif varinfo_choice == :simple_dict
retvals = model(rng)
vns = [VarName{k}() for k in keys(retvals)]
SimpleVarInfo{Float64}(Dict(zip(vns, values(retvals))))
elseif varinfo_choice == :typed_vector
DynamicPPL.typed_vector_varinfo(rng, model)
elseif varinfo_choice == :untyped_vector
DynamicPPL.untyped_vector_varinfo(rng, model)
else
error("Unknown varinfo choice: $varinfo_choice")
end

adbackend = to_backend(adbackend)

if islinked
vi = DynamicPPL.link(vi, model)
end

return run_ad(
model, adbackend; varinfo=vi, benchmark=true, test=NoTest(), verbose=false
)
end

end # module
end
2 changes: 1 addition & 1 deletion benchmarks/src/Models.jl
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
Models for benchmarking Turing.jl.

Each model returns a NamedTuple of all the random variables in the model that are not
observed (this is used for constructing SimpleVarInfos).
observed.
"""
module Models

Expand Down
12 changes: 8 additions & 4 deletions docs/Project.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,29 +2,33 @@
AbstractMCMC = "80f14c24-f653-4e6a-9b94-39d6b0f70001"
AbstractPPL = "7a57a42e-76ec-4ea3-a279-07e840d6d9cf"
Accessors = "7d9f7c33-5ae7-4f3b-8dc6-eff91059b697"
BangBang = "198e06fe-97b7-11e9-32a5-e1d131e6ad66"
ChangesOfVariables = "9e997f8a-9a97-42d5-a9f1-ce6bfc15e2c0"
DimensionalData = "0703355e-b756-11e9-17c0-8b28908087d0"
Distributions = "31c24e10-a181-5473-b8eb-7969acd0382f"
Documenter = "e30172f5-a6a5-5a46-863b-614d45cd2de4"
DocumenterInterLinks = "d12716ef-a0f6-4df4-a9f1-a5a34e75c656"
DocumenterMermaid = "a078cd44-4d9c-4618-b545-3ab9d77f9177"
DynamicPPL = "366bfd00-2699-11ea-058f-f148b4cae6d8"
FillArrays = "1a297f60-69ca-5386-bcde-b61e274b549b"
ForwardDiff = "f6369f11-7733-5829-9624-2563aa707210"
JET = "c3a54625-cd67-489e-a8e7-0a5a0ff4e31b"
LogDensityProblems = "6fdf6af0-433a-55f7-b3ed-c6c6e0b8df7c"
MCMCChains = "c7f686f2-ff18-58e9-bc7b-31028e88f75d"
MarginalLogDensities = "f0c3360a-fb8d-11e9-1194-5521fd7ee392"
OrderedCollections = "bac558e1-5e72-5ebc-8fee-abe8a469f55d"
StableRNGs = "860ef19b-820b-49d6-a774-d7a799459cd3"
StatsFuns = "4c63d2b9-4356-54db-8cca-17b64c39e42c"

[compat]
AbstractMCMC = "5"
AbstractPPL = "0.13"
AbstractPPL = "0.14"
Accessors = "0.1"
Distributions = "0.25"
Documenter = "1"
DocumenterMermaid = "0.1, 0.2"
DynamicPPL = "0.39"
DynamicPPL = "0.40"
FillArrays = "0.13, 1"
ForwardDiff = "0.10, 1"
JET = "0.9, 0.10, 0.11"
LogDensityProblems = "2"
MCMCChains = "5, 6, 7"
MarginalLogDensities = "0.4"
Expand Down
28 changes: 24 additions & 4 deletions docs/make.jl
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
using Documenter
using DocumenterInterLinks
using DynamicPPL
using DynamicPPL: AbstractPPL
using AbstractPPL
# NOTE: This is necessary to ensure that if we print something from
# Distributions.jl in a doctest, then the shown value will not include
# a qualifier; that is, we don't want `Distributions.Normal{Float64}`
Expand All @@ -22,6 +23,8 @@ DocMeta.setdocmeta!(
DynamicPPL, :DocTestSetup, :(using DynamicPPL, MCMCChains); recursive=true
)

links = InterLinks("AbstractPPL" => "https://turinglang.org/AbstractPPL.jl/stable/")

makedocs(;
sitename="DynamicPPL",
# The API index.html page is fairly large, and violates the default HTML page size
Expand All @@ -36,11 +39,28 @@ makedocs(;
],
pages=[
"Home" => "index.md",
"Conditioning and fixing" => "conditionfix.md",
"VarNamedTuple" => [
"vnt/motivation.md",
"vnt/design.md",
"vnt/implementation.md",
"vnt/arraylikeblocks.md",
],
"Model evaluation" => "evaluation.md",
"Tilde-statements" => "tilde.md",
"Initialisation strategies" => "init.md",
"Transform strategies" => "transforms.md",
"Accumulators" => [
"accs/overview.md",
"accs/existing.md",
"accs/threadsafe.md",
"accs/values.md",
],
"LogDensityFunction" => ["ldf/overview.md", "ldf/models.md"],
"Migrating old VarInfo code" => "migration.md",
"API" => "api.md",
# TODO(mhauru) The varinfo.md has fallen badly out of date. Update it and add it
# back in.
#"Internals" => ["internals/varinfo.md"],
],
checkdocs=:exports,
doctest=false,
plugins=[links],
)
Loading