This repository has been archived by the owner on Nov 17, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 6.8k
[MXNET-703] TensorRT runtime integration #11325
Merged
Merged
Changes from 40 commits
Commits
Show all changes
47 commits
Select commit
Hold shift + click to select a range
268e90b
[MXNET-703] TensorRT runtime integration
4855d8a
correctly assign self._optimized_symbol in executor
Caenorst 419b294
declare GetTrtCompatibleSubsets and ReplaceSubgraph only if MXNET_USE…
Caenorst 8d723c9
add comments in ReplaceSubgraph
Caenorst ca94624
Addressing Haibin's code review points
75c8642
Check that shared_buffer is not empty when USE_TENSORRT is set
2a11466
Added check that TensorRT binding is for inference only
190c9bf
Removed redundant decl.
mkolod d88ad8b
WIP Refactored TRT integration and tests
KellenSunderland 87ebdce
Add more build guards, remove unused code
KellenSunderland 83fa475
Remove ccache report
KellenSunderland 4a3772f
Remove redundant const in declaration
KellenSunderland f779537
Clean Cmake TRT files
KellenSunderland b0748ef
Remove TensorRT env var usage
KellenSunderland 35e1367
Use contrib optimize_graph instaed of bind
KellenSunderland 6338e45
Clean up cycle detector
KellenSunderland 21d0239
Convert lenet test to contrib optimize
KellenSunderland f30dbef
Protect interface with trt build flag
KellenSunderland eaba593
Fix whitespace issues
KellenSunderland f870a3f
Add another build guard to c_api
KellenSunderland e40d6b3
Move get_optimized_symbol to contrib area
KellenSunderland 7fa6a4a
Ignore gz files in test folder
KellenSunderland e777ab5
Make trt optimization implicit
KellenSunderland 3ea9b89
Remove unused declaration
KellenSunderland d6d2cac
Replace build guards with runtime errors
KellenSunderland 2d04aee
Change default value of TensorRT to off
KellenSunderland 449a195
Warn user when TRT not active at runtime
KellenSunderland ed36739
Move TensorRTBind declaration, add descriptive errors
KellenSunderland 882d8e5
Test TensorRT graph execution, fix bugs
KellenSunderland 95a7955
Fix lint and whitespace issues
KellenSunderland 0307467
Fix typo
KellenSunderland 8504319
Removed default value for set_use_tensorrt
KellenSunderland 55dd422
Improved documentation and fixed spacing issues
KellenSunderland f7ff036
Merge pull request #8 from KellenSunderland/tensorrt_integration_wip
mkolod ec9d3ea
Move static exec funcs to util files
KellenSunderland 4b63738
Update comments to match util style
KellenSunderland 694cbfb
Apply const to loop element
KellenSunderland 2be7d25
Fix a few namespace issues
KellenSunderland 369a3f7
Make static funcs inline to avoid compiler warning
KellenSunderland 64b7e95
Merge pull request #9 from KellenSunderland/tensorrt_integration_15
mkolod 1c7698b
Remove unused inference code from lenet5_train
KellenSunderland 74b6603
Add explicit trt contrib bind, update tests to use it
KellenSunderland 7fff80c
Rename trt bind call
KellenSunderland a754aab
Remove documentation that is not needed for trt
KellenSunderland 7ea6ef9
Merge pull request #10 from KellenSunderland/tensorrt_integration_16
mkolod 22a3823
Reorder arguments, allow position calling
KellenSunderland c3ace78
Merge pull request #11 from KellenSunderland/tensorrt_integration_16
mkolod File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Submodule onnx-tensorrt
added at
e7be19
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
# -*- mode: dockerfile -*- | ||
# Licensed to the Apache Software Foundation (ASF) under one | ||
# or more contributor license agreements. See the NOTICE file | ||
# distributed with this work for additional information | ||
# regarding copyright ownership. The ASF licenses this file | ||
# to you under the Apache License, Version 2.0 (the | ||
# "License"); you may not use this file except in compliance | ||
# with the License. You may obtain a copy of the License at | ||
# | ||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, | ||
# software distributed under the License is distributed on an | ||
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | ||
# KIND, either express or implied. See the License for the | ||
# specific language governing permissions and limitations | ||
# under the License. | ||
# | ||
# Dockerfile to run MXNet on Ubuntu 16.04 for CPU | ||
|
||
FROM nvidia/cuda:9.0-cudnn7-devel | ||
|
||
WORKDIR /work/deps | ||
|
||
COPY install/ubuntu_core.sh /work/ | ||
RUN /work/ubuntu_core.sh | ||
COPY install/deb_ubuntu_ccache.sh /work/ | ||
RUN /work/deb_ubuntu_ccache.sh | ||
COPY install/ubuntu_python.sh /work/ | ||
RUN /work/ubuntu_python.sh | ||
COPY install/tensorrt.sh /work | ||
RUN /work/tensorrt.sh | ||
|
||
ARG USER_ID=0 | ||
COPY install/ubuntu_adduser.sh /work/ | ||
RUN /work/ubuntu_adduser.sh | ||
|
||
COPY runtime_functions.sh /work/ | ||
|
||
WORKDIR /work/mxnet | ||
ENV LD_LIBRARY_PATH=${LD_LIBRARY_PATH}:/usr/local/lib |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
#!/bin/bash | ||
|
||
# Licensed to the Apache Software Foundation (ASF) under one | ||
# or more contributor license agreements. See the NOTICE file | ||
# distributed with this work for additional information | ||
# regarding copyright ownership. The ASF licenses this file | ||
# to you under the Apache License, Version 2.0 (the | ||
# "License"); you may not use this file except in compliance | ||
# with the License. You may obtain a copy of the License at | ||
# | ||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, | ||
# software distributed under the License is distributed on an | ||
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | ||
# KIND, either express or implied. See the License for the | ||
# specific language governing permissions and limitations | ||
# under the License. | ||
|
||
# Install gluoncv since we're testing Gluon models as well | ||
pip2 install gluoncv==0.2.0 | ||
pip3 install gluoncv==0.2.0 | ||
|
||
# Install Protobuf | ||
# Install protoc 3.5 and build protobuf here (for onnx and onnx-tensorrt) | ||
pushd . | ||
cd .. | ||
apt-get update | ||
apt-get install -y automake libtool | ||
git clone --recursive -b 3.5.1.1 https://github.com/google/protobuf.git | ||
cd protobuf | ||
./autogen.sh | ||
./configure | ||
make -j$(nproc) | ||
make install | ||
ldconfig | ||
popd | ||
|
||
# Install TensorRT | ||
echo "TensorRT build enabled. Installing TensorRT." | ||
wget -qO tensorrt.deb https://developer.download.nvidia.com/compute/machine-learning/repos/ubuntu1604/x86_64/nvinfer-runtime-trt-repo-ubuntu1604-4.0.1-ga-cuda9.0_1-1_amd64.deb | ||
dpkg -i tensorrt.deb | ||
apt-get update | ||
apt-get install -y --allow-downgrades libnvinfer-dev | ||
rm tensorrt.deb |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -1714,6 +1714,13 @@ MXNET_DLL int MXExecutorReshape(int partial_shaping, | |
NDArrayHandle** aux_states, | ||
ExecutorHandle shared_exec, | ||
ExecutorHandle *out); | ||
|
||
/*! | ||
* \brief get optimized graph from graph executor | ||
*/ | ||
MXNET_DLL int MXExecutorGetOptimizedSymbol(ExecutorHandle handle, | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. why do we need to expose this? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @piiswrong See my reply to @eric-haibin-lin here. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @piiswrong What is your take now that you have the context? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think it's better to expose it as a private member of executor |
||
SymbolHandle *out); | ||
|
||
/*! | ||
* \brief set a call back to notify the completion of operation | ||
*/ | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -32,3 +32,4 @@ | |
from . import io | ||
from . import quantization | ||
from . import quantization as quant | ||
from . import tensorrt |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We spoke offline about this, but just a quick note that we should also add the ability to build MXNet-TensorRT integration to our cmake builds.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@KellenSunderland I agree. Should the CMake build be part of the initial PR or a subsequent one?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@KellenSunderland ping ^^
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think either way would work.