Skip to content

Enable calling into runtime from onnxifi #2300

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

Merged
merged 2 commits into from
Jan 29, 2019

Conversation

jackm321
Copy link
Contributor

@jackm321 jackm321 commented Jan 25, 2019

Description:
Enable calling into the Glow runtime from ONNXIFI through the HostManager.
This diff enables running onnxifi inference through HostManager once HostManager is implemented.

This diff is intended to get end-to-end support for the runtime working but there are many things that we cannot yet do such as multiple runs with the same Graph, running multiple onnxifi Graphs on the same onnxifi Backend, etc. To enable these things, some more larger refactoring steps will be needed in followups including 1. Moving all resources necessary for running graphs into BackendId, 2. Abstracting BackendId to enable separate implementations for HostManager and ExecutionEngine backed BackendIds (module is still always owned by ExecutionEngine no matter what), 3 move all graph state into the graph itself to enable running multiple times with different contexts, 4 move components necessary for compatibility check into runtime and separate the ExecutionEngine from the HostManager implementations.

Depends on #2284.

Testing:
ninja test, CI

Documentation:
doxygen

@@ -22,17 +22,22 @@

namespace glow {
namespace onnxifi {
namespace {
const std::string inferenceFunctionName = "inference";
Copy link
Contributor

Choose a reason for hiding this comment

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

Why is this std::string and not "const char*" ?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

No reason, I'll change this and the below std::string

Copy link
Contributor

Choose a reason for hiding this comment

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

+1, those strings could cause SIOFs

Copy link
Contributor

@rdzhabarov rdzhabarov left a comment

Choose a reason for hiding this comment

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

LGTM. I'd wait until HostManager lands and then merge.

As it's hard to do proper integration test in OSS, I'd like to see an integration test with host manager on fbcode side.

@@ -22,17 +22,22 @@

namespace glow {
namespace onnxifi {
namespace {
const std::string inferenceFunctionName = "inference";
Copy link
Contributor

Choose a reason for hiding this comment

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

+1, those strings could cause SIOFs

bool use_onnx)
: id_(id), use_onnx_(use_onnx), concurrency_(concurrency),
executionEngine_(kind) {}
bool useOnnx, bool useHostManager)
Copy link
Contributor

Choose a reason for hiding this comment

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

update doxygen with the useHostManager.

Copy link
Contributor

@gcatron gcatron left a comment

Choose a reason for hiding this comment

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

This looks good, It should allow us to run a test through onnxifi for the new runtime. Thanks!

@@ -146,26 +156,42 @@ void Graph::run(
phs.push_back(var);
}

auto ctx = std::make_unique<Context>();
Copy link
Contributor

Choose a reason for hiding this comment

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

make this llvm::make_unique.

@bertmaher recently fixed bunch of places to make glow g++-4.8.5 compatible.

@jackm321 jackm321 force-pushed the onnxifi_enable_runtime_usage branch from a911d58 to 61050d5 Compare January 29, 2019 07:36
@jackm321 jackm321 force-pushed the onnxifi_enable_runtime_usage branch from 61050d5 to 0f5608b Compare January 29, 2019 07:56
@jackm321
Copy link
Contributor Author

Landing this now so we can keep moving with refactoring the onnxifi interface to get ready for full HostManager integration once it's ready. Will add integration tests once HostManager is ready.

@jackm321 jackm321 merged commit 5c3d43e into pytorch:master Jan 29, 2019
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.

5 participants