-
Notifications
You must be signed in to change notification settings - Fork 363
feat(//core)!: Added support for Device meta data serialization and d… #484
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
Conversation
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.
There are some changes that do not conform to Python style guidelines:
Reformatting /workspace/cpp/ptq/training/vgg16/vgg16.py
Reformatting /workspace/cpp/ptq/training/vgg16/export_ckpt.py
Reformatting /workspace/cpp/ptq/training/vgg16/main.py
Reformatting /workspace/tests/modules/hub.py
Reformatting /workspace/tests/py/model_test_case.py
Reformatting /workspace/tests/py/test_ptq_trt_calibrator.py
Reformatting /workspace/tests/py/test_ptq_dataloader_calibrator.py
--- /workspace/tests/py/test_multi_gpu.py (original)
+++ /workspace/tests/py/test_multi_gpu.py (reformatted)
@@ -113,7 +113,9 @@
def test_suite():
suite = unittest.TestSuite()
suite.addTest(TestMultiGpuSwitching.parametrize(TestMultiGpuSwitching, model=models.resnet18(pretrained=True)))
- suite.addTest(TestMultiGpuSerializeDeserializeSwitching.parametrize(TestMultiGpuSwitching, model=models.resnet18(pretrained=True)))
+ suite.addTest(
+ TestMultiGpuSerializeDeserializeSwitching.parametrize(TestMultiGpuSwitching,
+ model=models.resnet18(pretrained=True)))
return suite
Reformatting /workspace/tests/py/test_api.py
Reformatting /workspace/tests/py/test_ptq_to_backend.py
Reformatting /workspace/tests/py/test_trt_intercompatability.py
Reformatting /workspace/tests/py/test_to_backend_api.py
Reformatting /workspace/tests/py/test_api_dla.py
Reformatting /workspace/tests/py/test_multi_gpu.py
ERROR: Some files do not conform to style guidelines
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.
There are some changes that do not conform to C++ style guidelines:
diff --git a/workspace/core/runtime/register_trt_op.cpp b/tmp/changes.txt
index 794faa3..93cfdda 100644
--- a/workspace/core/runtime/register_trt_op.cpp
+++ b/tmp/changes.txt
@@ -14,20 +14,24 @@ namespace runtime {
bool is_switch_required(const CudaDevice& curr_device, const CudaDevice& conf_device) {
// If SM capability is not the same as configured then switch
if ((curr_device.major != conf_device.major) || (curr_device.minor != conf_device.minor)) {
- LOG_WARNING("Configured SM capability does not match with current device ID. Switching context");
- return true;
+ LOG_WARNING("Configured SM capability does not match with current device ID. Switching context");
+ return true;
}
// GPU case
if (conf_device.device_type == nvinfer1::DeviceType::kGPU) {
if (curr_device.device_name != conf_device.device_name) {
- LOG_WARNING("TRTEngine compiled for " << conf_device.device_name << " but current CUDA device is " << curr_device.device_name << ". Switching the device context");
+ LOG_WARNING(
+ "TRTEngine compiled for " << conf_device.device_name << " but current CUDA device is "
+ << curr_device.device_name << ". Switching the device context");
return true;
}
}
if (curr_device.id != conf_device.id) {
- LOG_WARNING("Configured Device ID: " << conf_device.id << " is different that current device ID: " << curr_device.id << ". Switching context");
+ LOG_WARNING(
+ "Configured Device ID: " << conf_device.id << " is different that current device ID: " << curr_device.id
+ << ". Switching context");
return true;
}
@@ -47,27 +51,28 @@ int select_cuda_device(const CudaDevice& conf_device) {
cudaDeviceProp device_prop;
- for (int i=0; i < num_devices; i++) {
- TRTORCH_CHECK((cudaGetDeviceProperties(&device_prop, i) == cudaSuccess), "Unable to read CUDA Device Properies for device id: " << i);
+ for (int i = 0; i < num_devices; i++) {
+ TRTORCH_CHECK(
+ (cudaGetDeviceProperties(&device_prop, i) == cudaSuccess),
+ "Unable to read CUDA Device Properies for device id: " << i);
auto compute_cap = std::to_string(device_prop.major) + "." + std::to_string(device_prop.minor);
std::string device_name{device_prop.name};
// In case of DLA select the DLA supported device ID
if (conf_device.device_type == nvinfer1::DeviceType::kDLA) {
- if (dla_supported_SM.find(compute_cap) != dla_supported_SM.end() && dla_supported_SM[compute_cap] == device_name) {
- device_id = i;
- break;
- }
- }
- else if (conf_device.device_type == nvinfer1::DeviceType::kGPU) {
+ if (dla_supported_SM.find(compute_cap) != dla_supported_SM.end() &&
+ dla_supported_SM[compute_cap] == device_name) {
+ device_id = i;
+ break;
+ }
+ } else if (conf_device.device_type == nvinfer1::DeviceType::kGPU) {
auto conf_sm = std::to_string(conf_device.major) + "." + std::to_string(conf_device.minor);
if (compute_cap == conf_sm && device_name == conf_device.device_name) {
device_id = i;
break;
}
- }
- else {
- LOG_ERROR("Unkown device type detected from the compiled engine");
- break;
+ } else {
+ LOG_ERROR("Unkown device type detected from the compiled engine");
+ break;
}
}
return device_id;
@@ -86,7 +91,7 @@ std::vector<at::Tensor> execute_engine(std::vector<at::Tensor> inputs, c10::intr
std::string target_device = "cuda:" + std::to_string(device.id);
- for(auto& in : inputs) {
+ for (auto& in : inputs) {
in = in.to(at::kCUDA);
}
}
diff --git a/workspace/tests/modules/test_multi_gpu_serdes.cpp b/tmp/changes.txt
index 57158dc..ce6baa3 100644
--- a/workspace/tests/modules/test_multi_gpu_serdes.cpp
+++ b/tmp/changes.txt
@@ -15,7 +15,7 @@ TEST_P(ModuleTests, CompiledModuleIsClose) {
jit_results.push_back(jit_results_ivalues.toTensor());
auto trt_mod = trtorch::CompileGraph(mod, input_shapes);
-
+
// Deliberately changing the device ID. TRTorch runtime should correct the Device ID internally
trtorch::set_device(1);
torch::jit::IValue trt_results_ivalues = trtorch::tests::util::RunModuleForward(trt_mod, trt_inputs_ivalues);
@@ -30,5 +30,4 @@ TEST_P(ModuleTests, CompiledModuleIsClose) {
INSTANTIATE_TEST_SUITE_P(
CompiledModuleForwardIsCloseSuite,
ModuleTests,
- testing::Values(
- PathAndInSize({"tests/modules/resnet18_traced.jit.pt", {{1, 3, 224, 224}}})));
+ testing::Values(PathAndInSize({"tests/modules/resnet18_traced.jit.pt", {{1, 3, 224, 224}}})));
diff --git a/workspace/tests/modules/test_modules_as_engines.cpp b/tmp/changes.txt
index dafda30..719cfc8 100644
--- a/workspace/tests/modules/test_modules_as_engines.cpp
+++ b/tmp/changes.txt
@@ -1,6 +1,5 @@
-#include "module_test.h"
#include "core/runtime/runtime.h"
-
+#include "module_test.h"
TEST_P(ModuleTests, ModuleAsEngineIsClose) {
std::vector<at::Tensor> inputs;
ERROR: Some files do not conform to style guidelines
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.
There are some changes that do not conform to C++ style guidelines:
diff --git a/workspace/core/runtime/register_trt_op.cpp b/tmp/changes.txt
index 794faa3..93cfdda 100644
--- a/workspace/core/runtime/register_trt_op.cpp
+++ b/tmp/changes.txt
@@ -14,20 +14,24 @@ namespace runtime {
bool is_switch_required(const CudaDevice& curr_device, const CudaDevice& conf_device) {
// If SM capability is not the same as configured then switch
if ((curr_device.major != conf_device.major) || (curr_device.minor != conf_device.minor)) {
- LOG_WARNING("Configured SM capability does not match with current device ID. Switching context");
- return true;
+ LOG_WARNING("Configured SM capability does not match with current device ID. Switching context");
+ return true;
}
// GPU case
if (conf_device.device_type == nvinfer1::DeviceType::kGPU) {
if (curr_device.device_name != conf_device.device_name) {
- LOG_WARNING("TRTEngine compiled for " << conf_device.device_name << " but current CUDA device is " << curr_device.device_name << ". Switching the device context");
+ LOG_WARNING(
+ "TRTEngine compiled for " << conf_device.device_name << " but current CUDA device is "
+ << curr_device.device_name << ". Switching the device context");
return true;
}
}
if (curr_device.id != conf_device.id) {
- LOG_WARNING("Configured Device ID: " << conf_device.id << " is different that current device ID: " << curr_device.id << ". Switching context");
+ LOG_WARNING(
+ "Configured Device ID: " << conf_device.id << " is different that current device ID: " << curr_device.id
+ << ". Switching context");
return true;
}
@@ -47,27 +51,28 @@ int select_cuda_device(const CudaDevice& conf_device) {
cudaDeviceProp device_prop;
- for (int i=0; i < num_devices; i++) {
- TRTORCH_CHECK((cudaGetDeviceProperties(&device_prop, i) == cudaSuccess), "Unable to read CUDA Device Properies for device id: " << i);
+ for (int i = 0; i < num_devices; i++) {
+ TRTORCH_CHECK(
+ (cudaGetDeviceProperties(&device_prop, i) == cudaSuccess),
+ "Unable to read CUDA Device Properies for device id: " << i);
auto compute_cap = std::to_string(device_prop.major) + "." + std::to_string(device_prop.minor);
std::string device_name{device_prop.name};
// In case of DLA select the DLA supported device ID
if (conf_device.device_type == nvinfer1::DeviceType::kDLA) {
- if (dla_supported_SM.find(compute_cap) != dla_supported_SM.end() && dla_supported_SM[compute_cap] == device_name) {
- device_id = i;
- break;
- }
- }
- else if (conf_device.device_type == nvinfer1::DeviceType::kGPU) {
+ if (dla_supported_SM.find(compute_cap) != dla_supported_SM.end() &&
+ dla_supported_SM[compute_cap] == device_name) {
+ device_id = i;
+ break;
+ }
+ } else if (conf_device.device_type == nvinfer1::DeviceType::kGPU) {
auto conf_sm = std::to_string(conf_device.major) + "." + std::to_string(conf_device.minor);
if (compute_cap == conf_sm && device_name == conf_device.device_name) {
device_id = i;
break;
}
- }
- else {
- LOG_ERROR("Unkown device type detected from the compiled engine");
- break;
+ } else {
+ LOG_ERROR("Unkown device type detected from the compiled engine");
+ break;
}
}
return device_id;
@@ -86,7 +91,7 @@ std::vector<at::Tensor> execute_engine(std::vector<at::Tensor> inputs, c10::intr
std::string target_device = "cuda:" + std::to_string(device.id);
- for(auto& in : inputs) {
+ for (auto& in : inputs) {
in = in.to(at::kCUDA);
}
}
diff --git a/workspace/tests/modules/test_multi_gpu_serdes.cpp b/tmp/changes.txt
index 57158dc..ce6baa3 100644
--- a/workspace/tests/modules/test_multi_gpu_serdes.cpp
+++ b/tmp/changes.txt
@@ -15,7 +15,7 @@ TEST_P(ModuleTests, CompiledModuleIsClose) {
jit_results.push_back(jit_results_ivalues.toTensor());
auto trt_mod = trtorch::CompileGraph(mod, input_shapes);
-
+
// Deliberately changing the device ID. TRTorch runtime should correct the Device ID internally
trtorch::set_device(1);
torch::jit::IValue trt_results_ivalues = trtorch::tests::util::RunModuleForward(trt_mod, trt_inputs_ivalues);
@@ -30,5 +30,4 @@ TEST_P(ModuleTests, CompiledModuleIsClose) {
INSTANTIATE_TEST_SUITE_P(
CompiledModuleForwardIsCloseSuite,
ModuleTests,
- testing::Values(
- PathAndInSize({"tests/modules/resnet18_traced.jit.pt", {{1, 3, 224, 224}}})));
+ testing::Values(PathAndInSize({"tests/modules/resnet18_traced.jit.pt", {{1, 3, 224, 224}}})));
diff --git a/workspace/tests/modules/test_modules_as_engines.cpp b/tmp/changes.txt
index dafda30..719cfc8 100644
--- a/workspace/tests/modules/test_modules_as_engines.cpp
+++ b/tmp/changes.txt
@@ -1,6 +1,5 @@
-#include "module_test.h"
#include "core/runtime/runtime.h"
-
+#include "module_test.h"
TEST_P(ModuleTests, ModuleAsEngineIsClose) {
std::vector<at::Tensor> inputs;
ERROR: Some files do not conform to style guidelines
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.
There are some changes that do not conform to Python style guidelines:
Reformatting /workspace/cpp/ptq/training/vgg16/vgg16.py
Reformatting /workspace/cpp/ptq/training/vgg16/export_ckpt.py
Reformatting /workspace/cpp/ptq/training/vgg16/main.py
Reformatting /workspace/tests/py/test_api.py
Reformatting /workspace/tests/py/test_ptq_to_backend.py
Reformatting /workspace/tests/py/test_trt_intercompatability.py
Reformatting /workspace/tests/py/test_ptq_trt_calibrator.py
Reformatting /workspace/tests/py/test_ptq_dataloader_calibrator.py
--- /workspace/tests/py/test_multi_gpu.py (original)
+++ /workspace/tests/py/test_multi_gpu.py (reformatted)
@@ -113,7 +113,9 @@
def test_suite():
suite = unittest.TestSuite()
suite.addTest(TestMultiGpuSwitching.parametrize(TestMultiGpuSwitching, model=models.resnet18(pretrained=True)))
- suite.addTest(TestMultiGpuSerializeDeserializeSwitching.parametrize(TestMultiGpuSwitching, model=models.resnet18(pretrained=True)))
+ suite.addTest(
+ TestMultiGpuSerializeDeserializeSwitching.parametrize(TestMultiGpuSwitching,
+ model=models.resnet18(pretrained=True)))
return suite
Reformatting /workspace/tests/modules/hub.py
Reformatting /workspace/tests/py/model_test_case.py
Reformatting /workspace/tests/py/test_to_backend_api.py
Reformatting /workspace/tests/py/test_api_dla.py
Reformatting /workspace/tests/py/test_multi_gpu.py
ERROR: Some files do not conform to style guidelines
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.
There are some changes that do not conform to Python style guidelines:
Reformatting /workspace/cpp/ptq/training/vgg16/vgg16.py
Reformatting /workspace/cpp/ptq/training/vgg16/export_ckpt.py
Reformatting /workspace/cpp/ptq/training/vgg16/main.py
Reformatting /workspace/tests/modules/hub.py
Reformatting /workspace/tests/py/model_test_case.py
Reformatting /workspace/tests/py/test_ptq_trt_calibrator.py
Reformatting /workspace/tests/py/test_ptq_dataloader_calibrator.py
--- /workspace/tests/py/test_multi_gpu.py (original)
+++ /workspace/tests/py/test_multi_gpu.py (reformatted)
@@ -113,7 +113,9 @@
def test_suite():
suite = unittest.TestSuite()
suite.addTest(TestMultiGpuSwitching.parametrize(TestMultiGpuSwitching, model=models.resnet18(pretrained=True)))
- suite.addTest(TestMultiGpuSerializeDeserializeSwitching.parametrize(TestMultiGpuSwitching, model=models.resnet18(pretrained=True)))
+ suite.addTest(
+ TestMultiGpuSerializeDeserializeSwitching.parametrize(TestMultiGpuSwitching,
+ model=models.resnet18(pretrained=True)))
return suite
Reformatting /workspace/tests/py/test_api.py
Reformatting /workspace/tests/py/test_ptq_to_backend.py
Reformatting /workspace/tests/py/test_trt_intercompatability.py
Reformatting /workspace/tests/py/test_to_backend_api.py
Reformatting /workspace/tests/py/test_api_dla.py
Reformatting /workspace/tests/py/test_multi_gpu.py
ERROR: Some files do not conform to style guidelines
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.
There are some changes that do not conform to C++ style guidelines:
diff --git a/workspace/core/runtime/register_trt_op.cpp b/tmp/changes.txt
index 794faa3..93cfdda 100644
--- a/workspace/core/runtime/register_trt_op.cpp
+++ b/tmp/changes.txt
@@ -14,20 +14,24 @@ namespace runtime {
bool is_switch_required(const CudaDevice& curr_device, const CudaDevice& conf_device) {
// If SM capability is not the same as configured then switch
if ((curr_device.major != conf_device.major) || (curr_device.minor != conf_device.minor)) {
- LOG_WARNING("Configured SM capability does not match with current device ID. Switching context");
- return true;
+ LOG_WARNING("Configured SM capability does not match with current device ID. Switching context");
+ return true;
}
// GPU case
if (conf_device.device_type == nvinfer1::DeviceType::kGPU) {
if (curr_device.device_name != conf_device.device_name) {
- LOG_WARNING("TRTEngine compiled for " << conf_device.device_name << " but current CUDA device is " << curr_device.device_name << ". Switching the device context");
+ LOG_WARNING(
+ "TRTEngine compiled for " << conf_device.device_name << " but current CUDA device is "
+ << curr_device.device_name << ". Switching the device context");
return true;
}
}
if (curr_device.id != conf_device.id) {
- LOG_WARNING("Configured Device ID: " << conf_device.id << " is different that current device ID: " << curr_device.id << ". Switching context");
+ LOG_WARNING(
+ "Configured Device ID: " << conf_device.id << " is different that current device ID: " << curr_device.id
+ << ". Switching context");
return true;
}
@@ -47,27 +51,28 @@ int select_cuda_device(const CudaDevice& conf_device) {
cudaDeviceProp device_prop;
- for (int i=0; i < num_devices; i++) {
- TRTORCH_CHECK((cudaGetDeviceProperties(&device_prop, i) == cudaSuccess), "Unable to read CUDA Device Properies for device id: " << i);
+ for (int i = 0; i < num_devices; i++) {
+ TRTORCH_CHECK(
+ (cudaGetDeviceProperties(&device_prop, i) == cudaSuccess),
+ "Unable to read CUDA Device Properies for device id: " << i);
auto compute_cap = std::to_string(device_prop.major) + "." + std::to_string(device_prop.minor);
std::string device_name{device_prop.name};
// In case of DLA select the DLA supported device ID
if (conf_device.device_type == nvinfer1::DeviceType::kDLA) {
- if (dla_supported_SM.find(compute_cap) != dla_supported_SM.end() && dla_supported_SM[compute_cap] == device_name) {
- device_id = i;
- break;
- }
- }
- else if (conf_device.device_type == nvinfer1::DeviceType::kGPU) {
+ if (dla_supported_SM.find(compute_cap) != dla_supported_SM.end() &&
+ dla_supported_SM[compute_cap] == device_name) {
+ device_id = i;
+ break;
+ }
+ } else if (conf_device.device_type == nvinfer1::DeviceType::kGPU) {
auto conf_sm = std::to_string(conf_device.major) + "." + std::to_string(conf_device.minor);
if (compute_cap == conf_sm && device_name == conf_device.device_name) {
device_id = i;
break;
}
- }
- else {
- LOG_ERROR("Unkown device type detected from the compiled engine");
- break;
+ } else {
+ LOG_ERROR("Unkown device type detected from the compiled engine");
+ break;
}
}
return device_id;
@@ -86,7 +91,7 @@ std::vector<at::Tensor> execute_engine(std::vector<at::Tensor> inputs, c10::intr
std::string target_device = "cuda:" + std::to_string(device.id);
- for(auto& in : inputs) {
+ for (auto& in : inputs) {
in = in.to(at::kCUDA);
}
}
diff --git a/workspace/tests/modules/test_multi_gpu_serdes.cpp b/tmp/changes.txt
index 57158dc..ce6baa3 100644
--- a/workspace/tests/modules/test_multi_gpu_serdes.cpp
+++ b/tmp/changes.txt
@@ -15,7 +15,7 @@ TEST_P(ModuleTests, CompiledModuleIsClose) {
jit_results.push_back(jit_results_ivalues.toTensor());
auto trt_mod = trtorch::CompileGraph(mod, input_shapes);
-
+
// Deliberately changing the device ID. TRTorch runtime should correct the Device ID internally
trtorch::set_device(1);
torch::jit::IValue trt_results_ivalues = trtorch::tests::util::RunModuleForward(trt_mod, trt_inputs_ivalues);
@@ -30,5 +30,4 @@ TEST_P(ModuleTests, CompiledModuleIsClose) {
INSTANTIATE_TEST_SUITE_P(
CompiledModuleForwardIsCloseSuite,
ModuleTests,
- testing::Values(
- PathAndInSize({"tests/modules/resnet18_traced.jit.pt", {{1, 3, 224, 224}}})));
+ testing::Values(PathAndInSize({"tests/modules/resnet18_traced.jit.pt", {{1, 3, 224, 224}}})));
diff --git a/workspace/tests/modules/test_modules_as_engines.cpp b/tmp/changes.txt
index dafda30..719cfc8 100644
--- a/workspace/tests/modules/test_modules_as_engines.cpp
+++ b/tmp/changes.txt
@@ -1,6 +1,5 @@
-#include "module_test.h"
#include "core/runtime/runtime.h"
-
+#include "module_test.h"
TEST_P(ModuleTests, ModuleAsEngineIsClose) {
std::vector<at::Tensor> inputs;
ERROR: Some files do not conform to style guidelines
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.
There are some changes that do not conform to C++ style guidelines:
diff --git a/workspace/core/lowering/register_trt_placeholder_ops.cpp b/tmp/changes.txt
index 2943246..6ced91f 100644
--- a/workspace/core/lowering/register_trt_placeholder_ops.cpp
+++ b/tmp/changes.txt
@@ -10,7 +10,10 @@ c10::AliasAnalysisKind aliasAnalysisFromSchema() {
RegisterOperators trt_placeholder_ops_reg({
/// Op marks a Tensor to be conveted from an Torch Tensor
/// to a TRT constant Tensor
- Operator("trt::const(Tensor val) -> Tensor", [](Stack* stack) {}, aliasAnalysisFromSchema()),
+ Operator(
+ "trt::const(Tensor val) -> Tensor",
+ [](Stack* stack) {},
+ aliasAnalysisFromSchema()),
});
} // namespace jit
diff --git a/workspace/core/plugins/impl/normalize_plugin.cpp b/tmp/changes.txt
index e1cb106..7857dc1 100644
--- a/workspace/core/plugins/impl/normalize_plugin.cpp
+++ b/tmp/changes.txt
@@ -184,7 +184,8 @@ int NormalizePlugin::enqueue(
// TRT <= 7.0
#if NV_TENSORRT_MAJOR < 7 || (NV_TENSORRT_MAJOR == 7 && NV_TENSORRT_MINOR < 1)
at::Tensor input = at::from_blob((void*)inputs[0], util::toVec(inputDesc->dims), [](void*) {}, tensor_options_);
- at::Tensor output = at::from_blob(outputs[0], util::volume(outputDesc->dims), [](void*) {}, tensor_options_);
+ at::Tensor output = at::from_blob(
+ outputs[0], util::volume(outputDesc->dims), [](void*) {}, tensor_options_);
at::cuda::CUDAStream torch_stream = at::cuda::getStreamFromPool();
at::cuda::CUDAStreamGuard torch_guard(torch_stream);
diff --git a/workspace/core/plugins/impl/interpolate_plugin.cpp b/tmp/changes.txt
index 43ec0d7..bd4feaa 100644
--- a/workspace/core/plugins/impl/interpolate_plugin.cpp
+++ b/tmp/changes.txt
@@ -252,7 +252,8 @@ int InterpolatePlugin::enqueue(
cudaStream_t stream) {
#if NV_TENSORRT_MAJOR < 7 || (NV_TENSORRT_MAJOR == 7 && NV_TENSORRT_MINOR < 1)
at::Tensor input = at::from_blob((void*)inputs[0], util::toVec(inputDesc->dims), [](void*) {}, tensor_options_);
- at::Tensor output = at::from_blob(outputs[0], util::volume(outputDesc->dims), [](void*) {}, tensor_options_);
+ at::Tensor output = at::from_blob(
+ outputs[0], util::volume(outputDesc->dims), [](void*) {}, tensor_options_);
at::cuda::CUDAStream torch_stream = at::cuda::getStreamFromPool();
at::cuda::CUDAStreamGuard torch_guard(torch_stream);
ERROR: Some files do not conform to style guidelines
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.
Code conforms to Python style guidelines
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.
Code conforms to Python style guidelines
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.
There are some changes that do not conform to C++ style guidelines:
diff --git a/workspace/core/lowering/register_trt_placeholder_ops.cpp b/tmp/changes.txt
index 2943246..6ced91f 100644
--- a/workspace/core/lowering/register_trt_placeholder_ops.cpp
+++ b/tmp/changes.txt
@@ -10,7 +10,10 @@ c10::AliasAnalysisKind aliasAnalysisFromSchema() {
RegisterOperators trt_placeholder_ops_reg({
/// Op marks a Tensor to be conveted from an Torch Tensor
/// to a TRT constant Tensor
- Operator("trt::const(Tensor val) -> Tensor", [](Stack* stack) {}, aliasAnalysisFromSchema()),
+ Operator(
+ "trt::const(Tensor val) -> Tensor",
+ [](Stack* stack) {},
+ aliasAnalysisFromSchema()),
});
} // namespace jit
diff --git a/workspace/core/plugins/impl/normalize_plugin.cpp b/tmp/changes.txt
index e1cb106..7857dc1 100644
--- a/workspace/core/plugins/impl/normalize_plugin.cpp
+++ b/tmp/changes.txt
@@ -184,7 +184,8 @@ int NormalizePlugin::enqueue(
// TRT <= 7.0
#if NV_TENSORRT_MAJOR < 7 || (NV_TENSORRT_MAJOR == 7 && NV_TENSORRT_MINOR < 1)
at::Tensor input = at::from_blob((void*)inputs[0], util::toVec(inputDesc->dims), [](void*) {}, tensor_options_);
- at::Tensor output = at::from_blob(outputs[0], util::volume(outputDesc->dims), [](void*) {}, tensor_options_);
+ at::Tensor output = at::from_blob(
+ outputs[0], util::volume(outputDesc->dims), [](void*) {}, tensor_options_);
at::cuda::CUDAStream torch_stream = at::cuda::getStreamFromPool();
at::cuda::CUDAStreamGuard torch_guard(torch_stream);
diff --git a/workspace/core/plugins/impl/interpolate_plugin.cpp b/tmp/changes.txt
index 43ec0d7..bd4feaa 100644
--- a/workspace/core/plugins/impl/interpolate_plugin.cpp
+++ b/tmp/changes.txt
@@ -252,7 +252,8 @@ int InterpolatePlugin::enqueue(
cudaStream_t stream) {
#if NV_TENSORRT_MAJOR < 7 || (NV_TENSORRT_MAJOR == 7 && NV_TENSORRT_MINOR < 1)
at::Tensor input = at::from_blob((void*)inputs[0], util::toVec(inputDesc->dims), [](void*) {}, tensor_options_);
- at::Tensor output = at::from_blob(outputs[0], util::volume(outputDesc->dims), [](void*) {}, tensor_options_);
+ at::Tensor output = at::from_blob(
+ outputs[0], util::volume(outputDesc->dims), [](void*) {}, tensor_options_);
at::cuda::CUDAStream torch_stream = at::cuda::getStreamFromPool();
at::cuda::CUDAStreamGuard torch_guard(torch_stream);
ERROR: Some files do not conform to style guidelines
646c054
to
a096ebc
Compare
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.
Code conforms to C++ style guidelines
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.
Code conforms to Python style guidelines
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.
Code conforms to Python style guidelines
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.
Code conforms to C++ style guidelines
…eserialization implicitly Signed-off-by: Anurag Dixit <[email protected]>
Signed-off-by: Anurag Dixit <[email protected]>
Signed-off-by: Anurag Dixit <[email protected]>
f2034a2
to
f7bef90
Compare
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.
Code conforms to Python style guidelines
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.
Code conforms to C++ style guidelines
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.
Code conforms to Python style guidelines
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.
Code conforms to C++ style guidelines
Signed-off-by: Anurag Dixit <[email protected]>
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.
Code conforms to Python style guidelines
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.
Code conforms to C++ style guidelines
Signed-off-by: Anurag Dixit <[email protected]>
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.
Code conforms to Python style guidelines
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.
Code conforms to C++ style guidelines
serde cleanup BREAKING CHANGE: This commit cleans up the WIP CudaDevice class, simplifying implementation and formalizing the seralized format for CUDA devices. It also implements ABI Versioning. The first entry in the serialized format of a TRTEngine now records the ABI that the engine was compiled with, defining expected compatibility with the TRTorch runtime. If the ABI version does not match, the runtime will error out asking to recompile the program. ABI version is a monotonically increasing integer and should be incremented everytime the serialization format changes in some way. This commit cleans up the CudaDevice class, implementing a number of constructors to replace the various utility functions that populate the struct. Descriptive utility functions remain but solely call the relevant constructor. Signed-off-by: Naren Dasan <[email protected]> Signed-off-by: Naren Dasan <[email protected]>
Signed-off-by: Naren Dasan <[email protected]> Signed-off-by: Naren Dasan <[email protected]>
feat(serde)!: Refactor CudaDevice struct, implement ABI versioning, serde cleanup
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.
Code conforms to C++ style guidelines
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.
Code conforms to Python style guidelines
…eserialization implicitly
Description
BREAKING CHANGE: Change in the signature of EmbedEngineInNewModule API will result in a breaking change.
Runtime has added support for Cuda Device metadata serialization and deserialization. TRTEngine constructor is modified.
Design discussion can be found here:
#311
Type of change
Please delete options that are not relevant and/or add your own.
Checklist: