pytorch/tools/code_analyzer
Jiakai Liu 8258d42bd0 [pytorch] add '__BASE__' section to op deps to factor out frequently used util ops (#37404)
Summary:
Pull Request resolved: https://github.com/pytorch/pytorch/pull/37404

Many aten operators are really like util functions, e.g.:
aten::is_nonzero, aten::is_floating_point, etc. These ops can be called
via overloaded c++ operator, so seemingly trivial and innocent code changes can
affect how these ops are used by other ops (thus changes the output of
static analyzer).

Most of these util ops are rather small in terms of build size cost, so
for the purpose of optimizing binary size with custom build, whether to
include these ops or not does not make significant difference. In fact
for non-trivial models a set of these ops are almost always used.

This PR introduced the (optional) '__BASE__' ops section to the dependency graph.

We can maintain the list of frequently used small util ops for internal BUCK
build. This way, the output dependency graph will only contain meaningful
edges with significant binary size impact, and it will be more stable from
trivial code changes (which is checked in FB codebase).

Having a stable and sparse deps graph by factoring out frequently used based ops
is also a nice property to allow us to explore alternative custom build
solutions in case we find it hard to maintain the static code analyzer.

Test Plan: Imported from OSS

Differential Revision: D21280835

Pulled By: ljk53

fbshipit-source-id: c4d0d1f07ca868c60f23118d877fc1eeead4c875
2020-04-28 17:18:09 -07:00
..
analyzer.cpp [pytorch] convert code analyzer to a binary (#33102) 2020-02-10 14:46:29 -08:00
build.sh [pytorch] add '__BASE__' section to op deps to factor out frequently used util ops (#37404) 2020-04-28 17:18:09 -07:00
CMakeLists.txt [pytorch] remove unused flags from code analyzer & move format support to python (#37393) 2020-04-28 17:16:55 -07:00
gen_op_registration_whitelist.py [pytorch] add '__BASE__' section to op deps to factor out frequently used util ops (#37404) 2020-04-28 17:18:09 -07:00
op_deps_pass.cpp [pytorch] remove unused flags from code analyzer & move format support to python (#37393) 2020-04-28 17:16:55 -07:00
op_deps_processor.py [pytorch] add '__BASE__' section to op deps to factor out frequently used util ops (#37404) 2020-04-28 17:18:09 -07:00
run_analyzer.sh [pytorch] remove unused flags from code analyzer & move format support to python (#37393) 2020-04-28 17:16:55 -07:00