You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hi @wsmoses, as discussed on Slack, I reduced the case where the MWE of #1769 now segfaults. It's not the most minimal, and I don't think I'll have time before January to reduce it further, but it no longer depends on anything in TuringLang.
module MWE
using Distributions
using Enzyme
using Random
Random.seed!(1)
struct Metadata{
TIdcs<:Dict{Symbol,Int},
TVN<:AbstractVector{Symbol},
TVal<:AbstractVector{<:Real},
}
idcs::TIdcs
vns::TVN
ranges::Vector{UnitRange{Int}}
vals::TValendfunctionMetadata()
vals =Vector{Real}()
returnMetadata(
Dict{Symbol,Int}(),
Vector{Symbol}(),
Vector{UnitRange{Int}}(),
vals,
)
endfunction Base.push!(meta::Metadata, vn, val)
meta.idcs[vn] =length(meta.idcs) +1push!(meta.vns, vn)
l =length(meta.vals)
n =length(val)
push!(meta.ranges, (l +1):(l + n))
append!(meta.vals, val)
return meta
endfunctionreplace_values(metadata::Metadata, x)
returnMetadata(
metadata.idcs,
metadata.vns,
metadata.ranges,
x,
)
endfunctiondata_poly(x, degree)
returnhcat([x .^ d for d in1:degree]...)
end# Having the third, useless argument seems significant for reproducing the segfault.functionobserve(right::Distribution, left, vi)
return Distributions.loglikelihood(right, left)
endfunctionmodel(__varinfo__)
y =rand(Normal(0, 1), 1000)
x = y .+rand(Normal(0, 1.5), 1000)
X =data_poly(x, 1)
for i =eachindex(y)
d2 =Normal(X[i, 1], 1.0)
_ =observe(d2, y[i], __varinfo__)
endreturn (0.0, __varinfo__)
end
vi =Metadata()
vn1 =:a
vi =push!(vi, vn1, 0.0)
functionldf(x)
vi_tmp =replace_values(vi, x)
returnmodel(vi_tmp)
endfor i in1:10000
x = [randn()]
Enzyme.gradient(Enzyme.set_runtime_activity(Enzyme.Forward), ldf, x)
endend
Output, which seems to be indeterministic:
[63386] signal (11.2): Segmentation fault:11
in expression starting at /Users/mhauru/projects/Enzyme-mwes/segfault_from_slowdown/mwe.jl:78
gc_mark_obj8 at /Users/julia/.julia/scratchspaces/a66863c6-20e8-4ff4-8a62-49f30b1f605e/agent-cache/default-honeycrisp-HL2F7YQ3XH.0/build/default-honeycrisp-HL2F7YQ3XH-0/julialang/julia-release-1-dot-10/src/gc.c:0
gc_mark_outrefs at /Users/julia/.julia/scratchspaces/a66863c6-20e8-4ff4-8a62-49f30b1f605e/agent-cache/default-honeycrisp-HL2F7YQ3XH.0/build/default-honeycrisp-HL2F7YQ3XH-0/julialang/julia-release-1-dot-10/src/gc.c:2634 [inlined]
gc_mark_loop_serial_ at /Users/julia/.julia/scratchspaces/a66863c6-20e8-4ff4-8a62-49f30b1f605e/agent-cache/default-honeycrisp-HL2F7YQ3XH.0/build/default-honeycrisp-HL2F7YQ3XH-0/julialang/julia-release-1-dot-10/src/gc.c:2690
gc_mark_loop_serial at /Users/julia/.julia/scratchspaces/a66863c6-20e8-4ff4-8a62-49f30b1f605e/agent-cache/default-honeycrisp-HL2F7YQ3XH.0/build/default-honeycrisp-HL2F7YQ3XH-0/julialang/julia-release-1-dot-10/src/gc.c:2713
_jl_gc_collect at /Users/julia/.julia/scratchspaces/a66863c6-20e8-4ff4-8a62-49f30b1f605e/agent-cache/default-honeycrisp-HL2F7YQ3XH.0/build/default-honeycrisp-HL2F7YQ3XH-0/julialang/julia-release-1-dot-10/src/gc.c:3227
ijl_gc_collect at /Users/julia/.julia/scratchspaces/a66863c6-20e8-4ff4-8a62-49f30b1f605e/agent-cache/default-honeycrisp-HL2F7YQ3XH.0/build/default-honeycrisp-HL2F7YQ3XH-0/julialang/julia-release-1-dot-10/src/gc.c:3524
maybe_collect at /Users/julia/.julia/scratchspaces/a66863c6-20e8-4ff4-8a62-49f30b1f605e/agent-cache/default-honeycrisp-HL2F7YQ3XH.0/build/default-honeycrisp-HL2F7YQ3XH-0/julialang/julia-release-1-dot-10/src/gc.c:937 [inlined]
jl_gc_pool_alloc_inner at /Users/julia/.julia/scratchspaces/a66863c6-20e8-4ff4-8a62-49f30b1f605e/agent-cache/default-honeycrisp-HL2F7YQ3XH.0/build/default-honeycrisp-HL2F7YQ3XH-0/julialang/julia-release-1-dot-10/src/gc.c:1293 [inlined]
ijl_gc_pool_alloc at /Users/julia/.julia/scratchspaces/a66863c6-20e8-4ff4-8a62-49f30b1f605e/agent-cache/default-honeycrisp-HL2F7YQ3XH.0/build/default-honeycrisp-HL2F7YQ3XH-0/julialang/julia-release-1-dot-10/src/gc.c:1341
model at /Users/mhauru/projects/Enzyme-mwes/segfault_from_slowdown/mwe.jl:65 [inlined]
model at /Users/mhauru/projects/Enzyme-mwes/segfault_from_slowdown/mwe.jl:0 [inlined]
fwddiffejulia_model_1098_inner_1wrap at /Users/mhauru/projects/Enzyme-mwes/segfault_from_slowdown/mwe.jl:0macro expansion at /Users/mhauru/.julia/packages/Enzyme/haqjK/src/compiler.jl:5204 [inlined]
enzyme_call at /Users/mhauru/.julia/packages/Enzyme/haqjK/src/compiler.jl:4750 [inlined]
ForwardModeThunk at /Users/mhauru/.julia/packages/Enzyme/haqjK/src/compiler.jl:4638 [inlined]
runtime_generic_fwd at /Users/mhauru/.julia/packages/Enzyme/haqjK/src/rules/jitrules.jl:303
unknown function (ip:0x132b3c1e3)
_jl_invoke at /Users/julia/.julia/scratchspaces/a66863c6-20e8-4ff4-8a62-49f30b1f605e/agent-cache/default-honeycrisp-HL2F7YQ3XH.0/build/default-honeycrisp-HL2F7YQ3XH-0/julialang/julia-release-1-dot-10/src/gf.c:0 [inlined]
ijl_apply_generic at /Users/julia/.julia/scratchspaces/a66863c6-20e8-4ff4-8a62-49f30b1f605e/agent-cache/default-honeycrisp-HL2F7YQ3XH.0/build/default-honeycrisp-HL2F7YQ3XH-0/julialang/julia-release-1-dot-10/src/gf.c:3077
ldf at /Users/mhauru/projects/Enzyme-mwes/segfault_from_slowdown/mwe.jl:76 [inlined]
fwddiffejulia_ldf_390wrap at /Users/mhauru/projects/Enzyme-mwes/segfault_from_slowdown/mwe.jl:0macro expansion at /Users/mhauru/.julia/packages/Enzyme/haqjK/src/compiler.jl:5204 [inlined]
enzyme_call at /Users/mhauru/.julia/packages/Enzyme/haqjK/src/compiler.jl:4750 [inlined]
ForwardModeThunk at /Users/mhauru/.julia/packages/Enzyme/haqjK/src/compiler.jl:4638 [inlined]
autodiff at /Users/mhauru/.julia/packages/Enzyme/haqjK/src/Enzyme.jl:654 [inlined]
autodiff at /Users/mhauru/.julia/packages/Enzyme/haqjK/src/Enzyme.jl:524 [inlined]
macro expansion at /Users/mhauru/.julia/packages/Enzyme/haqjK/src/sugar.jl:675 [inlined]
#gradient#126 at /Users/mhauru/.julia/packages/Enzyme/haqjK/src/sugar.jl:577
unknown function (ip:0x12f4d413f)
_jl_invoke at /Users/julia/.julia/scratchspaces/a66863c6-20e8-4ff4-8a62-49f30b1f605e/agent-cache/default-honeycrisp-HL2F7YQ3XH.0/build/default-honeycrisp-HL2F7YQ3XH-0/julialang/julia-release-1-dot-10/src/gf.c:0 [inlined]
ijl_apply_generic at /Users/julia/.julia/scratchspaces/a66863c6-20e8-4ff4-8a62-49f30b1f605e/agent-cache/default-honeycrisp-HL2F7YQ3XH.0/build/default-honeycrisp-HL2F7YQ3XH-0/julialang/julia-release-1-dot-10/src/gf.c:3077
gradient at /Users/mhauru/.julia/packages/Enzyme/haqjK/src/sugar.jl:577
top-level scope at /Users/mhauru/projects/Enzyme-mwes/segfault_from_slowdown/mwe.jl:80
jl_toplevel_eval_flex at /Users/julia/.julia/scratchspaces/a66863c6-20e8-4ff4-8a62-49f30b1f605e/agent-cache/default-honeycrisp-HL2F7YQ3XH.0/build/default-honeycrisp-HL2F7YQ3XH-0/julialang/julia-release-1-dot-10/src/toplevel.c:925
jl_eval_module_expr at /Users/julia/.julia/scratchspaces/a66863c6-20e8-4ff4-8a62-49f30b1f605e/agent-cache/default-honeycrisp-HL2F7YQ3XH.0/build/default-honeycrisp-HL2F7YQ3XH-0/julialang/julia-release-1-dot-10/src/toplevel.c:215 [inlined]
jl_toplevel_eval_flex at /Users/julia/.julia/scratchspaces/a66863c6-20e8-4ff4-8a62-49f30b1f605e/agent-cache/default-honeycrisp-HL2F7YQ3XH.0/build/default-honeycrisp-HL2F7YQ3XH-0/julialang/julia-release-1-dot-10/src/toplevel.c:736
jl_toplevel_eval_flex at /Users/julia/.julia/scratchspaces/a66863c6-20e8-4ff4-8a62-49f30b1f605e/agent-cache/default-honeycrisp-HL2F7YQ3XH.0/build/default-honeycrisp-HL2F7YQ3XH-0/julialang/julia-release-1-dot-10/src/toplevel.c:877
ijl_toplevel_eval at /Users/julia/.julia/scratchspaces/a66863c6-20e8-4ff4-8a62-49f30b1f605e/agent-cache/default-honeycrisp-HL2F7YQ3XH.0/build/default-honeycrisp-HL2F7YQ3XH-0/julialang/julia-release-1-dot-10/src/toplevel.c:943 [inlined]
ijl_toplevel_eval_in at /Users/julia/.julia/scratchspaces/a66863c6-20e8-4ff4-8a62-49f30b1f605e/agent-cache/default-honeycrisp-HL2F7YQ3XH.0/build/default-honeycrisp-HL2F7YQ3XH-0/julialang/julia-release-1-dot-10/src/toplevel.c:985
eval at ./boot.jl:385 [inlined]
include_string at ./loading.jl:2076
_jl_invoke at /Users/julia/.julia/scratchspaces/a66863c6-20e8-4ff4-8a62-49f30b1f605e/agent-cache/default-honeycrisp-HL2F7YQ3XH.0/build/default-honeycrisp-HL2F7YQ3XH-0/julialang/julia-release-1-dot-10/src/gf.c:0 [inlined]
ijl_apply_generic at /Users/julia/.julia/scratchspaces/a66863c6-20e8-4ff4-8a62-49f30b1f605e/agent-cache/default-honeycrisp-HL2F7YQ3XH.0/build/default-honeycrisp-HL2F7YQ3XH-0/julialang/julia-release-1-dot-10/src/gf.c:3077
_include at ./loading.jl:2136
include at ./Base.jl:495
jfptr_include_46623.1 at /Users/mhauru/.julia/juliaup/julia-1.10.6+0.aarch64.apple.darwin14/lib/julia/sys.dylib (unknown line)
_jl_invoke at /Users/julia/.julia/scratchspaces/a66863c6-20e8-4ff4-8a62-49f30b1f605e/agent-cache/default-honeycrisp-HL2F7YQ3XH.0/build/default-honeycrisp-HL2F7YQ3XH-0/julialang/julia-release-1-dot-10/src/gf.c:0 [inlined]
ijl_apply_generic at /Users/julia/.julia/scratchspaces/a66863c6-20e8-4ff4-8a62-49f30b1f605e/agent-cache/default-honeycrisp-HL2F7YQ3XH.0/build/default-honeycrisp-HL2F7YQ3XH-0/julialang/julia-release-1-dot-10/src/gf.c:3077
exec_options at ./client.jl:323
_start at ./client.jl:557
jfptr__start_83055.1 at /Users/mhauru/.julia/juliaup/julia-1.10.6+0.aarch64.apple.darwin14/lib/julia/sys.dylib (unknown line)
_jl_invoke at /Users/julia/.julia/scratchspaces/a66863c6-20e8-4ff4-8a62-49f30b1f605e/agent-cache/default-honeycrisp-HL2F7YQ3XH.0/build/default-honeycrisp-HL2F7YQ3XH-0/julialang/julia-release-1-dot-10/src/gf.c:0 [inlined]
ijl_apply_generic at /Users/julia/.julia/scratchspaces/a66863c6-20e8-4ff4-8a62-49f30b1f605e/agent-cache/default-honeycrisp-HL2F7YQ3XH.0/build/default-honeycrisp-HL2F7YQ3XH-0/julialang/julia-release-1-dot-10/src/gf.c:3077
jl_apply at /Users/julia/.julia/scratchspaces/a66863c6-20e8-4ff4-8a62-49f30b1f605e/agent-cache/default-honeycrisp-HL2F7YQ3XH.0/build/default-honeycrisp-HL2F7YQ3XH-0/julialang/julia-release-1-dot-10/src/./julia.h:1982 [inlined]
true_main at /Users/julia/.julia/scratchspaces/a66863c6-20e8-4ff4-8a62-49f30b1f605e/agent-cache/default-honeycrisp-HL2F7YQ3XH.0/build/default-honeycrisp-HL2F7YQ3XH-0/julialang/julia-release-1-dot-10/src/jlapi.c:582
jl_repl_entrypoint at /Users/julia/.julia/scratchspaces/a66863c6-20e8-4ff4-8a62-49f30b1f605e/agent-cache/default-honeycrisp-HL2F7YQ3XH.0/build/default-honeycrisp-HL2F7YQ3XH-0/julialang/julia-release-1-dot-10/src/jlapi.c:731
Allocations:61029141 (Pool:60977960; Big:51181); GC:54
Segmentation fault:11
Enzyme v0.13.22, Julia v1.10.6.
The text was updated successfully, but these errors were encountered:
Hi @wsmoses, as discussed on Slack, I reduced the case where the MWE of #1769 now segfaults. It's not the most minimal, and I don't think I'll have time before January to reduce it further, but it no longer depends on anything in TuringLang.
Output, which seems to be indeterministic:
Enzyme v0.13.22, Julia v1.10.6.
The text was updated successfully, but these errors were encountered: