Repository navigation
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #1521 +/- ##
==========================================
+ Coverage 84.70% 84.81% +0.10%
==========================================
Files 52 52
Lines 4590 4616 +26
==========================================
+ Hits 3888 3915 +27
+ Misses 702 701 -1 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
|
DynamicPPL.jl documentation for PR #1521 is available at: |
BenchmarksPerformance Ratio: gradient time divided by log-density time. For very small models these ratios are noisy across runs and machines; raw primal and gradient timings are more reliable. The benchmarks are aimed at DynamicPPL developers and mainly catch obvious allocation or type-stability regressions. See benchmark notes for details. Primal times: EnvironmentJulia Version 1.13.2 Commit 45b6d15e34b (2026-10-14 20:33 UTC) Build Info: Official https://julialang.org release Platform Info: OS: Linux (x86_64-linux-gnu) CPU: 4 × AMD EPYC 9V45 96-Core Processor WORD_SIZE: 64 LLVM: libLLVM-20.1.8 (ORCJIT, znver5) GC: Built with stock GC Threads: 1 default, 1 interactive, 1 GC (on 4 virtual cores) |
Assisted-by: Codex <codex@openai.com>
Assisted-by: Codex <codex@openai.com>
shravanngoswamii
left a comment
There was a problem hiding this comment.
I pushed some docs changes. Thank you @yebai, Looks good to me!
Assisted-by: Codex <codex@openai.com>
Rebinding shared immutable values such as `x.a ~ Normal()` can lose writes even when their types stay unchanged. Require each container on a tilde path to remain identical. Traverse intermediate array slices through views and update only the leaf. Immutable replacements now throw even in task-local code without AD. Use mutable storage allocated with the parameter element type. Assisted-by: Codex <codex@openai.com>
|
@shravanngoswamii Thanks for the docs commit. Two commits on top of it change the rule, and they replace the |
Assisted-by: Codex <codex@openai.com>
|
Is |
Assisted-by: Codex <codex@openai.com>
|
Nice catch. It shouldn't have been recommended. On |
shravanngoswamii
left a comment
There was a problem hiding this comment.
LGTM! Thank you @yebai!
Under thread-safe evaluation,
x = zeros(n)with a threadedx[i] ~ Normal()can give wrong ForwardDiff gradients without an error: BangBang widensxto a newVector{Dual}, each task rebinds the sharedxto its own copy, and writes are lost. This turned up while reviewing the fix for #1519 (TuringLang/AbstractPPL.jl#200), which writes in place and so cannot cover a container that must widen.Thread-safe evaluation now throws an
ArgumentErrorwhen a tilde assignment, threaded or not, leaves any container on its path not===to what it was. Only the written leaf may change. Checking types alone is not enough: rebinding aNamedTupleshared across tasks keeps its type yet loses writes. Slices in the middle of a path are written through views, sox[:, j] .~ Normal()andx[1:2][i] ~ Normal()updatexin place. The error recommends::Type{T}=Float64withVector{T}(undef, n),Matrix{T}columns for vector-valued tildes, and aVectorin place of aNamedTuple, tuple or static array. Without thread-safe mode nothing is checked.Two patterns that worked before now throw under thread-safe evaluation. One is a tilde on a field of a
NamedTuple, tuple or static array, even within a single task. The other is imputingmissingentries of a data argument under AD; passing the data asVector{Union{Missing,Real}}restores it.The docs warn that threaded evaluation can reorder parameters between constructions; a test checks that
to_vector_paramsfollows each function's mapping.