pytorch
3c003aa6 - [PyTorchEdge] promote prim ops by using ops table for mobile runtime (#64816)

Commit
3 years ago
[PyTorchEdge] promote prim ops by using ops table for mobile runtime (#64816) Summary: Pull Request resolved: https://github.com/pytorch/pytorch/pull/64816 ## Context: Promoting prim ops: Certain prim ops are frequent than others (like tupleIndex, raiseException, ...). These ops are frequent that they are chosen to be promoted as first class instructions. To promote it requires multiple steps and support from TS team as it changes how the bytecode is serialized and deserialized. So to prevent multiple bytecode version bumps and provided stability while these changes happen, an iterim iterative process is proposed which uses a table to lookup for "promoted" op's function. This allows us to rapidly update the ops list and test on production model without having to change the bytecode. In case of failure, we can quickly revert this change. ## Observation The ops are chosen based on the notebook N1135657 which examines the top frequent ops. ## Fix An iterim solution of having a static table, which when given a prim op name returns a function to be applied on the stack. This helps us check in `function.cpp` to get the "promoted" op. As a fall back, the "promoted" op still resides in `register_prim_ops.cpp` so that the function of prim op is never missed. ghstack-source-id: 138261338 Test Plan: ``` [pavithran@67109.od ~/fbsource/fbcode (eddab7da6)]$ buck test caffe2/test/cpp/jit:jit -- BackendTest.TestComposite Building: finished in 5.4 sec (100%) 7284/7284 jobs, 0/7284 updated Total time: 5.8 sec More details at https://www.internalfb.com/intern/buck/build/480191aa-a1ba-42ca-99e9-ee4bf2b06d65 Tpx test run coordinator for Facebook. See https://fburl.com/tpx for details. Running with tpx session id: 867382eb-327f-43d7-a45c-875b7f484b15 Trace available for this run at /tmp/tpx-20210914-100224.283682/trace.log Started reporting to test run: https://www.internalfb.com/intern/testinfra/testrun/844425134506115 ✓ ListingSuccess: caffe2/test/cpp/jit:jit - main (12.159) ✓ Pass: caffe2/test/cpp/jit:jit - BackendTest.TestCompositeWithSetStates (0.797) ✓ Pass: caffe2/test/cpp/jit:jit - BackendTest.TestComposite (0.779) Summary Pass: 2 ListingSuccess: 1 If you need help understanding your runs, please follow the wiki: https://fburl.com/posting_in_tpx_users Finished test run: https://www.internalfb.com/intern/testinfra/testrun/844425134506115 ``` {F663491347} Reviewed By: iseeyuan Differential Revision: D30819926 fbshipit-source-id: 4cbe05d5761bdc9d62ef08e18172dcf64cb49526
Author
Parents
Loading