Skip to content

Commit 27f7acb

Browse files
borisfomperi044
authored andcommitted
Reverted Logger changes - TRT fixed the bug that caused the crash
Signed-off-by: Boris Fomitchev <[email protected]>
1 parent df7bef2 commit 27f7acb

File tree

5 files changed

+19
-6
lines changed

5 files changed

+19
-6
lines changed

core/conversion/conversionctx/ConversionCtx.cpp

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,10 @@ std::ostream& operator<<(std::ostream& os, const BuilderSettings& s) {
4141

4242
ConversionCtx::ConversionCtx(BuilderSettings build_settings)
4343
: settings(build_settings),
44-
logger(util::logging::get_logger()) {
44+
logger(
45+
"[TRTorch Conversion Context] - ",
46+
util::logging::get_logger().get_reportable_severity(),
47+
util::logging::get_logger().get_is_colored_output_on()) {
4548
// TODO: Support FP16 and FP32 from JIT information
4649
if (settings.device.gpu_id) {
4750
TRTORCH_CHECK(

core/conversion/conversionctx/ConversionCtx.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ struct ConversionCtx {
6060
nvinfer1::DataType input_type;
6161
nvinfer1::DataType op_precision;
6262
BuilderSettings settings;
63-
util::logging::TRTorchLogger& logger;
63+
util::logging::TRTorchLogger logger;
6464
// Pointers to data that needs to remain alive until conversion is done
6565
// All data will be freed when the destructor is called
6666
// The weights class is the main consumer of this, each time a weight object

core/plugins/register_plugins.cpp

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,10 @@ class TRTorchPluginRegistry {
4141
}
4242

4343
public:
44-
util::logging::TRTorchLogger& plugin_logger = util::logging::get_logger();
44+
util::logging::TRTorchLogger plugin_logger = util::logging::TRTorchLogger(
45+
"[TRTorch Plugins Context] - ",
46+
util::logging::get_logger().get_reportable_log_level(),
47+
util::logging::get_logger().get_is_colored_output_on());
4548
};
4649

4750
namespace {

core/runtime/TRTEngine.cpp

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,14 +16,20 @@ std::string slugify(std::string s) {
1616
}
1717

1818
TRTEngine::TRTEngine(std::string serialized_engine)
19-
{
19+
: logger(
20+
std::string("[] - "),
21+
util::logging::get_logger().get_reportable_severity(),
22+
util::logging::get_logger().get_is_colored_output_on()) {
2023
std::string _name = "deserialized_trt";
2124
new (this) TRTEngine(_name, serialized_engine);
2225
}
2326

2427
TRTEngine::TRTEngine(std::string mod_name, std::string serialized_engine)
25-
{
26-
rt = nvinfer1::createInferRuntime(util::logging::get_logger());
28+
: logger(
29+
std::string("[") + mod_name + std::string("_engine] - "),
30+
util::logging::get_logger().get_reportable_severity(),
31+
util::logging::get_logger().get_is_colored_output_on()) {
32+
rt = nvinfer1::createInferRuntime(logger);
2733

2834
name = slugify(mod_name) + "_engine";
2935

core/runtime/runtime.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ struct TRTEngine : torch::CustomClassHolder {
1919
std::pair<uint64_t, uint64_t> num_io;
2020
EngineID id;
2121
std::string name;
22+
util::logging::TRTorchLogger logger;
2223

2324
std::unordered_map<uint64_t, uint64_t> in_binding_map;
2425
std::unordered_map<uint64_t, uint64_t> out_binding_map;

0 commit comments

Comments
 (0)