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][Runtime] Add VM compiler. #3139

Merged
merged 12 commits into from
May 11, 2019
Merged

Conversation

jroesch
Copy link
Member

@jroesch jroesch commented May 6, 2019

The final PR for the runtime series, adds the VM compiler and its associated test cases.

Blocked on: #2889.

@jroesch jroesch force-pushed the runtime-compiler branch from c8fddcc to 156013d Compare May 9, 2019 06:59
@jroesch
Copy link
Member Author

jroesch commented May 9, 2019

@tqchen @wweic @MarisaKirisame @weberlo @icemelon9 @zhiics final bit of VM to review tests are green.


bool IsClosure(const Function& func);
Module LambdaLift(const Module& module);
Module InlinePrimitives(const Module& module);
Copy link
Contributor

Choose a reason for hiding this comment

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

Add comments and an example?


if __name__ == '__main__':
test_resnet()
# test_vgg()
Copy link
Contributor

Choose a reason for hiding this comment

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

enable all the tests here.

include/tvm/relay/vm_compiler.h Outdated Show resolved Hide resolved
src/relay/backend/vm/compiler.cc Outdated Show resolved Hide resolved
src/relay/backend/vm/compiler.cc Outdated Show resolved Hide resolved
src/relay/backend/vm/inline_primitives.cc Outdated Show resolved Hide resolved
src/relay/backend/vm/lambda_lift.cc Outdated Show resolved Hide resolved
src/relay/backend/vm/lambda_lift.cc Outdated Show resolved Hide resolved
src/relay/backend/vm/vm.cc Outdated Show resolved Hide resolved
src/runtime/vm/vm.cc Show resolved Hide resolved
src/relay/backend/vm/compiler.cc Show resolved Hide resolved
src/relay/backend/vm/compiler.cc Show resolved Hide resolved

inline std::string GenerateName(const Function& func) {
size_t hash = StructuralHash()(func);
return std::string("lifted_name") + std::to_string(hash);
Copy link
Contributor

Choose a reason for hiding this comment

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

what if hash collision? just do a unique binder

Copy link
Member Author

Choose a reason for hiding this comment

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

Hash collision is low, I will just prefix function name too

Copy link
Member

@icemelon icemelon left a comment

Choose a reason for hiding this comment

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

lgtm

src/relay/backend/vm/compiler.cc Show resolved Hide resolved
Copy link
Member

@tqchen tqchen left a comment

Choose a reason for hiding this comment

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

some minor nits

include/tvm/relay/pass.h Show resolved Hide resolved
using ConstTensorShapeMap = NodeMap<TensorType, std::pair<Index, NDArray>>;

struct VMCompilerContext {
Module module;
Copy link
Member

Choose a reason for hiding this comment

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

document the fields.

@jroesch jroesch merged commit 6a4d71f into apache:master May 11, 2019
wweic pushed a commit to wweic/tvm that referenced this pull request May 13, 2019
* Implement the VM compiler

* Fix issues

* Fix ASF headers

* Fix test issue

* Apply typo fixes.

* Update src/relay/backend/vm/compiler.cc

Co-Authored-By: 雾雨魔理沙 <[email protected]>

* Refactor compiler

* Fix

* Fix

* Fix in benchmark

* Fix

* Address comments
wweic pushed a commit to neo-ai/tvm that referenced this pull request May 13, 2019
* Implement the VM compiler

* Fix issues

* Fix ASF headers

* Fix test issue

* Apply typo fixes.

* Update src/relay/backend/vm/compiler.cc

Co-Authored-By: 雾雨魔理沙 <[email protected]>

* Refactor compiler

* Fix

* Fix

* Fix in benchmark

* Fix

* Address comments
@jroesch jroesch deleted the runtime-compiler branch February 4, 2021 04:40
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.

6 participants