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

bpart-related IR verification regression #57329

Closed
maleadt opened this issue Feb 10, 2025 · 4 comments · Fixed by #57420
Closed

bpart-related IR verification regression #57329

maleadt opened this issue Feb 10, 2025 · 4 comments · Fixed by #57420
Labels
regression Regression in behavior compared to a previous version

Comments

@maleadt
Copy link
Member

maleadt commented Feb 10, 2025

Many packages on PkgEval started to fail with:

Unbound or partitioned GlobalRef not allowed in value position
WARNING: Detected access to binding `IRShow.debuginfo_firstline` in a world prior to its definition world.
  Julia 1.12 has introduced more strict world age semantics for global bindings.
  !!! This code may malfunction under Revise.
  !!! This code will error in future versions of Julia.
Hint: Add an appropriate `invokelatest` around the access to this binding.
Internal error: during type inference of
represent(QuantumInformation.HermitianBasis{Array{Base.Complex{Float64}, 2}}, Array{Int64, 2})
Encountered unexpected error in runtime:
ErrorException("IR verification failed.\n    Code location: broadcast.jl:227\n  Method instance: MethodInstance for similar(::Base.Broadcast.Broadcasted{NewStyle} where NewStyle<:(Base.Broadcast.DefaultArrayStyle), ::DataType)")

Example: FileTrees.jl

I haven't bisected this yet; the whole changeset includes e485be8...79ce168, out of which #57230 looks the most suspicious (cc @Keno).

@maleadt maleadt added the regression Regression in behavior compared to a previous version label Feb 10, 2025
@KristofferC KristofferC marked this as a duplicate of #57330 Feb 10, 2025
@KristofferC
Copy link
Member

The IRShow.debuginfo_firstline is in Base:

file, line = IRShow.debuginfo_firstline(di)

There is another instance where this is called with invokelatest:

firstline = invokelatest(IRShow.debuginfo_firstline, ir.debuginfo)

No idea if an invokelatest is also needed there.

@maleadt
Copy link
Member Author

maleadt commented Feb 10, 2025

Bisected to #57213 (which isn't in the diff I was looking at; I probably mixed something up).

@maleadt
Copy link
Member Author

maleadt commented Feb 10, 2025

MWE, reduced from FileTrees->Dagger->ArnoldiMethod->Graphs

FileTrees.jl

module FileTrees
export FileTree, File, maketree
struct FileTree
    children::Vector
end
function setparent(x::FileTree, parent=parent)
    copy!(p.children, setparent.(x.children, 0))
end
maketree(node) = setparent(_maketree0)
macro spawn(exs...)
    ex = exs[end]
    return _par(__module__, ex)
end
function _par(mod, ex::Expr; lazy=false)
    if false
    elseif lazy
        return Expr(ex.head, _par_inner.(Ref, ex.args, lazy=lazy, recur=recur, opts=opts)...)
    end
end
function mutable()
    return fetch(@spawn scope=scope _mutable_inner())
end
struct StaticArrayStyle{N} <: Base.Broadcast.AbstractArrayStyle{N} end
Broadcast._axes(bc::Base.Broadcast.Broadcasted{<:StaticArrayStyle}, ::Nothing) = static_combine_axes(bc.args...)
end
❯ JULIA_LOAD_PATH=. ./build/dev/julia
               _
   _       _ _(_)_     |  Documentation: https://docs.julialang.org
  (_)     | (_) (_)    |
   _ _   _| |_  __ _   |  Type "?" for help, "]?" for Pkg help.
  | | | | | | |/ _` |  |
  | | |_| | | | (_| |  |  Version 1.13.0-DEV.25 (2025-02-09)
 _/ |\__'_|_|_|\__'_|  |  Commit c269329aec* (0 days old master)
|__/                   |

julia> using FileTrees
[ Info: Precompiling FileTrees [top-level]

julia> maketree([])
Unbound or partitioned GlobalRef not allowed in value position
WARNING: Detected access to binding `IRShow.debuginfo_firstline` in a world prior to its definition world.
  Julia 1.12 has introduced more strict world age semantics for global bindings.
  !!! This code may malfunction under Revise.
  !!! This code will error in future versions of Julia.
Hint: Add an appropriate `invokelatest` around the access to this binding.
Internal error: during type inference of
maketree(Array{Any, 1})
Encountered unexpected error in runtime:
ErrorException("IR verification failed.\n    Code location: broadcast.jl:634\n  Method instance: MethodInstance for checkbounds(::Base.Broadcast.Broadcasted, ::CartesianIndex)")
error at ./error.jl:54
unknown function (ip: 0x7264cef06bca) at (unknown file)
_jl_invoke at /home/tim/Julia/src/julia/src/gf.c:3475 [inlined]
ijl_apply_generic at /home/tim/Julia/src/julia/src/gf.c:3675
jl_apply at /home/tim/Julia/src/julia/src/julia.h:2293 [inlined]
jl_f__call_latest at /home/tim/Julia/src/julia/src/builtins.c:883
_jl_invoke at /home/tim/Julia/src/julia/src/gf.c:3456 [inlined]
ijl_apply_generic at /home/tim/Julia/src/julia/src/gf.c:3675
jl_apply at /home/tim/Julia/src/julia/src/julia.h:2293 [inlined]
do_apply at /home/tim/Julia/src/julia/src/builtins.c:839
#invokelatest#1 at ./essentials.jl:1057
_jl_invoke at /home/tim/Julia/src/julia/src/gf.c:3456 [inlined]
ijl_apply_generic at /home/tim/Julia/src/julia/src/gf.c:3675
jl_apply at /home/tim/Julia/src/julia/src/julia.h:2293 [inlined]
do_apply at /home/tim/Julia/src/julia/src/builtins.c:839
invokelatest at ./essentials.jl:1053
_jl_invoke at /home/tim/Julia/src/julia/src/gf.c:3456 [inlined]
ijl_apply_generic at /home/tim/Julia/src/julia/src/gf.c:3675
jl_apply at /home/tim/Julia/src/julia/src/julia.h:2293 [inlined]
do_apply at /home/tim/Julia/src/julia/src/builtins.c:839
raise_error at ./../build/dev/usr/share/julia/Compiler/src/ssair/verify.jl:126
jfptr_raise_error_123734 at /home/tim/Julia/src/julia/build/dev/usr/lib/julia/sys.so (unknown line)
_jl_invoke at /home/tim/Julia/src/julia/src/gf.c:3456 [inlined]
ijl_apply_generic at /home/tim/Julia/src/julia/src/gf.c:3675
check_op at ./../build/dev/usr/share/julia/Compiler/src/ssair/verify.jl:74
verify_ir at ./../build/dev/usr/share/julia/Compiler/src/ssair/verify.jl:430

@vtjnash
Copy link
Member

vtjnash commented Feb 10, 2025

This check is wrong now, since Base does exist early, while it is trying to check if this verify call is part of the Compiler or "user" code. It is now getting always-true, rather than the expected desirable result (which seems to be always-false by the comment there):

if isdefined(Core, :Main) && isdefined(Core.Main, :Base)

Keno added a commit that referenced this issue Feb 15, 2025
Should fix the error part of #57329. I also cannot reproduce the underlying
assertion error on master, so that was likely fixed in one of the other PRs.
Closes #57329 as a result, but of course there could be other issues with
the same symptoms, which can get their own issues.
@Keno Keno closed this as completed in 88b292d Feb 15, 2025
KristofferC pushed a commit that referenced this issue Feb 15, 2025
Should fix the error part of #57329. I also cannot reproduce the
underlying assertion error on master, so that was likely fixed in one of
the other PRs. Closes #57329 as a result, but of course there could be
other issues with the same symptoms, which can get their own issues.

(cherry picked from commit 88b292d)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
regression Regression in behavior compared to a previous version
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants