-
Notifications
You must be signed in to change notification settings - Fork 81
Closed
Description
The following errors on both 1.10 and 1.11 with Illegal replace ficticious phi for: %unbox37.unpack77.unpack_replacementA = phi {} addrspace(10)* , !dbg !62 of %unbox37.unpack77.unpack = load {} addrspace(10)*, {} addrspace(10)* addrspace(11)* %unbox37.unpack77.elt, align 8, !dbg !81, !enzyme_type !86, !enzyme_inactive !0, !enzymejl_byref_MUT_REF !0, !enzymejl_source_type_Dict\7BVN\2C\20Int64\7D !0.
Only reverse-mode errors; forward-mode is fine on both versions.
import Enzyme: Enzyme, Forward, Reverse, set_runtime_activity, Const
struct VN end
vnm = VN()
struct MyMD{
TIdcs<:Dict{<:Any,Int},
TVal<:AbstractVector{<:Real},
}
idcs::TIdcs
ranges::Vector{UnitRange{Int}}
vals::TVal
end
struct MyVI{S,M,A}
s::S
m::M
a::A
end
function tass(vn, vi)
md = vi.s
i = md.idcs[vn]
r = md.ranges[i]
y = md.vals[r]
x = only(y)
return x, vi
end
function modelf(vi, x=[1.5, 2.0])
s = Vector{Float64}(undef, length(x))
for i in eachindex(s)
s[i], vi = tass(i, vi)
end
j = vi.m.idcs[vnm]
return vi
end
function g(a)
return iterate([]) === nothing ? a : a
end
function f(x)
md_s = MyMD(
Dict(1 => 1, 2 => 2),
[1:1, 2:2],
x[1:2],
)
md_m = MyMD(
Dict(vnm => 1),
[1:2],
x[3:4],
)
vi = MyVI(md_s, md_m, 0.0)
new_vi = modelf(vi)
return g(0.0)
end
x = fill(0.5, 4)
f(x)
Enzyme.gradient(set_runtime_activity(Reverse), f, x)Full error: https://gist.github.com/penelopeysm/0b03d8670bf5f754278784ce72c84268
Versions and stuff:
(ppl) pkg> st
Status `~/ppl/Project.toml`
[7da242da] Enzyme v0.13.75
julia> versioninfo()
Julia Version 1.11.6
Commit 9615af0f269 (2025-07-09 12:58 UTC)
Build Info:
Official https://julialang.org/ release
Platform Info:
OS: macOS (arm64-apple-darwin24.0.0)
CPU: 10 × Apple M1 Pro
WORD_SIZE: 64
LLVM: libLLVM-16.0.6 (ORCJIT, apple-m1)
Threads: 1 default, 0 interactive, 1 GC (on 8 virtual cores)The Turing model that errors looks like this: (cf. https://turinglang.org/ADTests/ - I reran the table today)
@model function demo_dot_assume_observe_index(
x = [1.5, 2.0],
::Type{TV} = Vector{Float64},
) where {TV}
s = TV(undef, length(x))
s .~ InverseGamma(2, 3)
m = TV(undef, length(x))
m ~ product_distribution(Normal.(0, sqrt.(s)))
for i in eachindex(x)
x[i] ~ Normal(m[i], sqrt(s[i]))
end
endMetadata
Metadata
Assignees
Labels
No labels