Commit Graph

3 Commits

Author SHA1 Message Date
Jiakai Liu
9d0891f886 [pytorch][buck] tweak code analyzer e2e script
Summary:
- Add debug mode to include debug information.
- Move codegen comment to FB shell script (as it's only checked-in FB repo).
- Analyze lite-predictor instead of full-JIT as full-JIT BUCK target contains variable kernels thus pull in a lot more dependencies.
- Use pre-opt bitcode instead of pre-codegen bitcode - there is one special `callOp()` case in RNN.cpp where optimized bitcode has opname string and API body inlined together: https://fburl.com/diffusion/8rz6u4rg; pre-optimization bitcode should give more stable result.

Test Plan: - Tested the bash script with stacked diff.

Reviewed By: iseeyuan

Differential Revision: D21298837

fbshipit-source-id: be33e2db5d8cb0f804460c503e52beb0dcb4857f
2020-04-29 22:38:09 -07:00
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
Jiakai Liu
e0a5b443d6 [pytorch] remove unused flags from code analyzer & move format support to python (#37393)
Summary:
Pull Request resolved: https://github.com/pytorch/pytorch/pull/37393

Simplify the code analyzer by removing some unused flags and moving the
different format printer logic to python script. It's easier to add other
post processing logic to adapt to different BUCK build configs.

Test Plan: Imported from OSS

Differential Revision: D21280836

Pulled By: ljk53

fbshipit-source-id: 0d66d5891d850f012c4ab4f39eabbd9aecc1caa9
2020-04-28 17:16:55 -07:00