Skip to content

ProbProg: Making trace an operand #1444

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 90 commits into
base: main
Choose a base branch
from
Open

Conversation

sbrantq
Copy link
Member

@sbrantq sbrantq commented Jul 3, 2025

No description provided.

@sbrantq sbrantq requested a review from wsmoses July 11, 2025 16:50
@sbrantq sbrantq changed the base branch from probprog to main July 18, 2025 03:39
@sbrantq
Copy link
Member Author

sbrantq commented Jul 31, 2025

@wsmoses So I added GC.@preservings to fix the deadlock issue with the ConcreteRArray that specifies rng.seed (for context GC triggered by EnzymeJaXMapSymbol'd functions somehow tries to free only(rng.seed.data).buffer):

seed_buffer = only(rng.seed.data).buffer
GC.@preserve seed_buffer constraint begin
trace, _, _ = compiled_fn(rng, constraint_ptr, args...)

Also GC triggered by mapped functions in src/probprog/FFI.jl can cause jl_gc_wait_for_the_world to wait forever for the main Julia thread which is waiting during Base.convert to Julia Array, like this one

trace = unsafe_pointer_to_objref(Ptr{Any}(Array(trace)[1]))

So I added
while !isready(trace)
yield()
end

(Adding trivial Base.isready for ConcretePJRTArray and ConcreteIFRTArray).

Does that sound like an ok-ish fix, or am i missing something?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants