Giter VIP home page Giter VIP logo

Comments (3)

aviatesk avatar aviatesk commented on August 25, 2024 1

Of course, presumably an even more ergonomic approach would be VScode integration. Now that we have TypedSyntax, do you see other major barriers to implementing this? (In addition to the fact that TypedSyntax is a hack, albeit a useful one, that sometimes makes mistakes.)

Yes, I think JET should use TypedSyntax to display reported problems, since the current situation is also hacky and not very accurate (it tries to "infer" the original textual representation from the lowered form).
I have three concerns about integrating TypedSyntax into JET:

  • JET actually has two different analyzers: the one for report_call inspects the unoptimized type-inferred lowered form, and the other for report_opt does so on the optimized type-inferred lowered form. Since, as far as I understand, TypedSyntax can work with unoptimized type-inferred lowered forms, I think we can integrate it with report_call only. Although this would be a significant improvement itself, to make it work with the optimized form, we would need to tweak base Julia so that the compiler maintains the original textual representation throughout the compilation pipeline.
  • Performance issues: I am mostly concerned about the performance cost. Under the current design, JET constructs an internal data structure during abstract interpretation that contains certain information (like the error location, the call signature, etc.) which is necessary for displaying JET's stacktrace-like view to users. The integration of TypedSyntax replaces this information with the new one that is required for TypedSyntax, so as long as the integration tries to show the stacktrace-like view to users, it needs to perform some computations during abstract interpretation. I am willing to accept some computational costs as the TypedSyntax-based view would be much nicer (and I don't think the current implementation is very optimized anyway), but I would like to make JET as fast as possible. If necessary, I am even fine with creating a new mode of JET where we forgo showing the stacktrace-like view and just show the error location to users. In this case, the performance cost would be negligible.

Additionally, we may need to make some changes to TypedSyntax: as far as I remember, TypedSyntax works on the unoptimized form where inference has been completed. However, if we maintain the current design of JET, we need to make it work on the unoptimized lowered form where inference is still in progress but when the type information about the statement in question is available.

from jet.jl.

timholy avatar timholy commented on August 25, 2024

Of course, presumably an even more ergonomic approach would be VScode integration. Now that we have TypedSyntax, do you see other major barriers to implementing this? (In addition to the fact that TypedSyntax is a hack, albeit a useful one, that sometimes makes mistakes.)

from jet.jl.

aviatesk avatar aviatesk commented on August 25, 2024

How do you feel about this idea?

I had never considered that, but it might be worth trying.

If you like it, one thing I'm not yet very familiar with is the API for manipulating the result of report_call. Any brief pointers on where to start reading?

You can get InferenceErrorReport objects from result::JETCallResult returned from report_call with JET.get_reports(result). Each InferenceErrorReport has the vst field, that is a vector of Base.StackFrame-like object, and you can find the errorneous MethodInstance there.

julia> result = @report_call sum("julia");

julia> ascend(report.vst[end].linfo)
Choose a call for analysis (q to quit):
 >   add_sum(::Char, ::Char)
       (::Base.BottomRF{typeof(Base.add_sum)})(::Char, ::Char)
         _foldl_impl(::Base.BottomRF{typeof(Base.add_sum)}, ::Base._InitialValue, ::String)
           foldl_impl(::Base.BottomRF{typeof(Base.add_sum)}, ::Base._InitialValue, ::String)
             mapfoldl_impl(::typeof(identity), ::typeof(Base.add_sum), ::Base._InitialValue, ::String)
               #mapfoldl#294(::Base._InitialValue, ::typeof(mapfoldl), ::typeof(identity), ::typeof(Base.add_sum), ::String)
                 mapfoldl(::typeof(identity), ::typeof(Base.add_sum), ::String)
                   #mapreduce#298(::Base.Pairs{Symbol, Union{}, Tuple{}, @NamedTuple{}}, ::typeof(mapreduce), ::typeof(identity), ::typeof(Base.add_sum), ::String)
                     mapreduce(::typeof(identity), ::typeof(Base.add_sum), ::String)
v                      #sum#301(::Base.Pairs{Symbol, Union{}, Tuple{}, @NamedTuple{}}, ::typeof(sum), ::typeof(identity), ::String)

from jet.jl.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.