Skip to content

Commit

Permalink
feat(//core/lowering): additional logging in module fallback
Browse files Browse the repository at this point in the history
Signed-off-by: Naren Dasan <[email protected]>
Signed-off-by: Naren Dasan <[email protected]>
  • Loading branch information
narendasan committed Aug 20, 2021
1 parent b96087b commit ad07645
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 0 deletions.
1 change: 1 addition & 0 deletions core/lowering/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ cc_library(
"drop_unused_nodes.cpp",
"lowering.cpp",
"register_trt_placeholder_ops.cpp",
"LowerInfo.cpp"
],
hdrs = [
"lowering.h",
Expand Down
23 changes: 23 additions & 0 deletions core/lowering/LowerInfo.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
#include <iostream>
#include <sstream>
#include <utility>

#include "core/lowering/lowering.h"

namespace trtorch {
namespace core {
namespace lowering {

std::ostream& operator<<(std::ostream& os, const LowerInfo& l) {
os << "Settings requested for Lowering:" << std::endl;
os << " Forced Fallback Modules: [" << std::endl;
for (auto i : l.forced_fallback_modules) {
os << " " << i << std::endl;
}
os << " ]";
return os;
}

} // namespace lowering
} // namespace core
} // namespace trtorch
3 changes: 3 additions & 0 deletions py/trtorch/_compiler.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,9 @@ def compile(module: torch.jit.ScriptModule, compile_spec: Any) -> torch.jit.Scri
"force_fallback_ops": [
"aten::max_pool2d" # List of specific ops to require running in PyTorch
],
"force_fallback_modules": [
"mypymod.mytorchmod" # List of specific torch modules to require running in PyTorch
],
"min_block_size": 3 # Minimum number of ops an engine must incapsulate to be run in TensorRT
}
}
Expand Down

0 comments on commit ad07645

Please sign in to comment.