-
Notifications
You must be signed in to change notification settings - Fork 364
Upgrade stack in release/1.3 branch #1485
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
Changes from all commits
Commits
Show all changes
54 commits
Select commit
Hold shift + click to select a range
e2cf026
feat: Upgrade CUDA to 11.7
peri044 beea264
chore: Update circle CI config.yaml
peri044 e3db145
chore: Fix install-cuda part
peri044 7464b0b
chore: fix circle ci config
peri044 ff3c488
chore: modify cudnn version
peri044 fc8c186
chore: minor fix
peri044 04700aa
chore: minor fix
peri044 97e81d5
chore: minor fix
peri044 91ac151
chore: minor fix
peri044 5e99485
chore: uninstall cuda-11.4
peri044 a2eee26
chore: minor fix
peri044 031eeef
chore: minor fix
peri044 551f35b
chore: minor fix
peri044 d65d489
chore: minor fix
peri044 9785845
chore: minor fix
peri044 7df7191
chore: minor fix
peri044 d74c8d2
chore: minor fix
peri044 4cebdff
chore: Minor fix
peri044 5a9b0b3
chore: minor fixes
peri044 02d9538
chore: fix cudnn conflicts
peri044 1ce8f29
chore: minor fix
peri044 42c1f94
feat: upgrade to TRT 8.5 GA
peri044 d9cf3f7
chore: minor fix for trt 8.5
peri044 b213e58
chore: Upgrade TRT and lint files
peri044 7705585
chore: Upgrade to 1.13 pyt release
peri044 d1ae7e4
chore: minor fix
peri044 6318e1d
chore: Update circle ci to add more fx tests
peri044 06a878a
chore: update config
peri044 a6ccefa
chore: minor fix
peri044 2506b58
chore: minor fix
peri044 d787aaf
chore: minor fix
peri044 b035fec
chore: minor fix
peri044 58f9b7d
chore: minor fix
peri044 0349ba3
chore: minor fix
peri044 7c7fbf2
chore: minor fix
peri044 ed753ac
chore: Fix threshold failure for stack converter
peri044 621b2fb
chore: linter fixes
peri044 c49f991
chore: Add FX test warning for conv3d
peri044 23e1131
chore: resolve merge conflicts
peri044 90b13a9
chore: remove debug statements from execute_engine
narendasan f11300b
chore: Fix destructor calls of cuda engine
peri044 ab9c236
chore: Resolve TRT engine merge conflicts
peri044 55f1842
chore: Linter fixes
peri044 83f5c17
chore: minor fixes
peri044 c14d41b
chore: Use in and out binding maps to preserve order
peri044 34f5742
chore: resolve merge conflicts
peri044 dbc9557
chore: add conv3d patch
peri044 acad32a
chore: Add changes from conv3d patch
peri044 7a0ee23
chore: disable test_permute_linear
peri044 fd7e535
chore: Remove dev versions of pytorch
peri044 c00292b
chore: Linter fixes
peri044 7f10168
chore: Address review comments
peri044 df452e5
chore: add unittest dep
peri044 d4f4717
chore: Linter fixes
peri044 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
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 |
---|---|---|
|
@@ -121,36 +121,30 @@ std::vector<at::Tensor> execute_engine(std::vector<at::Tensor> inputs, c10::intr | |
} | ||
} | ||
|
||
std::vector<void*> gpu_handles; | ||
std::vector<at::Tensor> contig_inputs{}; | ||
{ | ||
std::unique_ptr<torch::autograd::profiler::RecordProfile> input_profiler_guard; | ||
if (compiled_engine->profile_execution) { | ||
input_profiler_guard = | ||
std::make_unique<torch::autograd::profiler::RecordProfile>(compiled_engine->input_profile_path); | ||
} | ||
|
||
contig_inputs.reserve(inputs.size()); | ||
|
||
for (size_t i = 0; i < inputs.size(); i++) { | ||
uint64_t pyt_idx = compiled_engine->in_binding_map[i]; | ||
std::string name = compiled_engine->in_binding_names[i]; | ||
TORCHTRT_CHECK( | ||
inputs[pyt_idx].is_cuda(), | ||
"Expected input tensors to have device cuda, found device " << inputs[pyt_idx].device()); | ||
auto expected_type = util::TRTDataTypeToScalarType(compiled_engine->exec_ctx->getEngine().getBindingDataType(i)); | ||
inputs[i].is_cuda(), "Expected input tensors to have device cuda, found device " << inputs[i].device()); | ||
auto expected_type = | ||
util::TRTDataTypeToScalarType(compiled_engine->exec_ctx->getEngine().getTensorDataType(name.c_str())); | ||
TORCHTRT_CHECK( | ||
inputs[pyt_idx].dtype() == expected_type, | ||
"Expected input tensors to have type " << expected_type << ", found type " << inputs[pyt_idx].dtype()); | ||
auto dims = core::util::toDimsPad(inputs[pyt_idx].sizes(), 1); | ||
inputs[i].dtype() == expected_type, | ||
"Expected input tensors to have type " << expected_type << ", found type " << inputs[i].dtype()); | ||
auto dims = core::util::toDimsPad(inputs[i].sizes(), 1); | ||
auto shape = core::util::toVec(dims); | ||
contig_inputs.push_back(inputs[pyt_idx].view(shape).contiguous()); | ||
LOG_DEBUG("Input shape: " << dims); | ||
compiled_engine->exec_ctx->setBindingDimensions(i, dims); | ||
gpu_handles.push_back(contig_inputs.back().data_ptr()); | ||
LOG_DEBUG("Input Name: " << name << " Shape: " << dims); | ||
compiled_engine->exec_ctx->setInputShape(name.c_str(), dims); | ||
compiled_engine->exec_ctx->setTensorAddress(name.c_str(), inputs[i].view(shape).contiguous().data_ptr()); | ||
} | ||
|
||
TORCHTRT_CHECK( | ||
compiled_engine->exec_ctx->allInputDimensionsSpecified(), | ||
"Not enough inputs provided (torch.ops.tensorrt.execute_engine)"); | ||
compiled_engine->exec_ctx->allInputShapesSpecified(), "Not enough inputs provided (runtime.RunCudaEngine)"); | ||
} | ||
|
||
std::vector<at::Tensor> outputs(compiled_engine->num_io.second); | ||
|
@@ -163,26 +157,27 @@ std::vector<at::Tensor> execute_engine(std::vector<at::Tensor> inputs, c10::intr | |
|
||
for (size_t o = inputs.size(); o < (compiled_engine->num_io.first + compiled_engine->num_io.second); o++) { | ||
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. Same thing here, use output_binding_names to pull out the TensorRT binding index / address |
||
uint64_t pyt_idx = compiled_engine->out_binding_map[o]; | ||
auto out_shape = compiled_engine->exec_ctx->getBindingDimensions(o); | ||
LOG_DEBUG("Output shape: " << out_shape); | ||
std::string name = compiled_engine->out_binding_names[pyt_idx]; | ||
auto out_shape = compiled_engine->exec_ctx->getTensorShape(name.c_str()); | ||
LOG_DEBUG("Output Name: " << name << " Shape: " << out_shape); | ||
auto dims = core::util::toVec(out_shape); | ||
auto type = util::TRTDataTypeToScalarType(compiled_engine->exec_ctx->getEngine().getBindingDataType(o)); | ||
auto type = util::TRTDataTypeToScalarType(compiled_engine->exec_ctx->getEngine().getTensorDataType(name.c_str())); | ||
outputs[pyt_idx] = std::move(at::empty(dims, {at::kCUDA}).to(type).contiguous()); | ||
gpu_handles.push_back(outputs[pyt_idx].data_ptr()); | ||
compiled_engine->exec_ctx->setTensorAddress(name.c_str(), outputs[pyt_idx].data_ptr()); | ||
} | ||
} | ||
|
||
{ | ||
std::unique_ptr<torch::autograd::profiler::RecordProfile> enqueue_profiler_guard; | ||
if (compiled_engine->profile_execution) { | ||
enqueue_profiler_guard = | ||
std::make_unique<torch::autograd::profiler::RecordProfile>(compiled_engine->enqueue_profile_path); | ||
} | ||
|
||
c10::cuda::CUDAStream stream = c10::cuda::getCurrentCUDAStream(inputs[0].device().index()); | ||
|
||
// nvinfer1::IExecutionContext::enqueue is not thread safe and we need a mutex for it. | ||
std::unique_lock<std::mutex> lock(compiled_engine->mu); | ||
compiled_engine->exec_ctx->enqueueV2(gpu_handles.data(), stream, nullptr); | ||
compiled_engine->exec_ctx->enqueueV3(stream); | ||
if (compiled_engine->profile_execution) { | ||
LOG_INFO(std::endl << *compiled_engine->trt_engine_profiler); | ||
dump_trace(compiled_engine->trt_engine_profile_path, *compiled_engine->trt_engine_profiler); | ||
|
This file contains hidden or 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 hidden or 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 |
---|---|---|
@@ -1,7 +1,6 @@ | ||
numpy | ||
pybind11==2.6.2 | ||
--extra-index-url https://download.pytorch.org/whl/nightly/cu116 | ||
torch==1.13.0.dev20220921+cu116 | ||
torchvision==0.14.0.dev20220921+cu116 | ||
torch==1.13.0 | ||
torchvision==0.14.0 | ||
--extra-index-url https://pypi.ngc.nvidia.com | ||
nvidia-tensorrt==8.4.3.1 | ||
tensorrt==8.5.1.7 |
This file contains hidden or 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
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.
Just a note for later, should we be keeping this object around?