Uh oh!
There was an error while loading. Please reload this page.
[Relay] add fatal - #3911
Conversation
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
slyubomirsky
commented
Sep 10, 2019
Mostly looks good and it is good to have a more explicit solution to the problem of incomplete matches. A couple of issues besides the questions I've labeled:
|
slyubomirsky
commented
Sep 11, 2019
Thanks for addressing the feedback. I think these changes are good (pending linting fixes) |
MarisaKirisame
commented
Sep 11, 2019
@slyubomirsky can you approve explicitly? |
| TVM_REGISTER_API("relay._make.Fatal") | ||
| .set_body_typed(FatalNode::make); | ||
| std::string NoMatchMsg() { |
There was a problem hiding this comment.
I feel we can just use constexpr or an enum to define some common error messages in both C++ and python. Not necessary to define such an API.
otherwise lgtm
There was a problem hiding this comment.
I have to copy the string twice if it is a constant though. I feel like api is cleaner and not cumbersome to use too.
MarisaKirisame
commented
Sep 12, 2019
Hi ppl, I add pytest.ini and updated tests/lint/check_file_type.py, is it ok? |
slyubomirsky
commented
Sep 14, 2019
Should there be an AST header on the pytest.ini? The linter is complaining about it, but should the .ini file be an exception? |
| RELAY_DEFINE_NODE_REF(RefWrite, RefWriteNode, Expr); | ||
| /*! \brief A fatal error has occured. Stop all execution and report with a message. */ |
There was a problem hiding this comment.
| /*! \brief A fatal error has occured. Stop all execution and report with a message. */ | |
| /*! \brief A fatal error has occurred. Stop all execution and report with a message. */ |
| x = Var("x", l(a)) | ||
| y = Var("y") | ||
| z = Var("z") | ||
| nil_case = Clause(PatternConstructor(nil, []), Fatal("cannot pass nil into head")) |
MarisaKirisame
commented
Sep 18, 2019
@wweic @icemelon9 I had addressed the review comment, can you guys give another round of review or approve? |
broune
commented
Oct 19, 2019
I was actually just now looking at support for Asserts, so this will be useful to me (Thanks to Wei for pointing me to this PR). I had been wondering what the TVM Relay policy is on side effects? I see that there is already Ref, but I didn't find the policy on it for Relay, and I wonder what it is. Side effects do change how a lot of optimizations can be done. (Turns out, if you Google for "TVM side effects", the result is an official message "FDA Warns Public of TVM Side Effects", so I guess there's that, too.) |
wweic
commented
Oct 19, 2019
@broune Thanks for bringing it up! cc @tqchen@jroesch@zhiics @icemelon9 Regarding this PR, @MarisaKirisame please rebase so I can approve. |
MarisaKirisame
commented
Oct 19, 2019
@broune relay is a purposefully side-effect language - it has side effect, and it is the key ingridient for our automatic differentiation algorithm. |
tqchen
commented
Oct 21, 2019
I think it would be good to introduce a thread discussing side effect. My feeling is that we want to keep most of the code functional(which makes them easy to optimize) and only introduce side effect when necessary(e.g. update rules). Side effect was not necessary for first-order AD, and for higher order ADs, we will need to find out a way to reduce as many as possible, and has not yet becomes concern. In a gist, a large component of optimizations could be focusing on optimizing side-effect free programs. @broune seems to have a lot of thoughts for relaxing the side effect semantics. I think that makes sense especially for asserts, mainly because we only want to receive errors in boundaries of functions(which could be an entire graph) and I think we could reorder things in these cases. |
jroesch
commented
Oct 21, 2019
@broune maybe we can have a longer form discussion and draft an RFC together? the current policy is if you don't use ref, the program should be side-effect free. I believe this may be violated by a few ops but my goal is to avoid side effects, and make it easy to do side-effect free analysis for many use cases. |
broune
commented
Oct 22, 2019
I'm happy to discuss further in whichever venue. (No side effects is ideal for optimization but hard to get 100%. E.g. with dynamic shapes, most ops can have shape errors at runtime, making them side effecting unless somehow the error becomes an output in the dataflow graph. A random number generator library like TVM's tvm.contrib.random has random numbers that are different each time you call the op, which is stateful and a side effect.) |
@tqchen that's the point of the PE pass. on another note, can somebody get this merged? this had been sitting for a long time. |
wweic
commented
Oct 28, 2019
tqchen
commented
Mar 30, 2020
close for now due to inactive status, feel free to bring another PR to the master |
@jroesch@junrushao1994@tqchen@wweic@vinx13@slyubomirsky can you guys review?