pytorch/test/cpp
Wang, Eikan 252e1ccce6 Enable TE fuser to support user defined operator (#73073)
Summary:
PyTorch supports registering a custom operator by `TORCH_LIBRARY_FRAGMENT` / `TORCH_LIBRARY_IMPL` and `torch::jit::tensorexpr::getNNCLoweringRegistry` could insert a custom operator. But the te fuser passes conditional check does not support custom operator. The `isSupported` of `tensorexpr_fuser` checks whether the `Node` is `get_tensorexpr_elementwise_set()`, `supported_non_eltwise_set()`, `supported_misc_set` and `supported_reduction_set`. If a custom operator needs to be added to the TE fusion group, the checked will block it.

Taking the RN50 as an example, we can speed up the model by fusing the convolution and consecutive element-wise operator into a custom operator. The framework overhead becomes non-negligible when the computation becomes more efficient, especially for the latency mode and the tiny models. If the TE fuser allows adding the custom operator to the fusion group, then the entire RN50 model could be fused by TE as a single operator/function consisting of "ExternalCalls" and TE-IR.  This could significantly reduce framework overhead, which in turn improves RN50 E2E performance. The same goes for other models.

Pull Request resolved: https://github.com/pytorch/pytorch/pull/73073

Reviewed By: pbelevich

Differential Revision: D35453165

Pulled By: ZolotukhinM

fbshipit-source-id: a764cf340b0b1e05fe230649cbe44f5786bdd37d
(cherry picked from commit ee95aa4d36714540fbb216a338799e6a6bb966d5)
2022-04-07 04:36:39 +00:00
..
api Extend jit::load to work on flatbuffer file; Take 2 (#75256) 2022-04-06 17:54:01 +00:00
c10d
common
dist_autograd
jit Remove internal logic to handle bytecode version 3 (#57775) 2022-04-07 01:45:52 +00:00
lazy Move shape and operand definitions to base node (#75223) 2022-04-06 01:43:46 +00:00
lite_interpreter_runtime [PyTorch] Add codegen unboxing ability (#69881) 2022-03-01 23:28:13 +00:00
monitor
profiler [Profiler] Prefer TSC to wall clock when available (#73855) 2022-03-13 18:29:06 +00:00
rpc
tensorexpr Enable TE fuser to support user defined operator (#73073) 2022-04-07 04:36:39 +00:00
__init__.py