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][VM] Port VM, VM compiler, and Object into python #3391

Merged
merged 12 commits into from
Jul 16, 2019

Conversation

icemelon
Copy link
Member

@icemelon icemelon commented Jun 18, 2019

This PR aims to port VM functionality into python.

  • Port Object into python
  • Port VM to python
  • Improve VM compiler to take target map/target host
  • Port VM build module to python

cc @jroesch @tqchen @wweic @zhiics @junrushao1994 @slyubomirsky

@icemelon icemelon marked this pull request as ready for review June 20, 2019 03:25
Copy link
Contributor

@wweic wweic left a comment

Choose a reason for hiding this comment

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

overall lgtm.

python/tvm/_ffi/_ctypes/vmobj.py Outdated Show resolved Hide resolved
assert expr, "either expr or self.mod should be not null."
if isinstance(expr, Expr):
self.mod[self.mod.entry_func] = expr
assert expr is None
Copy link
Contributor

Choose a reason for hiding this comment

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

Is the assert still valid? If true we can remove this argument.

Copy link
Member Author

Choose a reason for hiding this comment

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

Yes. But if we remove this argument, pylint will fail because it overwrites the API.

Copy link
Contributor

Choose a reason for hiding this comment

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

Ah ok. it's the interface of Executor, never mind.

python/tvm/relay/backend/vm.py Outdated Show resolved Hide resolved
tests/python/relay/test_vm.py Outdated Show resolved Hide resolved
python/tvm/relay/backend/vm.py Outdated Show resolved Hide resolved
python/tvm/relay/backend/vmobj.py Outdated Show resolved Hide resolved
python/tvm/relay/backend/vmobj.py Outdated Show resolved Hide resolved
src/relay/backend/vm/compiler.cc Outdated Show resolved Hide resolved
src/relay/backend/vm/compiler.cc Show resolved Hide resolved
python/tvm/relay/backend/vmobj.py Show resolved Hide resolved
@icemelon
Copy link
Member Author

@jroesch @tqchen Could you take a look at this pr?

Target target = Target::Create("llvm");
if (const auto* f = runtime::Registry::Get("relay.backend.build")) {
mod = (*f)(tvm::Array<LoweredFunc>(lowered_funcs.begin(), lowered_funcs.end()), target);
class VMBuildModule : public runtime::ModuleNode {
Copy link
Member

Choose a reason for hiding this comment

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

Can we give this a different name? build_module is a general pet-peeve of mine for a compiler it has no previous meaning and doesn't clearly illustrate what this does. Module is also an incredibly overloaded word in TVM and is pretty ambiguous at this point.

Copy link
Member

Choose a reason for hiding this comment

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

For example VMCompiler is a much better name imo.

Copy link
Member

@zhiics zhiics left a comment

Choose a reason for hiding this comment

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

LGTM

@wweic
Copy link
Contributor

wweic commented Jul 14, 2019

@icemelon9 should we revive the PR?

@icemelon
Copy link
Member Author

@jroesch @wweic @zhiics Could you review this pr again?

@zhiics
Copy link
Member

zhiics commented Jul 16, 2019

We got a core dump on the unit test, PTAL.

@jroesch jroesch merged commit b6dc782 into apache:master Jul 16, 2019
@icemelon icemelon deleted the vm-python branch July 16, 2019 21:13
wweic pushed a commit to wweic/tvm that referenced this pull request Aug 9, 2019
* tmp

* Port vm and object to python

* clean up

* update vm build module

* update

* x

* tweak

* cleanup

* update

* fix rebase

* Rename to VMCompiler

* fix
wweic pushed a commit to neo-ai/tvm that referenced this pull request Sep 6, 2019
* tmp

* Port vm and object to python

* clean up

* update vm build module

* update

* x

* tweak

* cleanup

* update

* fix rebase

* Rename to VMCompiler

* fix
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants