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

RelayTextPrinter is now non-recursive. ExpandDataflow refactored #7817

Merged
merged 3 commits into from Apr 23, 2021

Conversation

d-smirnov
Copy link
Contributor

RelayTextPrinter made non-recursive to allow printing larger graphs ( > ~3000 nodes). There also a small refactoring in ExpandDataflow which was made bit more generalised with "node expander" extracted as separate method.

Copy link
Contributor

@mbrookhart mbrookhart left a 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 ExpandDataFlow refactor. It looks like you rewrote it without actually changing the behavior or using any new APIs? Could you explain the need for the refactor?

I'm not familiar with the RelayTextPrinter, and I've never seen stack overflows when printing models with AsText or python str, I've done models over 150k nodes. What exactly is the use case that overflowed for you? Perhaps I just haven't been calling this class. We'll need a test that hits the bad behavior on the old version

ping @jroesch for the RelayTextPrinter

include/tvm/relay/expr_functor.h Outdated Show resolved Hide resolved
include/tvm/relay/expr_functor.h Show resolved Hide resolved
include/tvm/relay/expr_functor.h Outdated Show resolved Hide resolved
include/tvm/relay/expr_functor.h Outdated Show resolved Hide resolved
@d-smirnov
Copy link
Contributor Author

ping @jroesch

@mbrookhart
Copy link
Contributor

Is it possible to add a unit test that triggers this?

@d-smirnov
Copy link
Contributor Author

d-smirnov commented Apr 14, 2021

To reveal the issue please use a unit test here 7832: tests/cpp/relay_dismantler_test.cc
Please add std::cout << AsText( func, false ); at the end of foo

@mbrookhart
Copy link
Contributor

Hi @d-smirnov, sorry, I missed your response last week. Can you add that as a test here? Maybe save the result of AsText as a String and assert it's not empty?

RelayTextPrinter is now non-recursive to allow printing larger
graphs. ExpandDataflow is generalised to have separate node expander.

Change-Id: Id5a3a470fbc8b90822502fbc8d24d534df1ea355
Change-Id: Iac69766428d5b9783279cb02a57064fd82842001
Change-Id: Id20ae72f9f5f8dd92d4d182360b28156c035e667
@mbrookhart mbrookhart merged commit 4467a9c into apache:main Apr 23, 2021
@mbrookhart
Copy link
Contributor

Thanks @d-smirnov

echuraev pushed a commit to echuraev/tvm that referenced this pull request Apr 29, 2021
…che#7817)

* RelayTextPrinter is now non-recursive. ExpandDataflow refactored

RelayTextPrinter is now non-recursive to allow printing larger
graphs. ExpandDataflow is generalised to have separate node expander.

Change-Id: Id5a3a470fbc8b90822502fbc8d24d534df1ea355

* requested changes

Change-Id: Iac69766428d5b9783279cb02a57064fd82842001

* unit test added

Change-Id: Id20ae72f9f5f8dd92d4d182360b28156c035e667
umangyadav pushed a commit to umangyadav/tvm that referenced this pull request May 5, 2021
…che#7817)

* RelayTextPrinter is now non-recursive. ExpandDataflow refactored

RelayTextPrinter is now non-recursive to allow printing larger
graphs. ExpandDataflow is generalised to have separate node expander.

Change-Id: Id5a3a470fbc8b90822502fbc8d24d534df1ea355

* requested changes

Change-Id: Iac69766428d5b9783279cb02a57064fd82842001

* unit test added

Change-Id: Id20ae72f9f5f8dd92d4d182360b28156c035e667
trevor-m pushed a commit to trevor-m/tvm that referenced this pull request May 6, 2021
…che#7817)

* RelayTextPrinter is now non-recursive. ExpandDataflow refactored

RelayTextPrinter is now non-recursive to allow printing larger
graphs. ExpandDataflow is generalised to have separate node expander.

Change-Id: Id5a3a470fbc8b90822502fbc8d24d534df1ea355

* requested changes

Change-Id: Iac69766428d5b9783279cb02a57064fd82842001

* unit test added

Change-Id: Id20ae72f9f5f8dd92d4d182360b28156c035e667
trevor-m pushed a commit to trevor-m/tvm that referenced this pull request May 6, 2021
…che#7817)

* RelayTextPrinter is now non-recursive. ExpandDataflow refactored

RelayTextPrinter is now non-recursive to allow printing larger
graphs. ExpandDataflow is generalised to have separate node expander.

Change-Id: Id5a3a470fbc8b90822502fbc8d24d534df1ea355

* requested changes

Change-Id: Iac69766428d5b9783279cb02a57064fd82842001

* unit test added

Change-Id: Id20ae72f9f5f8dd92d4d182360b28156c035e667
trevor-m pushed a commit to trevor-m/tvm that referenced this pull request May 6, 2021
…che#7817)

* RelayTextPrinter is now non-recursive. ExpandDataflow refactored

RelayTextPrinter is now non-recursive to allow printing larger
graphs. ExpandDataflow is generalised to have separate node expander.

Change-Id: Id5a3a470fbc8b90822502fbc8d24d534df1ea355

* requested changes

Change-Id: Iac69766428d5b9783279cb02a57064fd82842001

* unit test added

Change-Id: Id20ae72f9f5f8dd92d4d182360b28156c035e667
trevor-m pushed a commit to neo-ai/tvm that referenced this pull request May 11, 2021
…che#7817)

* RelayTextPrinter is now non-recursive. ExpandDataflow refactored

RelayTextPrinter is now non-recursive to allow printing larger
graphs. ExpandDataflow is generalised to have separate node expander.

Change-Id: Id5a3a470fbc8b90822502fbc8d24d534df1ea355

* requested changes

Change-Id: Iac69766428d5b9783279cb02a57064fd82842001

* unit test added

Change-Id: Id20ae72f9f5f8dd92d4d182360b28156c035e667
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.

None yet

3 participants