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

Very WIP: Stage2 revival #78

Merged
merged 2 commits into from Dec 27, 2022
Merged

Very WIP: Stage2 revival #78

merged 2 commits into from Dec 27, 2022

Conversation

Keno
Copy link
Collaborator

@Keno Keno commented Jul 15, 2022

Needs some corresponding changes in Cthulhu

@Keno
Copy link
Collaborator Author

Keno commented Jul 17, 2022

Needs some corresponding changes in Cthulhu

JuliaDebug/Cthulhu.jl#303

@Keno
Copy link
Collaborator Author

Keno commented Jul 18, 2022

Alright, I think at this point, I've proven out that all the compiler interfaces do now support what we need. I think the big next thing here is to unify the codegen between stage1 and stage2 and then rewrite the stage2 inference support to be less awful, but I think there's a reasonably clear path here.

function abstract_call_gf_by_type(interp::ADInterpreter, @nospecialize(f), argtypes::Vector{Any}, @nospecialize(atype), sv::InferenceState, max_methods::Int = InferenceParams(interp).MAX_METHODS)
if f isa ∂⃖
function Core.Compiler.abstract_call_gf_by_type(interp::ADInterpreter, @nospecialize(f),
arginfo::ArgInfo, @nospecialize(atype), sv::InferenceState, max_methods::Int)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
arginfo::ArgInfo, @nospecialize(atype), sv::InferenceState, max_methods::Int)
arginfo::ArgInfo, @nospecialize(atype), sv::InferenceState, max_methods::Int = InferenceParams(interp).MAX_METHODS)

# This is a lie, but let's clean this up later
Cthulhu.can_descend(interp::ADInterpreter, mi::MethodInstance, optimize::Bool) = true

function Cthulhu.lookup(interp::ADInterpreter, curs::ADCursor, optimize::Bool; allow_no_src::Bool=false)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
function Cthulhu.lookup(interp::ADInterpreter, curs::ADCursor, optimize::Bool; allow_no_src::Bool=false)
function Cthulhu.lookup(interp::ADInterpreter, curs::ADCursor, optimize::Bool)

No need to overload the kwarg method (it's only used in the Cthulhu test suite).

# This is a lie, but let's clean this up later
Cthulhu.can_descend(interp::ADInterpreter, mi::MethodInstance, optimize::Bool) = true

function Cthulhu.lookup(interp::ADInterpreter, curs::ADCursor, optimize::Bool; allow_no_src::Bool=false)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We also need to overload Cthulhu.lookup_constproped(interp::AbstractInterpreter, curs::AbstractCursor, override::InferenceResult, optimize::Bool) to support constprop'ed callsite.

@Keno
Copy link
Collaborator Author

Keno commented Dec 27, 2022

My plan is to merge this without hooking this up and then to continue working on this on main.

Needs some corresponding changes in Cthulhu

WIP

WIP

WIP

WIP

fix inferred type and return handling of rrule calls (#83)

add custom Cthulhu toggle to show ad-transformed code (#85)

add inlining policy for ADInterpreter (#84)

fixup
@codecov-commenter
Copy link

Codecov Report

Base: 54.41% // Head: 50.21% // Decreases project coverage by -4.20% ⚠️

Coverage data is based on head (33a6f64) compared to base (d7648f1).
Patch coverage: 61.21% of modified lines in pull request are covered.

Additional details and impacted files
@@            Coverage Diff             @@
##             main      #78      +/-   ##
==========================================
- Coverage   54.41%   50.21%   -4.21%     
==========================================
  Files          22       23       +1     
  Lines        2161     2350     +189     
==========================================
+ Hits         1176     1180       +4     
- Misses        985     1170     +185     
Impacted Files Coverage Δ
src/Diffractor.jl 100.00% <ø> (ø)
src/stage2/abstractinterpret.jl 0.00% <0.00%> (ø)
src/stage2/interpreter.jl 0.00% <0.00%> (ø)
src/stage2/lattice.jl 0.00% <0.00%> (ø)
src/codegen/reverse.jl 93.33% <93.33%> (ø)
src/stage1/recurse.jl 96.73% <100.00%> (-0.16%) ⬇️
src/interface.jl 69.09% <0.00%> (-1.82%) ⬇️
src/stage1/recurse_fwd.jl 92.38% <0.00%> (-0.96%) ⬇️
src/stage1/forward.jl 71.91% <0.00%> (-0.88%) ⬇️
src/extra_rules.jl 44.54% <0.00%> (-0.50%) ⬇️
... and 3 more

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

☔ View full report at Codecov.
📢 Do you have feedback about the report comment? Let us know in this issue.

@Keno Keno merged commit 29a14f9 into main Dec 27, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants