pytorch
ca0f2670 - [Static Runtime] [RFC] Codegen support for ops with unstructured kernels (#76203)

Commit
2 years ago
[Static Runtime] [RFC] Codegen support for ops with unstructured kernels (#76203) Summary: Pull Request resolved: https://github.com/pytorch/pytorch/pull/76203 Request for comments: This change adds extra code generator support to generate out variant wrappers for operators with unstructured kernels. The current version generates 105 new out variant wrappers in addition to the existing 136 auto-generated out variants wrappers. This change shows that a simple tweak can increase the generated op coverage to 16% (241/1559) among all native ops described in native_functions.yaml no. matter if they are structured or not. Command to generate out variant wrappers. ``` buck run //caffe2/torch/fb/jit:gen_static_runtime_ops ``` - AFTER this change ``` total grouped native ops: 1559 structured grouped native ops: 545 generated grouped native ops: 241 ``` - BEFORE this change ``` total grouped native ops: 1503 structured grouped native ops: 540 generated grouped native ops: 136 ``` To enable CI tests and make it easier to review, the generated ops are added in a separate diff: D35945633 More details: We added a block list to remove the generation of around 10 operations that are deprecated or for which the unit test would fail. All generated ops are well *compiled* but the compiled unittest may not pass due to the lack of hand-picked test input values for certain ops. Among the 42 ops whose unittest does not pass, 1 (op "index_select") is repeated from the existing ops; 32 ops are fixed; and 9 ops are removed and blocked from generation because either it is not being commonly used in internal models such as "cholesky", "linalg_householder_product", sparse kernel "sspaddmm", or it causes some errors in static runtime such as "conj_physical" leads to an error in memory planner, and "binary_cross_entropy". Test Plan: OP generation: ```buck run //caffe2/torch/fb/jit:gen_static_runtime_ops``` Test generated ops: ```buck run mode/opt //caffe2/benchmarks/static_runtime:static_runtime_cpptest``` Reviewed By: tenpercent Differential Revision: D34913736 fbshipit-source-id: a6f408321653c3589ae1c76826177fc403d59c44 (cherry picked from commit 6f4501730478dbaeeea7f3ad4f9d29bf6787e7c1)
Author
Committer
Parents
Loading