Skip to content

Commit 0b8321b

Browse files
committed
chore: Suppress code location errors by default and in debug mode, show the list of unsupported ops
Signed-off-by: Dheeraj Peri <[email protected]>
1 parent 11bcb98 commit 0b8321b

File tree

2 files changed

+9
-11
lines changed

2 files changed

+9
-11
lines changed

core/compiler.cpp

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -417,18 +417,16 @@ torch::jit::Module CompileGraph(const torch::jit::Module& mod, CompileSpec cfg)
417417
auto first_use_types = ir::get_block_first_calc_dtypes_opt(g->block());
418418

419419
MapInputsAndDetermineDTypes(cfg, g, static_params, first_use_types);
420-
420+
auto isBlockConvertible = conversion::VerifyConverterSupportForBlock(g->block(), true);
421421
if (cfg.partition_info.enabled &&
422422
(cfg.lower_info.forced_fallback_modules.size() == 0 &&
423-
cfg.partition_info.forced_fallback_operators.size() == 0 &&
424-
conversion::VerifyConverterSupportForBlock(g->block(), true))) {
423+
cfg.partition_info.forced_fallback_operators.size() == 0 && isBlockConvertible)) {
425424
LOG_INFO("Skipping partitioning since model is fully supported");
426425
}
427426

428427
if (cfg.partition_info.enabled &&
429428
!(cfg.lower_info.forced_fallback_modules.size() == 0 &&
430-
cfg.partition_info.forced_fallback_operators.size() == 0 &&
431-
conversion::VerifyConverterSupportForBlock(g->block(), true))) {
429+
cfg.partition_info.forced_fallback_operators.size() == 0 && isBlockConvertible)) {
432430
auto input_ivalues_map = partitioning::generateRandomInputs(cfg.convert_info.inputs, first_use_types);
433431
auto graph_and_mapping = ConstructFallbackGraph(new_mod, g->block(), input_ivalues_map, cfg, static_params);
434432
new_g = graph_and_mapping.first;

core/conversion/conversion.cpp

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -487,7 +487,8 @@ std::string ConvertBlockToEngine(
487487
std::unordered_map<c10::OperatorName, std::string> GetUnsupportedOpsInBlock(const torch::jit::Block* b) {
488488
std::unordered_map<c10::OperatorName, std::string> unsupported_ops;
489489
for (const auto n : b->nodes()) {
490-
if (n->kind() != torch::jit::prim::Loop && n->kind() != torch::jit::prim::If && !OpSupported(n)) {
490+
if (n->kind() != torch::jit::prim::Loop && n->kind() != torch::jit::prim::If && !OpSupported(n) &&
491+
n->kind() != torch::jit::prim::DictConstruct) {
491492
auto schema = n->maybeSchema();
492493
TORCHTRT_CHECK(
493494
schema,
@@ -544,9 +545,7 @@ bool VerifyConverterSupportForBlock(const torch::jit::Block* b, bool suppress_er
544545
unsupported_msg << "https://www.github.com/nvidia/Torch-TensorRT/issues" << std::endl;
545546
unsupported_msg << std::endl << "In Module:" << std::endl;
546547

547-
if (!suppress_errors) {
548-
LOG_ERROR(unsupported_msg.str());
549-
}
548+
LOG_DEBUG(unsupported_msg.str());
550549

551550
std::unordered_map<std::string, std::unordered_set<std::string>> unsupported_node_locations;
552551
for (const auto n : b->nodes()) {
@@ -571,8 +570,9 @@ bool VerifyConverterSupportForBlock(const torch::jit::Block* b, bool suppress_er
571570
for (const auto& str : type.second) {
572571
traceback << str;
573572
}
574-
auto tb_str = traceback.str();
575-
LOG_ERROR(tb_str);
573+
if (!suppress_errors) {
574+
LOG_ERROR(traceback.str());
575+
}
576576
}
577577

578578
return false;

0 commit comments

Comments
 (0)