-
Notifications
You must be signed in to change notification settings - Fork 69
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
GC error #2157
Comments
When you have a moment, I'd be really curious for you to run the code and see if it reproduces on your machine, because again I'm so confused about what's happened |
oh, can you update to the latest Julia 1.10 -- in this case Julia 1.10.7 ? |
How do I update to a specific Julia? I only know how to go to the latest version, which I think is 1.11 (and still doesn't work with Enzyme?) |
Or should I try 1.11? |
I think juliaup update 1.10 or something? |
juliaup is giving me issues (namely I installed and then it still says it's not installed), give me a sec |
Still hit it on Julia v1.10.7 (sorry for the delay, it took a really long time to compile packages and then it takes a while for the code to run/hit the error) |
In the repo I made a new branch called old-state that is one commit behind the one I reverted to, and the code still runs there, so it's something between this and the one you're on that causes the error maybe? |
I made a branch on the repo sigseg trying to minimize it |
wmoses@beast:~/git/eddy-stresses (sigseg) $ cat technical_paper.jl
using Enzyme
using Checkpointing
Enzyme.API.printall!(true)
Enzyme.Compiler.DumpPostOpt[] = true
mutable struct MyPrognosticVars{T<:AbstractFloat}
u::Array{T,2} # u-velocity
nu::Array{T,2} # sea surface height / interface displacement
end
mutable struct MyModelSetup
i::Int
J::Float64
halo::Int
nt::Int
Prog::MyPrognosticVars{Float32}
h::Matrix{Float64}
t::Int # SW: I believe this has something to do with Checkpointing, need to verify
end
function checkpointed_integration(S, scheme)
h = S.h
nu = S.Prog.nu
@inbounds h[1] = 2.7
@checkpoint_struct scheme S for S.i = 1:S.nt
Prog = S.Prog
halo = S.halo
# undo scaling as well
@views ucut = S.Prog.u[halo+1:end-halo,halo+1:end-halo]
ηcut = S.Prog.nu
temp = MyPrognosticVars{Float64}(ucut, ηcut)
energy_lr = first(temp.u.^2)
S.J += energy_lr
end
return
end
function mymodel_setup()
nt = 6733
S = MyModelSetup(0, 0.0, 2, nt,MyPrognosticVars{Float32}(ones(Float32, 131, 132),ones(Float32, 130, 130)),ones(Float64, 130, 130),0)
return S
end
function run_adjoint_plusfd()
S = mymodel_setup()
dS = Enzyme.make_zero(S)
snaps = Int(floor(sqrt(S.nt)))
revolve = Revolve{MyModelSetup}(S.nt,
snaps;
gc=true,
)
autodiff(Enzyme.Reverse, checkpointed_integration, Duplicated(S, dS), Const(revolve))
end
diffs, enzyme_deriv, S, dS = run_adjoint_plusfd() |
using Enzyme, LLVM
ctx = LLVM.Context()
activate(ctx)
mod = """
source_filename = "start"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128-ni:10:11:12:13"
target triple = "x86_64-linux-gnu"
declare noalias nonnull {} addrspace(10)* @julia.gc_alloc_obj({}**, i64, {} addrspace(10)*) local_unnamed_addr #5
define internal fastcc nonnull {} addrspace(10)* @julia_MyPrognosticVars_161({} addrspace(10)* %v1, {} addrspace(10)* %v2) {
top:
%newstruct = call noalias nonnull dereferenceable(16) {} addrspace(10)* @julia.gc_alloc_obj({}** null, i64 16, {} addrspace(10)* addrspacecast ({}* inttoptr (i64 129778359735376 to {}*) to {} addrspace(10)*)) #30
%a31 = addrspacecast {} addrspace(10)* %newstruct to {} addrspace(10)* addrspace(11)*
%a32 = getelementptr inbounds {} addrspace(10)*, {} addrspace(10)* addrspace(11)* %a31, i64 1
store atomic {} addrspace(10)* %v1, {} addrspace(10)* addrspace(11)* %a31 release, align 8
%a33 = addrspacecast {} addrspace(10)* %newstruct to i8 addrspace(11)*
%a34 = getelementptr inbounds i8, i8 addrspace(11)* %a33, i64 8
%a35 = bitcast i8 addrspace(11)* %a34 to {} addrspace(10)* addrspace(11)*
store atomic {} addrspace(10)* %v2, {} addrspace(10)* addrspace(11)* %a35 release, align 8
ret {} addrspace(10)* %newstruct
}
define {} addrspace(10)* @caller({} addrspace(10)* %v1, {} addrspace(10)* %v2) {
top:
%ac = call fastcc nonnull {} addrspace(10)* @julia_MyPrognosticVars_161({} addrspace(10)* %v1, {} addrspace(10)* %v2)
%b = addrspacecast {} addrspace(10)* %ac to {} addrspace(10)* addrspace(11)*
%c = load atomic {} addrspace(10)*, {} addrspace(10)* addrspace(11)* %b unordered, align 8
ret {} addrspace(10)* %c
}
attributes #5 = { inaccessiblememonly mustprogress nofree nounwind willreturn allockind("alloc,uninitialized") allocsize(1) "enzyme_no_escaping_allocation" "enzymejl_world"="31504" }
"""
mod = parse(LLVM.Module, mod)
Enzyme.Compiler.removeDeadArgs!(mod, Enzyme.Compiler.JIT.get_tm())
println(string(mod)) |
@wsmoses Opening an issue for the GC error I see, I added you to the repo where my code is, it's a private one in the DJ4Earth repository. Running
julia --project=. technical_paper.jl
should reproduce what I've been seeing. The error isNotes on the bug:
I tried changing package versions, so attempted
Also, I'm currently on Julia 1.10.0.
The text was updated successfully, but these errors were encountered: