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

[Relay] Feature Detection #3238

Merged
merged 2 commits into from
Jun 28, 2019
Merged

[Relay] Feature Detection #3238

merged 2 commits into from
Jun 28, 2019

Conversation

MarisaKirisame
Copy link
Contributor

@MarisaKirisame MarisaKirisame commented May 24, 2019

this is the implementation of #3236.

@MarisaKirisame
Copy link
Contributor Author

@wweic @ZihengJiang @vinx13 @srkreddy1238 @nhynes can you guys give it a round of review? it is ready.

@MarisaKirisame
Copy link
Contributor Author

@tqchen @jroesch @slyubomirsky can you guys give it a round of review?

namespace relay {

/*! \brief Different kinds of relay feature a program might use. */
enum Feature : int {
Copy link
Member

@vinx13 vinx13 May 30, 2019

Choose a reason for hiding this comment

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

My only concern is that whether we need feature types for each kind of expr or only define a few high-level features like fGraph, fPatternMatch.
I would suggest putting these design to the RFC so that we can further discuss

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I think we should at least have one of each kind, as a pass might simply fail due to not pattern matching against it in the visitor.

Copy link
Contributor

Choose a reason for hiding this comment

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

A pass failing due to missing visitor cases seems like the sort of thing that tests should catch. I agree with @vinx13 that it's probably better for these flags to correspond to high-level features

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The idea is that there might be two different characteristic for a pass: not matching against case x because it is unsupported, and not matching against case x because someone forgot to. We can use the f flag to detect such case, then use it to generate/pull all relay sample program satisfying the feature, and finally run the test automatically, instead of writing basically the same test over and over.

@slyubomirsky
Copy link
Contributor

At a high level, the implementation in this PR seems very reasonably written. I think it would be good to have unit tests, many tiny programs that each exhibit the specific features. Checking for graphs, recursion, etc. are good as tricky cases (also, should global var recursion be checked too? Many prelude functions are recursive).

I think there should be discussion about the concern @vinx13 raised in his comment, as to whether there should be more high-level features and what those features should be. (I don't think you should get rid of per-AST node checks, as they can be useful for some passes, but it's worth asking what other features could be good to have.)

@MarisaKirisame
Copy link
Contributor Author

@slyubomirsky all feature is tested (graph one is tested in test_anf/test_gnf).

@slyubomirsky
Copy link
Contributor

I realize that the features appear, but I think it would be good to have unit tests for each feature specifically so we can get a more accurate idea of what is wrong if future changes break something

@MarisaKirisame
Copy link
Contributor Author

@tqchen @yzhliu this pr has been sitting for a month. Can you guys give another round of review? I will fix the merge conflict shortly.

init

lint

rename

ci

fix

add

add some doc

save

add some test

add some test

lint

lint

lint
@MarisaKirisame
Copy link
Contributor Author

@yzhliu @tqchen @ZihengJiang @vinx13 @junrushao1994 can you guys give another round of review? I need this as it make testing stuff easier.

@vinx13 vinx13 merged commit 813a3d5 into apache:master Jun 28, 2019
wweic pushed a commit to wweic/tvm that referenced this pull request Jun 28, 2019
* init

init

lint

rename

ci

fix

add

add some doc

save

add some test

add some test

lint

lint

lint

* fix build
wweic pushed a commit to neo-ai/tvm that referenced this pull request Jun 30, 2019
* init

init

lint

rename

ci

fix

add

add some doc

save

add some test

add some test

lint

lint

lint

* fix build
@MarisaKirisame MarisaKirisame deleted the feature branch July 13, 2019 20:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants