Commit Graph

12 Commits

Author SHA1 Message Date
25d8a0480b [lint] Remove unnecessary BUCKRESTRICTEDSYNTAX suppressions
Differential Revision: D59935630

Pull Request resolved: https://github.com/pytorch/pytorch/pull/131187
2024-07-19 07:19:11 -07:00
1e0e55c504 [xplat][buck2][typing] Fix typechecker issue (#108525)
Test Plan: CI

Reviewed By: JakobDegen

Differential Revision: D48817210

Pull Request resolved: https://github.com/pytorch/pytorch/pull/108525
Approved by: https://github.com/osalpekar
2023-09-05 18:18:45 +00:00
01b662bafe [gen_operators_yaml] add arguments to control include_all_overloads (#108396)
Summary:
In SelectiveBuildOperator, we can specify argument `include_all_overloads`. If True, all overloaded operators (for example, `aten::to.dtype_layout`, `aten::to.prim_Device"` are considered as overloaded operators of `aten::to`), will be built and linked to the final binary. This can significantly increases the final binary size, which could be a deal breaker for on-device deployment.

In this diff, we make back-compatible changes to add new arguments `--not-include-all-overloads-static-root-ops` and `--not-include-all-overloads-closure-ops`. When they are set, we set `include_all_overloads` flag to False for static root ops and closure ops, and rely on code analyzer to decide the actual used overloaded operator.

Test Plan:
- unit test
```
buck test //xplat/caffe2/tools:gen_operators_yaml_test
```
- See test plan in D48771544 where we reduce the shared lib file `libmrengine.lib` from 16653072 bytes to 13686032 bytes.
- See detailed document: https://fburl.com/gdoc/mc93h6kb

Reviewed By: larryliu0820

Differential Revision: D48772302

Pull Request resolved: https://github.com/pytorch/pytorch/pull/108396
Approved by: https://github.com/larryliu0820
2023-09-02 17:37:36 +00:00
12ca224662 Add hacked_twin overloads for _unsafe indexing functions (#104127)
Fixes #104037

This hacky workaround already exists for the normal overloads.
Pull Request resolved: https://github.com/pytorch/pytorch/pull/104127
Approved by: https://github.com/ezyang
2023-07-05 01:05:27 +00:00
37bcdb98f6 Fix buck parsing in OSS build (#99648)
By removing `@fbsource` cell prefix from `pt_ops.bzl`

Fixes https://github.com/pytorch/pytorch/issues/99642

Pull Request resolved: https://github.com/pytorch/pytorch/pull/99648
Approved by: https://github.com/kit1980, https://github.com/huydhn
2023-04-20 20:17:38 +00:00
24f882369a [EdgeML] Remove dependency on all_mobile_model_configs.yaml from pt_operator_library BUCK rule (#99122)
Summary: Removes the dependency on the unified YAML file

Test Plan:
Smoke test via some caffe2 tests.

```
buck2 run xplat/caffe2:supported_mobile_models_test
```

Build a major FoA app that uses model tracing  and confirm it still works.

```
buck2 build fb4a
```

CI/CD for the rest.  If operator tracing / bundling was broken, I'd hope in the 1000+ tests spawned by this change should catch it.

Differential Revision: D44946368

Pull Request resolved: https://github.com/pytorch/pytorch/pull/99122
Approved by: https://github.com/dhruvbird
2023-04-18 17:19:55 +00:00
3c2bc0760b [EdgeML] Switch from BZL to BUCK for model resource testing (#98450)
Summary:
See [this post](https://fb.workplace.com/groups/devinfra.capacity.eng/permalink/1200060064273920/) for context and specifically [this solution](https://fb.workplace.com/groups/devinfra.capacity.eng/posts/1200060064273920/?comment_id=1200166060929987&reply_comment_id=1200177124262214) which this diff implements.

The gist is that updating `bzl` file is *very* expensive for diff time testing and triggers many flaky tests when attempting to land a model update from EdgeML.  The purpose of these bzl files (from what I can tell) is to unit test models via a CXX resources map.  Since it's only used for CXX resource generation, this can be accomplished via generating `fb_xplat_cxx_library` BUCK target instead.  This required shuffling around some existing BUCK files due to buck rules around file ownership.

Since the EdgeML process already generates code to begin with, this is straightforward to do by just changing the code from generating bzl files to now generate a BUCK file and change the existing targets to use it thus we can now delete the old bzl files.

Test Plan:
Run the model gen script.

```
buck2 run mode/opt caffe2/torch/fb/mobile/cli:cli -- --concat_all_model_configs
```

Sanity test the new BUCK target.

```
buck2 build xplat/pytorch_models/build:test_resources
```

Run the model unit tests and confirm they still work.

```
buck2 run xplat/caffe2:for_each_prod_ptl_model_test
```

CI/CD for the rest.

I expect some flaky test given the `bzl` file deletion which triggers off a ton of unrelated tests.

Differential Revision: D44699671

Pull Request resolved: https://github.com/pytorch/pytorch/pull/98450
Approved by: https://github.com/JacobSzwejbka
2023-04-10 23:24:05 +00:00
a563a4880f [Edge] Add an option to avoid adding base ops to static op library (#84360)
Summary: We use a static op library in a test for PyTorch C++ usages, but don't want to introduce all base ops. Because the goal is to check if a given model can run on the exact op collection (i.e., fbios ops, fb4a ops), and these base ops are not present in real apps. So add an option to disable this feature.

Test Plan: Build. Expect no change to existing targets.

Differential Revision: D39164021

Pull Request resolved: https://github.com/pytorch/pytorch/pull/84360
Approved by: https://github.com/kit1980
2022-09-01 22:32:55 +00:00
71e16f9eef [build] Add fbsource keyword to pt_operator_libarary (#81298)
Summary:
Adding `fbsource` keyword to `pt_operator_library`

Test Plan: Rely on CI

Differential Revision: D37256879

Pull Request resolved: https://github.com/pytorch/pytorch/pull/81298
Approved by: https://github.com/linbinyu
2022-07-18 19:13:04 +00:00
b62d39eda0 Consolidate all python targets in the tools folder (#80408)
Summary:
All buck targets that points to caffe2/tools folder are now moved to tools/BUCK.
This also eliminates all python library/binary import in pt_defs.bzl, which caused T124308913.

Test Plan: CI

Differential Revision: D37468313

Pull Request resolved: https://github.com/pytorch/pytorch/pull/80408
Approved by: https://github.com/seemethere, https://github.com/malfet
2022-06-29 23:27:47 +00:00
e98e7fe428 [4] move pt_operator_library to shared BUCK file (#80170)
Summary:
Move pt_operator_library to pt_ops.bzl and make it shared with OSS BUCK build

This will replace D36912042. I will update all load statements in future diffs.

Test Plan: sandcaslte, OSS CI

Differential Revision: D37390060

Pull Request resolved: https://github.com/pytorch/pytorch/pull/80170
Approved by: https://github.com/JacobSzwejbka
2022-06-24 21:51:20 +00:00
55aa0b1a84 sync pt_ops.bzl (#80194)
sync from fbsource

Fixes #ISSUE_NUMBER

Pull Request resolved: https://github.com/pytorch/pytorch/pull/80194
Approved by: https://github.com/mehtanirav, https://github.com/bigfootjon, https://github.com/malfet
2022-06-24 02:57:30 +00:00