-
Notifications
You must be signed in to change notification settings - Fork 9
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
precompile first interpretation #353
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks!
Would you mind providing comptimes of first interpretation before and after this PR? Times can vary between machines.
Use SnoopCompile to track invalidation, get several invalidation in the abstract interpreter.
Yeah, that's why there's still time expent on compilation on 2nd, 3rd, ... calls to @code_hlo
. But that's an issue for another PR.
Project.toml
Outdated
@@ -47,6 +48,7 @@ GPUArraysCore = "0.1.6, 0.2" | |||
LinearAlgebra = "1.10" | |||
NNlib = "0.9.24" | |||
OrderedCollections = "1" | |||
PrecompileTools = "1.2.1" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we need to be so exact with the compat version? I prefer leaving it as open as we can to avoid compat conflicts with other libs.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
will relax it
src/precompile.jl
Outdated
XLA.__init__() | ||
@compile_workload begin | ||
x = Reactant.ConcreteRArray(randn(Float64, 2, 2)) | ||
@jit sum(x) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Don't do @jit
but @code_hlo optimize=false
. Problem is first interpretation so just tracing, not compilation.
Also, would you mind checking if XLA.__init__()
and Reactant.__init__()
are still required with @code_hlo optimize=false
? I feel a lil bit nervous with them due to relocation.
Furthermore, it might be more interesting to use GPUCompiler.precompile
as @vchuravy suggested to me because the interpreter we used is based on GPUCompiler.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
it actually is not based on gpucompiler (the enzyme interp is not a descendant of gpuinterpreter)
src/XLA.jl
Outdated
@@ -44,7 +44,7 @@ const cpuclientcount = Ref(0) | |||
# TODO synchronization when async is not working because `future` in `ConcreteRArray` is always `nothing` | |||
function CPUClient(asynchronous=false, node_id=0, num_nodes=1) | |||
global cpuclientcount | |||
@assert cpuclientcount[] == 0 | |||
#@assert cpuclientcount[] == 0 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
mmm is this ok @wsmoses?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
also, why is this assert failing?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@mofeing One create a client for precompilation. And one when we init.
src/precompile.jl
Outdated
|
||
@setup_workload begin | ||
Reactant.__init__() | ||
XLA.__init__() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can we do this without init and just making our own cpuclient?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
and ideally registry
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this would avoid some of the weird "globals" problems in precompilation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
in particular if used we need to carefully init and uninit globals: https://github.com/JuliaGPU/GPUCompiler.jl/blob/a94e6e2b7102f18e4b9aa08c623357a79ac62486/src/precompile.jl#L40
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yeah, like some kind of MockClient
right?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I mean we could literally make a real Cpuclient which isn’t the global client, and make sure to free it
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I tried using ScopedValue
to proper deal with XLA.Client
. But it's quite instable.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ConcreteRArray and related constructors should take an optional client argument
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Using the client argument works extremely well. It goes down to 3s for @code_hlo
. I just need now to deal with Client finalizer.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You don't need to use the client if you just do the Base.code_ircode
I explained below.
so i just tried and check that just calling julia> interp = Reactant.ReactantInterpreter()
julia> @time Base.code_ircode(sum, (Reactant.TracedRArray{Float64,2},); interp)
52.089402 seconds (101.97 M allocations: 5.132 GiB, 2.34% gc time, 100.00% compilation time)
...
julia> @time Base.code_ircode(sum, (Reactant.TracedRArray{Float64,2},); interp)
0.000488 seconds (1.53 k allocations: 67.750 KiB, 92.79% compilation time)
...
julia> @time Base.code_ircode(*, (Reactant.TracedRArray{Int64,2},Reactant.TracedRArray{Int64,2}); interp)
0.829383 seconds (659.11 k allocations: 33.190 MiB, 99.99% compilation time)
... |
Bear in mind as well though that the absint will (hopefully) cache between calls |
I test the precompile with the following:
I suppose we can use both of them.
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Everything's fine from my side then. I'm approving but you need to fix the tests first. There is a problem with the file Enzyme.jl which is quite weird because you haven't touch it? dialects? (Nightly and ubuntu x86-32 bits are ok to fail)
So the direct call to ircode is about to get removed, so this should ideally do the codehlo call or equivalent |
ah really? do we have another mechanism now? |
@mofeing I got errors for macOS 'ERROR: LoadError: StackOverflowError' and the strange Enzyme one with 1.10. Should we use precompilation only with julia 1.11 and excluding MacOS? |
mmm in what arch? I just tried in aarch64-macos and got another error also CI says that there are also problems in linux julia> @jit sum(a)
Internal error: encountered unexpected error in runtime:
MethodError(f=Core.Compiler.:(⊑), args=(Core.Compiler.JLTypeLattice(), (:stmt, :line), Core.TypeofBottom()), world=0x00000000000015ac)
jl_method_error_bare at /Users/julia/.julia/scratchspaces/a66863c6-20e8-4ff4-8a62-49f30b1f605e/agent-cache/default-honeycrisp-XC9YQX9HH2.0/build/default-honeycrisp-XC9YQX9HH2-0/julialang/julia-release-1-dot-10/src/gf.c:2208
jl_method_error at /Users/julia/.julia/scratchspaces/a66863c6-20e8-4ff4-8a62-49f30b1f605e/agent-cache/default-honeycrisp-XC9YQX9HH2.0/build/default-honeycrisp-XC9YQX9HH2-0/julialang/julia-release-1-dot-10/src/gf.c:2226
jl_lookup_generic_ at /Users/julia/.julia/scratchspaces/a66863c6-20e8-4ff4-8a62-49f30b1f605e/agent-cache/default-honeycrisp-XC9YQX9HH2.0/build/default-honeycrisp-XC9YQX9HH2-0/julialang/julia-release-1-dot-10/src/gf.c:3058 [inlined]
ijl_apply_generic at /Users/julia/.julia/scratchspaces/a66863c6-20e8-4ff4-8a62-49f30b1f605e/agent-cache/default-honeycrisp-XC9YQX9HH2.0/build/default-honeycrisp-XC9YQX9HH2-0/julialang/julia-release-1-dot-10/src/gf.c:3073
⊑ at ./compiler/typelattice.jl:530
⊑ at ./compiler/typelattice.jl:508
⊑ at ./compiler/typelattice.jl:397 [inlined]
reprocess_instruction! at ./compiler/ssair/irinterp.jl:169
#_ir_abstract_constant_propagation#511 at ./compiler/ssair/irinterp.jl:251
_ir_abstract_constant_propagation at ./compiler/ssair/irinterp.jl:206
ir_abstract_constant_propagation at ./compiler/ssair/irinterp.jl:384
semi_concrete_eval_call at ./compiler/abstractinterpretation.jl:1168
abstract_call_method_with_const_args at ./compiler/abstractinterpretation.jl:812
abstract_call_method_with_const_args at ./compiler/abstractinterpretation.jl:788
abstract_call_gf_by_type at ./compiler/abstractinterpretation.jl:103
abstract_call_known at ./compiler/abstractinterpretation.jl:2087
abstract_call at ./compiler/abstractinterpretation.jl:2169
abstract_call at ./compiler/abstractinterpretation.jl:2162
abstract_call at ./compiler/abstractinterpretation.jl:2354
abstract_eval_call at ./compiler/abstractinterpretation.jl:2370
abstract_eval_statement_expr at ./compiler/abstractinterpretation.jl:2380
abstract_eval_statement at ./compiler/abstractinterpretation.jl:2624
abstract_eval_basic_statement at ./compiler/abstractinterpretation.jl:2913
typeinf_local at ./compiler/abstractinterpretation.jl:3098
typeinf_nocycle at ./compiler/abstractinterpretation.jl:3186
_typeinf at ./compiler/typeinfer.jl:247
typeinf at ./compiler/typeinfer.jl:216
typeinf_edge at ./compiler/typeinfer.jl:930
abstract_call_method at ./compiler/abstractinterpretation.jl:629
abstract_call_gf_by_type at ./compiler/abstractinterpretation.jl:95
abstract_call_unknown at ./compiler/abstractinterpretation.jl:2156
abstract_call at ./compiler/abstractinterpretation.jl:2166
abstract_call at ./compiler/abstractinterpretation.jl:2162
abstract_call at ./compiler/abstractinterpretation.jl:2354
abstract_eval_call at ./compiler/abstractinterpretation.jl:2370
abstract_eval_statement_expr at ./compiler/abstractinterpretation.jl:2380
abstract_eval_statement at ./compiler/abstractinterpretation.jl:2624
abstract_eval_basic_statement at ./compiler/abstractinterpretation.jl:2889
typeinf_local at ./compiler/abstractinterpretation.jl:3098
typeinf_nocycle at ./compiler/abstractinterpretation.jl:3186
_typeinf at ./compiler/typeinfer.jl:247
typeinf at ./compiler/typeinfer.jl:216
typeinf_ext at ./compiler/typeinfer.jl:1051
typeinf_ext_toplevel at ./compiler/typeinfer.jl:1082
typeinf_ext_toplevel at ./compiler/typeinfer.jl:1078
jfptr_typeinf_ext_toplevel_35906.1 at /Users/mofeing/.julia/juliaup/julia-1.10.7+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-XC9YQX9HH2.0/build/default-honeycrisp-XC9YQX9HH2-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-XC9YQX9HH2.0/build/default-honeycrisp-XC9YQX9HH2-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-XC9YQX9HH2.0/build/default-honeycrisp-XC9YQX9HH2-0/julialang/julia-release-1-dot-10/src/./julia.h:1982 [inlined]
jl_type_infer at /Users/julia/.julia/scratchspaces/a66863c6-20e8-4ff4-8a62-49f30b1f605e/agent-cache/default-honeycrisp-XC9YQX9HH2.0/build/default-honeycrisp-XC9YQX9HH2-0/julialang/julia-release-1-dot-10/src/gf.c:394
jl_generate_fptr_impl at /Users/julia/.julia/scratchspaces/a66863c6-20e8-4ff4-8a62-49f30b1f605e/agent-cache/default-honeycrisp-XC9YQX9HH2.0/build/default-honeycrisp-XC9YQX9HH2-0/julialang/julia-release-1-dot-10/src/jitlayers.cpp:504
jl_compile_method_internal at /Users/julia/.julia/scratchspaces/a66863c6-20e8-4ff4-8a62-49f30b1f605e/agent-cache/default-honeycrisp-XC9YQX9HH2.0/build/default-honeycrisp-XC9YQX9HH2-0/julialang/julia-release-1-dot-10/src/gf.c:2481
_jl_invoke at /Users/julia/.julia/scratchspaces/a66863c6-20e8-4ff4-8a62-49f30b1f605e/agent-cache/default-honeycrisp-XC9YQX9HH2.0/build/default-honeycrisp-XC9YQX9HH2-0/julialang/julia-release-1-dot-10/src/gf.c:2887 [inlined]
ijl_apply_generic at /Users/julia/.julia/scratchspaces/a66863c6-20e8-4ff4-8a62-49f30b1f605e/agent-cache/default-honeycrisp-XC9YQX9HH2.0/build/default-honeycrisp-XC9YQX9HH2-0/julialang/julia-release-1-dot-10/src/gf.c:3077
#make_mlir_fn#25 at /Users/mofeing/Developer/Reactant.jl/src/utils.jl:120
make_mlir_fn at /Users/mofeing/Developer/Reactant.jl/src/utils.jl:40 [inlined]
#10 at /Users/mofeing/Developer/Reactant.jl/src/Compiler.jl:295 [inlined]
block! at /Users/mofeing/Developer/Reactant.jl/src/mlir/IR/Block.jl:201
#9 at /Users/mofeing/Developer/Reactant.jl/src/Compiler.jl:294 [inlined]
mmodule! at /Users/mofeing/Developer/Reactant.jl/src/mlir/IR/Module.jl:92
jfptr_mmoduleNOT._18679 at /Users/mofeing/.julia/compiled/v1.10/Reactant/p9PzF_pjiEo.dylib (unknown line)
_jl_invoke at /Users/julia/.julia/scratchspaces/a66863c6-20e8-4ff4-8a62-49f30b1f605e/agent-cache/default-honeycrisp-XC9YQX9HH2.0/build/default-honeycrisp-XC9YQX9HH2-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-XC9YQX9HH2.0/build/default-honeycrisp-XC9YQX9HH2-0/julialang/julia-release-1-dot-10/src/gf.c:3077
#compile_mlir!#8 at /Users/mofeing/Developer/Reactant.jl/src/Compiler.jl:291
compile_mlir! at /Users/mofeing/Developer/Reactant.jl/src/Compiler.jl:290 [inlined]
#34 at /Users/mofeing/Developer/Reactant.jl/src/Compiler.jl:698
context! at /Users/mofeing/Developer/Reactant.jl/src/mlir/IR/Context.jl:76
unknown function (ip: 0x13c96018b)
_jl_invoke at /Users/julia/.julia/scratchspaces/a66863c6-20e8-4ff4-8a62-49f30b1f605e/agent-cache/default-honeycrisp-XC9YQX9HH2.0/build/default-honeycrisp-XC9YQX9HH2-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-XC9YQX9HH2.0/build/default-honeycrisp-XC9YQX9HH2-0/julialang/julia-release-1-dot-10/src/gf.c:3077
#compile_xla#33 at /Users/mofeing/Developer/Reactant.jl/src/Compiler.jl:695
compile_xla at /Users/mofeing/Developer/Reactant.jl/src/Compiler.jl:690 [inlined]
#compile#38 at /Users/mofeing/Developer/Reactant.jl/src/Compiler.jl:722
compile at /Users/mofeing/Developer/Reactant.jl/src/Compiler.jl:721
unknown function (ip: 0x12effc077)
_jl_invoke at /Users/julia/.julia/scratchspaces/a66863c6-20e8-4ff4-8a62-49f30b1f605e/agent-cache/default-honeycrisp-XC9YQX9HH2.0/build/default-honeycrisp-XC9YQX9HH2-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-XC9YQX9HH2.0/build/default-honeycrisp-XC9YQX9HH2-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-XC9YQX9HH2.0/build/default-honeycrisp-XC9YQX9HH2-0/julialang/julia-release-1-dot-10/src/./julia.h:1982 [inlined]
do_call at /Users/julia/.julia/scratchspaces/a66863c6-20e8-4ff4-8a62-49f30b1f605e/agent-cache/default-honeycrisp-XC9YQX9HH2.0/build/default-honeycrisp-XC9YQX9HH2-0/julialang/julia-release-1-dot-10/src/interpreter.c:126
eval_body at /Users/julia/.julia/scratchspaces/a66863c6-20e8-4ff4-8a62-49f30b1f605e/agent-cache/default-honeycrisp-XC9YQX9HH2.0/build/default-honeycrisp-XC9YQX9HH2-0/julialang/julia-release-1-dot-10/src/interpreter.c:0
jl_interpret_toplevel_thunk at /Users/julia/.julia/scratchspaces/a66863c6-20e8-4ff4-8a62-49f30b1f605e/agent-cache/default-honeycrisp-XC9YQX9HH2.0/build/default-honeycrisp-XC9YQX9HH2-0/julialang/julia-release-1-dot-10/src/interpreter.c:775
top-level scope at /Users/mofeing/Developer/Reactant.jl/src/Compiler.jl:475
jl_toplevel_eval_flex at /Users/julia/.julia/scratchspaces/a66863c6-20e8-4ff4-8a62-49f30b1f605e/agent-cache/default-honeycrisp-XC9YQX9HH2.0/build/default-honeycrisp-XC9YQX9HH2-0/julialang/julia-release-1-dot-10/src/toplevel.c:934
jl_toplevel_eval_flex at /Users/julia/.julia/scratchspaces/a66863c6-20e8-4ff4-8a62-49f30b1f605e/agent-cache/default-honeycrisp-XC9YQX9HH2.0/build/default-honeycrisp-XC9YQX9HH2-0/julialang/julia-release-1-dot-10/src/toplevel.c:877
jl_toplevel_eval_flex at /Users/julia/.julia/scratchspaces/a66863c6-20e8-4ff4-8a62-49f30b1f605e/agent-cache/default-honeycrisp-XC9YQX9HH2.0/build/default-honeycrisp-XC9YQX9HH2-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-XC9YQX9HH2.0/build/default-honeycrisp-XC9YQX9HH2-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-XC9YQX9HH2.0/build/default-honeycrisp-XC9YQX9HH2-0/julialang/julia-release-1-dot-10/src/toplevel.c:985
eval at ./boot.jl:385 [inlined]
eval_user_input at /Users/julia/.julia/scratchspaces/a66863c6-20e8-4ff4-8a62-49f30b1f605e/agent-cache/default-honeycrisp-XC9YQX9HH2.0/build/default-honeycrisp-XC9YQX9HH2-0/julialang/julia-release-1-dot-10/usr/share/julia/stdlib/v1.10/REPL/src/REPL.jl:150
repl_backend_loop at /Users/julia/.julia/scratchspaces/a66863c6-20e8-4ff4-8a62-49f30b1f605e/agent-cache/default-honeycrisp-XC9YQX9HH2.0/build/default-honeycrisp-XC9YQX9HH2-0/julialang/julia-release-1-dot-10/usr/share/julia/stdlib/v1.10/REPL/src/REPL.jl:246
#start_repl_backend#46 at /Users/julia/.julia/scratchspaces/a66863c6-20e8-4ff4-8a62-49f30b1f605e/agent-cache/default-honeycrisp-XC9YQX9HH2.0/build/default-honeycrisp-XC9YQX9HH2-0/julialang/julia-release-1-dot-10/usr/share/julia/stdlib/v1.10/REPL/src/REPL.jl:231
start_repl_backend at /Users/julia/.julia/scratchspaces/a66863c6-20e8-4ff4-8a62-49f30b1f605e/agent-cache/default-honeycrisp-XC9YQX9HH2.0/build/default-honeycrisp-XC9YQX9HH2-0/julialang/julia-release-1-dot-10/usr/share/julia/stdlib/v1.10/REPL/src/REPL.jl:228
_jl_invoke at /Users/julia/.julia/scratchspaces/a66863c6-20e8-4ff4-8a62-49f30b1f605e/agent-cache/default-honeycrisp-XC9YQX9HH2.0/build/default-honeycrisp-XC9YQX9HH2-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-XC9YQX9HH2.0/build/default-honeycrisp-XC9YQX9HH2-0/julialang/julia-release-1-dot-10/src/gf.c:3077
#run_repl#59 at /Users/julia/.julia/scratchspaces/a66863c6-20e8-4ff4-8a62-49f30b1f605e/agent-cache/default-honeycrisp-XC9YQX9HH2.0/build/default-honeycrisp-XC9YQX9HH2-0/julialang/julia-release-1-dot-10/usr/share/julia/stdlib/v1.10/REPL/src/REPL.jl:389
run_repl at /Users/julia/.julia/scratchspaces/a66863c6-20e8-4ff4-8a62-49f30b1f605e/agent-cache/default-honeycrisp-XC9YQX9HH2.0/build/default-honeycrisp-XC9YQX9HH2-0/julialang/julia-release-1-dot-10/usr/share/julia/stdlib/v1.10/REPL/src/REPL.jl:375
jfptr_run_repl_92227.1 at /Users/mofeing/.julia/juliaup/julia-1.10.7+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-XC9YQX9HH2.0/build/default-honeycrisp-XC9YQX9HH2-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-XC9YQX9HH2.0/build/default-honeycrisp-XC9YQX9HH2-0/julialang/julia-release-1-dot-10/src/gf.c:3077
#1014 at ./client.jl:437
jfptr_YY.1014_83184.1 at /Users/mofeing/.julia/juliaup/julia-1.10.7+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-XC9YQX9HH2.0/build/default-honeycrisp-XC9YQX9HH2-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-XC9YQX9HH2.0/build/default-honeycrisp-XC9YQX9HH2-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-XC9YQX9HH2.0/build/default-honeycrisp-XC9YQX9HH2-0/julialang/julia-release-1-dot-10/src/./julia.h:1982 [inlined]
jl_f__call_latest at /Users/julia/.julia/scratchspaces/a66863c6-20e8-4ff4-8a62-49f30b1f605e/agent-cache/default-honeycrisp-XC9YQX9HH2.0/build/default-honeycrisp-XC9YQX9HH2-0/julialang/julia-release-1-dot-10/src/builtins.c:812
#invokelatest#2 at ./essentials.jl:892 [inlined]
invokelatest at ./essentials.jl:889 [inlined]
run_main_repl at ./client.jl:421
exec_options at ./client.jl:338
_start at ./client.jl:557
jfptr__start_83210.1 at /Users/mofeing/.julia/juliaup/julia-1.10.7+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-XC9YQX9HH2.0/build/default-honeycrisp-XC9YQX9HH2-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-XC9YQX9HH2.0/build/default-honeycrisp-XC9YQX9HH2-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-XC9YQX9HH2.0/build/default-honeycrisp-XC9YQX9HH2-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-XC9YQX9HH2.0/build/default-honeycrisp-XC9YQX9HH2-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-XC9YQX9HH2.0/build/default-honeycrisp-XC9YQX9HH2-0/julialang/julia-release-1-dot-10/src/jlapi.c:731
ERROR: TypeError: in new, expected DataType, got a value of type Tuple{Symbol, Symbol}
Stacktrace:
[1] (NamedTuple{(:interp,)})(args::Tuple{Enzyme.Compiler.Interpreter.EnzymeInterpreter{typeof(Reactant.set_reactant_abi)}})
@ Core ./boot.jl:622
[2] (::Reactant.var"#32#42")()
@ Reactant ~/Developer/Reactant.jl/src/utils.jl:135
[3] block!(f::Any, blk::Reactant.MLIR.IR.Block)
@ Reactant.MLIR.IR ~/Developer/Reactant.jl/src/mlir/IR/Block.jl:201
[4] make_mlir_fn(f::Function, args::Tuple{ConcreteRArray{Float64, 2}}, kwargs::Tuple{}, name::String, concretein::Bool; toscalar::Bool, return_dialect::Symbol, no_args_in_result::Bool, construct_function_without_args::Bool, do_transpose::Bool)
@ Reactant ~/Developer/Reactant.jl/src/utils.jl:120
[5] make_mlir_fn
@ ~/Developer/Reactant.jl/src/utils.jl:40 [inlined]
[6] #10
@ ~/Developer/Reactant.jl/src/Compiler.jl:295 [inlined]
[7] block!(f::Reactant.Compiler.var"#10#15"{typeof(sum), Tuple{ConcreteRArray{Float64, 2}}}, blk::Reactant.MLIR.IR.Block)
@ Reactant.MLIR.IR ~/Developer/Reactant.jl/src/mlir/IR/Block.jl:201
[8] #9
@ ~/Developer/Reactant.jl/src/Compiler.jl:294 [inlined]
[9] mmodule!(f::Reactant.Compiler.var"#9#14"{Reactant.MLIR.IR.Module, typeof(sum), Tuple{ConcreteRArray{Float64, 2}}}, blk::Reactant.MLIR.IR.Module)
@ Reactant.MLIR.IR ~/Developer/Reactant.jl/src/mlir/IR/Module.jl:92
[10] compile_mlir!(mod::Reactant.MLIR.IR.Module, f::Function, args::Tuple{ConcreteRArray{Float64, 2}}; optimize::Bool)
@ Reactant.Compiler ~/Developer/Reactant.jl/src/Compiler.jl:291
[11] compile_mlir!
@ ~/Developer/Reactant.jl/src/Compiler.jl:290 [inlined]
[12] (::Reactant.Compiler.var"#34#36"{Bool, typeof(sum), Tuple{ConcreteRArray{Float64, 2}}})()
@ Reactant.Compiler ~/Developer/Reactant.jl/src/Compiler.jl:698
[13] context!(f::Reactant.Compiler.var"#34#36"{Bool, typeof(sum), Tuple{ConcreteRArray{Float64, 2}}}, ctx::Reactant.MLIR.IR.Context)
@ Reactant.MLIR.IR ~/Developer/Reactant.jl/src/mlir/IR/Context.jl:76
[14] compile_xla(f::Function, args::Tuple{ConcreteRArray{Float64, 2}}; client::Nothing, optimize::Bool)
@ Reactant.Compiler ~/Developer/Reactant.jl/src/Compiler.jl:695
[15] compile_xla
@ ~/Developer/Reactant.jl/src/Compiler.jl:690 [inlined]
[16] compile(f::Function, args::Tuple{ConcreteRArray{Float64, 2}}; client::Nothing, optimize::Bool, sync::Bool)
@ Reactant.Compiler ~/Developer/Reactant.jl/src/Compiler.jl:722
[17] top-level scope
@ ~/Developer/Reactant.jl/src/Compiler.jl:475 |
but yeah, it's ok to disable for macOS on Julia 1.10 if you can't make it work also, does this happen for all OS in Julia 1.10? if so, then it's probably sth that we can't solve. but if it just happens, then it might a bug and we should report |
I was just looking to [Julia 1.11 - integration - ubuntu-20.04 - x64 - packaged libReactant - assertions=false - pull_request]. Right there is several kinds of error. For instance, one gets 'ParseError' with [Julia 1.10 - neural_networks - macOS-latest - x64]. I manage to reproduce a error locally. It occurs when I use 'Pkg.test()', direct usage work correctly. |
CI is still not working... and the issue seems to be coverage? It's very weird that you're having a I have tried it out locally and works so... very weird. @glou-nes do you mind asking in Slack's #github-actions channel maybe? |
lol, so it seems like there is a bug in PrecompileTools with coverage? |
For which one do you find that? I don't understand why it's failing in so many different ways. @mofeing I think I don't understand the problem enough to provide a useful reduced reproducer for #github-actions. Do you know which checks must success? |
so you should check all the combinations that fulfill "ubuntu or macos, x64, Julia 1.10 or 1.11"
so in this commit from you 8c5a1cf do you mind trying to run an empty |
Sure! I switch to use a CI defined ENV to enable PrecompileTools. It's working! I don't know if that make much sense to run this in CI anyways. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think #377 fixes the problem between coverage and PrecompileTools.
I also reviewed some code to clean.
@mofeing only the covering one seems to be corrected. We still get |
This reverts commit a688556.
I dived into this on a 1.10 debug build. It looks like there's some invalid state during deserialization (that at first glance appears to be a julia bug not one of ours). |
This does trigger on different methods at different times, but I’m really confused how/why since presumably the serialization won’t change ? |
Memory corruption? |
Also the fact that this is busted on 1.10 and not 1.11 [combined with the serialization itself being awry] makes me really think this is a Julia bug. |
Partial fix #348
remove a assertion in XLA. Get some result.
Now:
On master:
Use
SnoopCompile
to track invalidation, get several invalidation in the abstract interpreter. I already get similar invalidation because of REPL abstract interpreter in Julia 1.12. I don't know how to fix it. Some in the list are probably easier to handle.