Skip to content
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

Pass primal to getfield rev for debugging #1801

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/compiler.jl
Original file line number Diff line number Diff line change
Expand Up @@ -3244,7 +3244,7 @@ for (k, v) in (
("enz_runtime_jl_getfield_rev", Enzyme.Compiler.rt_jl_getfield_rev),

("enz_runtime_idx_jl_getfield_aug", Enzyme.Compiler.idx_jl_getfield_aug),
("enz_runtime_idx_jl_getfield_rev", Enzyme.Compiler.idx_jl_getfield_aug),
("enz_runtime_idx_jl_getfield_rev", Enzyme.Compiler.idx_jl_getfield_rev),

("enz_runtime_jl_setfield_aug", Enzyme.Compiler.rt_jl_setfield_aug),
("enz_runtime_jl_setfield_rev", Enzyme.Compiler.rt_jl_setfield_rev),
Expand Down
4 changes: 3 additions & 1 deletion src/rules/typeunstablerules.jl
Original file line number Diff line number Diff line change
Expand Up @@ -796,7 +796,7 @@ end
end
end

function idx_jl_getfield_rev(dptr::T, dret, ::Type{Val{symname}}, ::Val{isconst}, dptrs::Vararg{T2, Nargs}) where {T, T2, Nargs, symname, isconst}
function idx_jl_getfield_rev(primal, dptr::T, dret, ::Type{Val{symname}}, ::Val{isconst}, dptrs::Vararg{T2, Nargs}) where {T, T2, Nargs, symname, isconst}
cur = if dptr isa Base.RefValue
Base.getfield(dptr[], symname+1)
else
Expand Down Expand Up @@ -1135,6 +1135,8 @@ end
end

vals = LLVM.Value[]

push!(vals, lookup_value(gutils, new_from_original(gutils, ops[1]), B))
push!(vals, inps[1])

push!(vals, tape)
Expand Down
Loading