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

irinterp error from ModelBaseEcon.jl test suite #47688

Closed
aviatesk opened this issue Nov 24, 2022 · 0 comments
Closed

irinterp error from ModelBaseEcon.jl test suite #47688

aviatesk opened this issue Nov 24, 2022 · 0 comments
Labels
compiler:inference Type inference

Comments

@aviatesk
Copy link
Member

julia> versioninfo()
Julia Version 1.10.0-DEV.43
Commit 113efb6e0a (2022-11-23 22:11 UTC)
Platform Info:
  OS: macOS (x86_64-apple-darwin21.6.0)
  CPU: 8 × Intel(R) Core(TM) i5-1038NG7 CPU @ 2.00GHz
  WORD_SIZE: 64
  LIBM: libopenlibm
  LLVM: libLLVM-14.0.6 (ORCJIT, icelake-client)
  Threads: 4 on 8 virtual cores

julia> using ModelBaseEcon

julia> o = Options(tol=1e-7, maxiter=25)
2 Options:
    maxiter = 25
    tol = 1.0e-7

julia> @code_typed getoption(o, abstol=1e-10, name="")
ERROR: AssertionError: false && "TODO"
Stacktrace:
  [1] kill_def_use!(tpdum::Core.Compiler.TwoPhaseDefUseMap, def::Int64, use::Int64)
    @ Core.Compiler ./compiler/ssair/irinterp.jl:69
  [2] kill_def_use!
    @ ./compiler/ssair/irinterp.jl:72 [inlined]
  [3] reprocess_instruction!(interp::Core.Compiler.NativeInterpreter, idx::Int64, bb::Nothing, inst::Any, typ::Any, irsv::Core.Compiler.IRInterpretationState)
    @ Core.Compiler ./compiler/ssair/irinterp.jl:193
  [4] _ir_abstract_constant_propagation(interp::Core.Compiler.NativeInterpreter, irsv::Core.Compiler.IRInterpretationState; extra_reprocess::Nothing)
    @ Core.Compiler ./compiler/ssair/irinterp.jl:386
  [5] _ir_abstract_constant_propagation(interp::Core.Compiler.NativeInterpreter, irsv::Core.Compiler.IRInterpretationState)
    @ Core.Compiler ./compiler/ssair/irinterp.jl:285
  [6] ir_abstract_constant_propagation(interp::Core.Compiler.NativeInterpreter, irsv::Core.Compiler.IRInterpretationState)
    @ Core.Compiler ./compiler/ssair/irinterp.jl:419
  [7] abstract_call_method_with_const_args(interp::Core.Compiler.NativeInterpreter, result::Core.Compiler.MethodCallResult, f::Any, arginfo::Core.Compiler.ArgInfo, si::Core.Compiler.StmtInfo, match::Core.MethodMatch, sv::Core.Compiler.InferenceState, invokecall::Nothing)
    @ Core.Compiler ./compiler/abstractinterpretation.jl:1007
  [8] abstract_call_method_with_const_args(interp::Core.Compiler.NativeInterpreter, result::Core.Compiler.MethodCallResult, f::Any, arginfo::Core.Compiler.ArgInfo, si::Core.Compiler.StmtInfo, match::Core.MethodMatch, sv::Core.Compiler.InferenceState)
    @ Core.Compiler ./compiler/abstractinterpretation.jl:986
  [9] abstract_call_gf_by_type(interp::Core.Compiler.NativeInterpreter, f::Any, arginfo::Core.Compiler.ArgInfo, si::Core.Compiler.StmtInfo, atype::Any, sv::Core.Compiler.InferenceState, max_methods::Int64)
    @ Core.Compiler ./compiler/abstractinterpretation.jl:162
 [10] abstract_call_known(interp::Core.Compiler.NativeInterpreter, f::Any, arginfo::Core.Compiler.ArgInfo, si::Core.Compiler.StmtInfo, sv::Core.Compiler.InferenceState, max_methods::Int64)
    @ Core.Compiler ./compiler/abstractinterpretation.jl:2035
 [11] abstract_call(interp::Core.Compiler.NativeInterpreter, arginfo::Core.Compiler.ArgInfo, si::Core.Compiler.StmtInfo, sv::Core.Compiler.InferenceState, max_methods::Nothing)
    @ Core.Compiler ./compiler/abstractinterpretation.jl:2106
 [12] abstract_call(interp::Core.Compiler.NativeInterpreter, arginfo::Core.Compiler.ArgInfo, si::Core.Compiler.StmtInfo, sv::Core.Compiler.InferenceState)
    @ Core.Compiler ./compiler/abstractinterpretation.jl:2085
 [13] abstract_eval_statement_expr(interp::Core.Compiler.NativeInterpreter, e::Expr, vtypes::Vector{Core.Compiler.VarState}, sv::Core.Compiler.InferenceState, mi::Nothing)
    @ Core.Compiler ./compiler/abstractinterpretation.jl:2242
 [14] abstract_eval_statement(interp::Core.Compiler.NativeInterpreter, e::Any, vtypes::Vector{Core.Compiler.VarState}, sv::Core.Compiler.InferenceState)
    @ Core.Compiler ./compiler/abstractinterpretation.jl:2461
 [15] abstract_eval_basic_statement(interp::Core.Compiler.NativeInterpreter, stmt::Any, pc_vartable::Vector{Core.Compiler.VarState}, frame::Core.Compiler.InferenceState)
    @ Core.Compiler ./compiler/abstractinterpretation.jl:2755
 [16] typeinf_local(interp::Core.Compiler.NativeInterpreter, frame::Core.Compiler.InferenceState)
    @ Core.Compiler ./compiler/abstractinterpretation.jl:2931
 [17] typeinf_nocycle(interp::Core.Compiler.NativeInterpreter, frame::Core.Compiler.InferenceState)
    @ Core.Compiler ./compiler/abstractinterpretation.jl:3019
 [18] _typeinf(interp::Core.Compiler.NativeInterpreter, frame::Core.Compiler.InferenceState)
    @ Core.Compiler ./compiler/typeinfer.jl:244
 [19] typeinf(interp::Core.Compiler.NativeInterpreter, frame::Core.Compiler.InferenceState)
    @ Core.Compiler ./compiler/typeinfer.jl:215
 [20] typeinf_frame(interp::Core.Compiler.NativeInterpreter, method::Method, atype::Any, sparams::Core.SimpleVector, run_optimizer::Bool)
    @ Core.Compiler ./compiler/typeinfer.jl:1005
 [21] typeinf_code(interp::Core.Compiler.NativeInterpreter, method::Method, atype::Any, sparams::Core.SimpleVector, run_optimizer::Bool)
    @ Core.Compiler ./compiler/typeinfer.jl:957
 [22] code_typed_by_type(tt::Type; optimize::Bool, debuginfo::Symbol, world::UInt64, interp::Core.Compiler.NativeInterpreter)
    @ Base ./reflection.jl:1272
 [23] code_typed_by_type
    @ ./reflection.jl:1252 [inlined]
 [24] code_typed(f::Any, types::Any; optimize::Bool, debuginfo::Symbol, world::UInt64, interp::Core.Compiler.NativeInterpreter)
    @ Base ./reflection.jl:1231
 [25] code_typed(f::Any, types::Any)
    @ Base ./reflection.jl:1222
 [26] top-level scope
    @ ~/julia/julia/usr/share/julia/stdlib/v1.10/InteractiveUtils/src/macros.jl:100

/cc @Keno

@brenhinkeller brenhinkeller added the compiler:lowering Syntax lowering (compiler front end, 2nd stage) label Nov 25, 2022
@aviatesk aviatesk added compiler:inference Type inference and removed compiler:lowering Syntax lowering (compiler front end, 2nd stage) labels Nov 28, 2022
Keno added a commit that referenced this issue Dec 9, 2022
We were accidentally dropping the effects of calls from
`iterate` calls performed during abstract_iteration. This
allowed calls that were not actually eligible for (semi-)concrete
evaluation to go through that path anyway. This could cause
incorrect results (see test), though it was usually fine, since
iterate call tend to not have side effects. It was noticed
however in #47688, because it forced irinterp down a path
that was not meant to be reachable (resulting in a TODO
error message). For good measure, let's also address this
todo (since it is reachable by external absint if they want),
but the missing effect propagation was the more serious bug
here.
aviatesk pushed a commit that referenced this issue Dec 9, 2022
We were accidentally dropping the effects of calls from
`iterate` calls performed during abstract_iteration. This
allowed calls that were not actually eligible for (semi-)concrete
evaluation to go through that path anyway. This could cause
incorrect results (see test), though it was usually fine, since
iterate call tend to not have side effects. It was noticed
however in #47688, because it forced irinterp down a path
that was not meant to be reachable (resulting in a TODO
error message). For good measure, let's also address this
todo (since it is reachable by external absint if they want),
but the missing effect propagation was the more serious bug
here.
@Keno Keno closed this as completed Dec 9, 2022
KristofferC pushed a commit that referenced this issue Mar 7, 2023
We were accidentally dropping the effects of calls from
`iterate` calls performed during abstract_iteration. This
allowed calls that were not actually eligible for (semi-)concrete
evaluation to go through that path anyway. This could cause
incorrect results (see test), though it was usually fine, since
iterate call tend to not have side effects. It was noticed
however in #47688, because it forced irinterp down a path
that was not meant to be reachable (resulting in a TODO
error message). For good measure, let's also address this
todo (since it is reachable by external absint if they want),
but the missing effect propagation was the more serious bug
here.

(cherry picked from commit 2a0d58a)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
compiler:inference Type inference
Projects
None yet
Development

No branches or pull requests

3 participants