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

[DOCS] Neural network Deployment Guide with System Module Mode #1523

Closed
2 tasks
tqchen opened this issue Aug 1, 2018 · 3 comments
Closed
2 tasks

[DOCS] Neural network Deployment Guide with System Module Mode #1523

tqchen opened this issue Aug 1, 2018 · 3 comments

Comments

@tqchen
Copy link
Member

tqchen commented Aug 1, 2018

The current nnvm deployment module guide uses dynamic library mode, as @qingyuanxingsi suggested, we might want to add a system module deployment guide.

Actionable Items

    // old
    // tvm::runtime::Module mod_syslib = tvm::runtime::Module::LoadFromFile("deploy.so");
    // system module mode
    tvm::runtime::Module mod_syslib = (*tvm::runtime::Registry::Get("module._GetSystemLib"))();

Contributions are welcomed

@srkreddy1238
Copy link
Contributor

@dmlc/tvm-team I will take up this.

@tqchen
Copy link
Member Author

tqchen commented Aug 1, 2018

@srkreddy1238 great, note that however unless it is a design discussion, we don't have to loop in all the current tvm team members :)

@tqchen
Copy link
Member Author

tqchen commented Aug 4, 2018

OK, maybe we need to add a bit more additional details of device-related build into the doc. See the code here https://github.com/dmlc/tvm/blob/master/python/tvm/module.py#L93

What is happening for CUDA like modules is that we need to generate two files

  • myfunc.o (the host module you can obtain by mod.save)
  • device_blob.cc (the device part binary file that contains the device side binary embedded in C++)

What is happening in x.export_library("xx.so") is that we will call _PackImportsToC to create devc.cc, and then combine this together with the .o file.

See also the implementation of PackImportsToC https://github.com/dmlc/tvm/blob/master/src/codegen/codegen.cc#L33

I know it is a bit twisted, but this is a good hack to actually implement the device linking strategy and embed the binary blob into the final object file. It might make sense to provide an example for CUDA build and add a specific document to explain tvm runtime module export and the relation of the files.

Looking into these implementation, and document them will be very helpful for the community

@srkreddy1238 @@qingyuanxingsi @merrymercy

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

No branches or pull requests

2 participants