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
global variable woe #54
Comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
There're mainly two big problems around how JET treats global variabels
1. propagate of non-constant global variables
I thought we can safely propagate the type of (non constant) global variable if we invalidate all the code cache that uses it upon its update (the
force_invalidate!
logic), but it was wrong.This is just because we can't invalidate code cache if the update happens within the lineage frames of the current frame. Consider the following example:
Now we need to annotate
var
asUnion{Char,Int}
, but this annotation is actually very hard (or even impossible, with the existence of the widening heuristics) to be done in general case (while this particular example is very simple,setter!
can happen in a deeply nested conditioned callee).I guess this is why Julia's native compiler doesn't do what I had done for JET, and now I think I need to throw away the logic in JET as well; JET will just propagate
Any
for non-constant global variables.Of course this will make JET's profiling less accurate, but it's consistent with Julia's JIT at least, and I feel we want to have performance-warnings for this instead.
2. control flows in toplevel frames
Well, as for toplevel frames, I rather want to keep
VirtualGlobalVarible
logic. Toplevel call signatures are really important for JET's profiling process, because they're "starting points" of our analysis.Assuming assignments of global variables only happen in toplevel frames, I would like to improve the accuracy of our virtual global variable assignments.
Consider the following example:
At
sin(v)
,v
should be annotated asv::Union{Int,Char}
(and thus union-splitNoMethodError
should be reported), while JET now interprets toplevel code by per-basic-block basis, and only has really naive assignment logic, and so it's annotated asv::Char
, which should be fixed anyway.The text was updated successfully, but these errors were encountered: