-
Couldn't load subscription status.
- Fork 3.7k
[Relay] Partial Evaluator do concatenate, and has better termination checker for scalar. #3703
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
Conversation
|
Thanks for the PR @MarisaKirisame, could you fix the title to "[Relay] PE inline scalar" and in the description spell out "Partial evaluation" so people can get context? |
|
@tmoreau89 thx! It is done. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@MarisaKirisame This PR looks sick!
I think you forgot to change the title to "Partial evaluation" instead of "PE". Also, it looks like there's more than just scalar inlining in here. A more descriptive title might be "[Relay] Extend coverage of partial evaluation".
src/relay/pass/partial_eval.cc
Outdated
| return Fuel(make_node<FTValueNode>(tvalue)); | ||
| } | ||
|
|
||
| /*! \brief Initially every element has Fuel of FBottom. It is the smallest element. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't understand the code or lattices very well yet, but if every element starts at FBottom, and you only do meets, then wouldn't it remain FBottom forever, since the meet of a minimal element and any other element is always the minimal element?
If that's the case, then maybe this should be FTop?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good catch! It is indeed FTop. It was initally 'finitely ascending' but that sound strange, so I flip the lattice to match that.
src/relay/pass/partial_eval.cc
Outdated
| auto ret = Meet(f, &progress); | ||
| return std::make_tuple(ret, progress); | ||
| } | ||
| /*! \brief return the new Fuel, and write true only iff progress is made. */ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| /*! \brief return the new Fuel, and write true only iff progress is made. */ | |
| /*! \brief return the new Fuel, and write true iff progress is made. */ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am trying to communicate that if progress is already true, in no case it will be written false. I will rewordsmith.
| f_var = Var("f") | ||
| f = Function([x], If(op.equal(x, const(0)), const(0), x + f_var(x - const(1)))) | ||
| orig = run_infer_type(Let(f_var, f, f_var(const(10)))) | ||
| assert_alpha_equal(dcpe(orig), const(55)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why is this called test_triangle?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
triangle number
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can you change it to test_triangular_number?
src/relay/pass/partial_eval.cc
Outdated
|
|
||
| class FuelNode; | ||
| /*! \brief A meet-semilattice with finite descending chain. | ||
| * It mean that we can meet two element to get an element, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
means
src/relay/pass/partial_eval.cc
Outdated
| class FuelNode; | ||
| /*! \brief A meet-semilattice with finite descending chain. | ||
| * It mean that we can meet two element to get an element, | ||
| * and for every element, there is only finite amount of meet before getting back the same element. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
only a finite
src/relay/pass/partial_eval.cc
Outdated
| * and for every element, there is only finite amount of meet before getting back the same element. | ||
| * | ||
| * Every time we recurse, we do a meet and require that progress must be made. | ||
| * This make sure we do not recurse infinitely in the Partial Evaluator. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This ensures
src/relay/pass/partial_eval.cc
Outdated
| Expr PostProcess(const Expr&); | ||
|
|
||
| /*! \brief The base container type of Relay values. */ | ||
| /*! \brief A StaticNode contain some static data that the Partial Evaluator can use. */ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
contains
…checker for scalar. (apache#3703) * save lint some lint lint add charrnn save save save remove debug remove debug remove space refactor save rewrite dce * reset files * join -> meet * lint * address review comment * wordsmith
…checker for scalar. (apache#3703) * save lint some lint lint add charrnn save save save remove debug remove debug remove space refactor save rewrite dce * reset files * join -> meet * lint * address review comment * wordsmith
This PR:
@jroesch @tmoreau89 @weberlo