Skip to content

Commit 7a140bc

Browse files
authored
Expand JET test (#782)
* Fix JET test * Add output if a typed varinfo isn't inferred
1 parent 727da63 commit 7a140bc

File tree

1 file changed

+16
-3
lines changed

1 file changed

+16
-3
lines changed

test/ext/DynamicPPLJETExt.jl

+16-3
Original file line numberDiff line numberDiff line change
@@ -64,9 +64,7 @@
6464
@testset "$(model.f)" for model in DynamicPPL.TestUtils.DEMO_MODELS
6565
# Use debug logging below.
6666
varinfo = DynamicPPL.Experimental.determine_suitable_varinfo(model)
67-
# They should all result in typed.
68-
@test varinfo isa DynamicPPL.TypedVarInfo
69-
# But let's also make sure that they're not lying.
67+
# Check that the inferred varinfo is indeed suitable for evaluation and sampling
7068
f_eval, argtypes_eval = DynamicPPL.DebugUtils.gen_evaluator_call_with_types(
7169
model, varinfo
7270
)
@@ -76,6 +74,21 @@
7674
model, varinfo, DynamicPPL.SamplingContext()
7775
)
7876
JET.test_call(f_sample, argtypes_sample)
77+
# For our demo models, they should all result in typed.
78+
is_typed = varinfo isa DynamicPPL.TypedVarInfo
79+
@test is_typed
80+
# If the test failed, check why it didn't infer a typed varinfo
81+
if !is_typed
82+
typed_vi = VarInfo(model)
83+
f_eval, argtypes_eval = DynamicPPL.DebugUtils.gen_evaluator_call_with_types(
84+
model, typed_vi
85+
)
86+
JET.test_call(f_eval, argtypes_eval)
87+
f_sample, argtypes_sample = DynamicPPL.DebugUtils.gen_evaluator_call_with_types(
88+
model, typed_vi, DynamicPPL.SamplingContext()
89+
)
90+
JET.test_call(f_sample, argtypes_sample)
91+
end
7992
end
8093
end
8194
end

0 commit comments

Comments
 (0)