Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
4 changes: 4 additions & 0 deletions HISTORY.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# DynamicPPL Changelog

## 0.38.6

Renamed keyword argument `only_ddpl` to `only_dppl` for `Experimental.is_suitable_varinfo`.

## 0.38.5

Improve performance of VarNamedVector, mostly by changing how it handles contiguification.
Expand Down
2 changes: 1 addition & 1 deletion 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.38.5"
version = "0.38.6"

[deps]
ADTypes = "47edcb42-4c32-4615-8424-f2b9edc5f35b"
Expand Down
10 changes: 5 additions & 5 deletions ext/DynamicPPLJETExt.jl
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,12 @@ using DynamicPPL: DynamicPPL
using JET: JET

function DynamicPPL.Experimental.is_suitable_varinfo(
model::DynamicPPL.Model, varinfo::DynamicPPL.AbstractVarInfo; only_ddpl::Bool=true
model::DynamicPPL.Model, varinfo::DynamicPPL.AbstractVarInfo; only_dppl::Bool=true
)
f, argtypes = DynamicPPL.DebugUtils.gen_evaluator_call_with_types(model, varinfo)
# If specified, we only check errors originating somewhere in the DynamicPPL.jl.
# This way we don't just fall back to untyped if the user's code is the issue.
result = if only_ddpl
result = if only_dppl
JET.report_call(f, argtypes; target_modules=(JET.AnyFrameModule(DynamicPPL),))
else
JET.report_call(f, argtypes)
Expand All @@ -18,15 +18,15 @@ function DynamicPPL.Experimental.is_suitable_varinfo(
end

function DynamicPPL.Experimental._determine_varinfo_jet(
model::DynamicPPL.Model; only_ddpl::Bool=true
model::DynamicPPL.Model; only_dppl::Bool=true
)
# Generate a typed varinfo to test model type stability with
varinfo = DynamicPPL.typed_varinfo(model)

# Check type stability of evaluation (i.e. DefaultContext)
model = DynamicPPL.setleafcontext(model, DynamicPPL.DefaultContext())
eval_issuccess, eval_result = DynamicPPL.Experimental.is_suitable_varinfo(
model, varinfo; only_ddpl
model, varinfo; only_dppl
)
if !eval_issuccess
@debug "Evaluation with typed varinfo failed with the following issues:"
Expand All @@ -36,7 +36,7 @@ function DynamicPPL.Experimental._determine_varinfo_jet(
# Check type stability of initialisation (i.e. InitContext)
model = DynamicPPL.setleafcontext(model, DynamicPPL.InitContext())
init_issuccess, init_result = DynamicPPL.Experimental.is_suitable_varinfo(
model, varinfo; only_ddpl
model, varinfo; only_dppl
)
if !init_issuccess
@debug "Initialisation with typed varinfo failed with the following issues:"
Expand Down
10 changes: 5 additions & 5 deletions src/experimental.jl
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ Check if the `model` supports evaluation using the provided `varinfo`.
- `varinfo`: The varinfo to verify the support for.

# Keyword Arguments
- `only_ddpl`: If `true`, only consider error reports occuring in the tilde pipeline. Default: `true`.
- `only_dppl`: If `true`, only consider error reports occuring in the tilde pipeline. Default: `true`.

# Returns
- `issuccess`: `true` if the model supports the varinfo, otherwise `false`.
Expand All @@ -28,7 +28,7 @@ function is_suitable_varinfo end
function _determine_varinfo_jet end

"""
determine_suitable_varinfo(model; only_ddpl::Bool=true)
determine_suitable_varinfo(model; only_dppl::Bool=true)

Return a suitable varinfo for the given `model`.

Expand All @@ -42,7 +42,7 @@ See also: [`DynamicPPL.Experimental.is_suitable_varinfo`](@ref).
- `model`: The model for which to determine the varinfo.

# Keyword Arguments
- `only_ddpl`: If `true`, only consider error reports within DynamicPPL.jl.
- `only_dppl`: If `true`, only consider error reports within DynamicPPL.jl.

# Examples

Expand Down Expand Up @@ -83,10 +83,10 @@ julia> vi isa typeof(DynamicPPL.typed_varinfo(model_with_static_support()))
true
```
"""
function determine_suitable_varinfo(model::DynamicPPL.Model; only_ddpl::Bool=true)
function determine_suitable_varinfo(model::DynamicPPL.Model; only_dppl::Bool=true)
# If JET.jl has been loaded, and thus `determine_varinfo` has been defined, we use that.
return if Base.get_extension(DynamicPPL, :DynamicPPLJETExt) !== nothing
_determine_varinfo_jet(model; only_ddpl)
_determine_varinfo_jet(model; only_dppl)
else
# Warn the user.
@warn "JET.jl is not loaded. Assumes the model is compatible with typed varinfo."
Expand Down
2 changes: 1 addition & 1 deletion test/ext/DynamicPPLJETExt.jl
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@
DynamicPPL.NTVarInfo
# Should fail if we're including errors in the model body.
@test DynamicPPL.Experimental.determine_suitable_varinfo(
demo5(); only_ddpl=false
demo5(); only_dppl=false
) isa DynamicPPL.UntypedVarInfo
end

Expand Down
Loading