Skip to content

[Lite Interpreter] [Lite Interpreter] Operator registration migrate from manual to selective build#35426

Closed
iseeyuan wants to merge 8 commits intogh/iseeyuan/61/basefrom
gh/iseeyuan/61/head
Closed

[Lite Interpreter] [Lite Interpreter] Operator registration migrate from manual to selective build#35426
iseeyuan wants to merge 8 commits intogh/iseeyuan/61/basefrom
gh/iseeyuan/61/head

Conversation

@iseeyuan
Copy link
Copy Markdown
Contributor

@iseeyuan iseeyuan commented Mar 25, 2020

Stack from ghstack:

Use selective build with the full set of operators (vs. manually register each used op with "_" prefix).

Currently "-c pt.disable_gen_tracing=1" must be used to strip the tracing part of code-gen ops, so that the mobile code can build without dependency on full jit.

Differential Revision: D20408831

NOTE FOR REVIEWERS: This PR has internal Facebook specific changes or comments, please review them on Phabricator!

…"_" prefix

Use selective build with the full set of operators (vs. manually register each used op with "_" prefix).

Currently "-c pt.disable_gen_tracing=1" must be used to strip the tracing part of code-gen ops, so that the mobile code can build without dependency on full jit.

Differential Revision: [D20408831](https://our.internmc.facebook.com/intern/diff/D20408831/)

**NOTE FOR REVIEWERS**: This PR has internal Facebook specific changes or comments, please review them on [Phabricator](https://our.internmc.facebook.com/intern/diff/D20408831/)!

[ghstack-poisoned]
@iseeyuan iseeyuan requested a review from apaszke as a code owner March 25, 2020 22:29
@facebook-github-bot facebook-github-bot added the oncall: jit Add this issue/PR to JIT oncall triage queue label Mar 25, 2020
@dr-ci
Copy link
Copy Markdown

dr-ci Bot commented Mar 25, 2020

💊 CircleCI build failures summary and remediations

As of commit 1545f22 (more details on the Dr. CI page):


None of the build failures appear to be your fault 💚


  • 1/1 broken upstream at merge base 14ce500 on Apr 09 from 2:45pm to 5:52pm PDT (10 commits; 477f1c0 - c5662dd)

    Please rebase on the viable/strict branch (expand for instructions)

    If your commit is newer than viable/strict, you can try basing on an older, stable commit:

    git fetch https://github.com/pytorch/pytorch viable/strict
    git rebase --onto FETCH_HEAD $(git merge-base origin/master HEAD)
    

    If your commit is older than viable/strict:

    git fetch https://github.com/pytorch/pytorch viable/strict
    git rebase FETCH_HEAD
    

    Check out the recency history of this "viable master" tracking branch.


🚧 1 upstream failure:

These were probably caused by upstream breakages:


This comment was automatically generated by Dr. CI (expand for details).Follow this link to opt-out of these comments for your Pull Requests.

Please report bugs/suggestions on the GitHub issue tracker.

See how this bot performed.

This comment has been revised 22 times.

…es without "_" prefix"

Use selective build with the full set of operators (vs. manually register each used op with "_" prefix).

Currently "-c pt.disable_gen_tracing=1" must be used to strip the tracing part of code-gen ops, so that the mobile code can build without dependency on full jit.

Differential Revision: [D20408831](https://our.internmc.facebook.com/intern/diff/D20408831/)

**NOTE FOR REVIEWERS**: This PR has internal Facebook specific changes or comments, please review them on [Phabricator](https://our.internmc.facebook.com/intern/diff/D20408831/)!

[ghstack-poisoned]
iseeyuan added a commit that referenced this pull request Mar 28, 2020
…tive build

Pull Request resolved: #35426

Use selective build with the full set of operators (vs. manually register each used op with "_" prefix).

Currently "-c pt.disable_gen_tracing=1" must be used to strip the tracing part of code-gen ops, so that the mobile code can build without dependency on full jit.

Lite interpreter relies on JIT operator dispatch. In future we still need JIT operator dispatch dispatch ops that are not registered in c10.
Currently the selective build is for c10/aten dispatch in BUCK. There is JIT selective code-gen in OSS but not ported to BUCK yet.
This diff is also porting the selective code-gen in BUCK.
* The selected op list is passed to gen_jit_dispatch.py.
* The list passed to gen_jit_dispatch is the top-level ops (USED_PT_OPS) only, because the selective c10/aten dispatch already registered other ops that are called from the top-level ops.

ghstack-source-id: 101084371

Differential Revision: [D20408831](https://our.internmc.facebook.com/intern/diff/D20408831/)

**NOTE FOR REVIEWERS**: This PR has internal Facebook specific changes or comments, please review them on [Phabricator](https://our.internmc.facebook.com/intern/diff/D20408831/)!
…es without "_" prefix"

Use selective build with the full set of operators (vs. manually register each used op with "_" prefix).

Currently "-c pt.disable_gen_tracing=1" must be used to strip the tracing part of code-gen ops, so that the mobile code can build without dependency on full jit.

Differential Revision: [D20408831](https://our.internmc.facebook.com/intern/diff/D20408831/)

**NOTE FOR REVIEWERS**: This PR has internal Facebook specific changes or comments, please review them on [Phabricator](https://our.internmc.facebook.com/intern/diff/D20408831/)!

[ghstack-poisoned]
iseeyuan added a commit that referenced this pull request Apr 6, 2020
…tive build

Pull Request resolved: #35426

Use selective build with the full set of operators (vs. manually register each used op with "_" prefix).

Currently "-c pt.disable_gen_tracing=1" must be used to strip the tracing part of code-gen ops, so that the mobile code can build without dependency on full jit.

Lite interpreter relies on JIT operator dispatch. In future we still need JIT operator dispatch dispatch ops that are not registered in c10.
Currently the selective build is for c10/aten dispatch in BUCK. There is JIT selective code-gen in OSS but not ported to BUCK yet.
This diff is also porting the selective code-gen in BUCK.
* The selected op list is passed to gen_jit_dispatch.py.
* The list passed to gen_jit_dispatch is the top-level ops (USED_PT_OPS) only, because the selective c10/aten dispatch already registered other ops that are called from the top-level ops.

ghstack-source-id: 101565513

Differential Revision: [D20408831](https://our.internmc.facebook.com/intern/diff/D20408831/)

**NOTE FOR REVIEWERS**: This PR has internal Facebook specific changes or comments, please review them on [Phabricator](https://our.internmc.facebook.com/intern/diff/D20408831/)!
iseeyuan added 5 commits April 6, 2020 20:52
…es without "_" prefix"

Use selective build with the full set of operators (vs. manually register each used op with "_" prefix).

Currently "-c pt.disable_gen_tracing=1" must be used to strip the tracing part of code-gen ops, so that the mobile code can build without dependency on full jit.

Differential Revision: [D20408831](https://our.internmc.facebook.com/intern/diff/D20408831/)

**NOTE FOR REVIEWERS**: This PR has internal Facebook specific changes or comments, please review them on [Phabricator](https://our.internmc.facebook.com/intern/diff/D20408831/)!

[ghstack-poisoned]
…es without "_" prefix"

Use selective build with the full set of operators (vs. manually register each used op with "_" prefix).

Currently "-c pt.disable_gen_tracing=1" must be used to strip the tracing part of code-gen ops, so that the mobile code can build without dependency on full jit.

Differential Revision: [D20408831](https://our.internmc.facebook.com/intern/diff/D20408831/)

**NOTE FOR REVIEWERS**: This PR has internal Facebook specific changes or comments, please review them on [Phabricator](https://our.internmc.facebook.com/intern/diff/D20408831/)!

[ghstack-poisoned]
…es without "_" prefix"

Use selective build with the full set of operators (vs. manually register each used op with "_" prefix).

Currently "-c pt.disable_gen_tracing=1" must be used to strip the tracing part of code-gen ops, so that the mobile code can build without dependency on full jit.

Differential Revision: [D20408831](https://our.internmc.facebook.com/intern/diff/D20408831/)

**NOTE FOR REVIEWERS**: This PR has internal Facebook specific changes or comments, please review them on [Phabricator](https://our.internmc.facebook.com/intern/diff/D20408831/)!

[ghstack-poisoned]
…es without "_" prefix"

Use selective build with the full set of operators (vs. manually register each used op with "_" prefix).

Currently "-c pt.disable_gen_tracing=1" must be used to strip the tracing part of code-gen ops, so that the mobile code can build without dependency on full jit.

Differential Revision: [D20408831](https://our.internmc.facebook.com/intern/diff/D20408831/)

**NOTE FOR REVIEWERS**: This PR has internal Facebook specific changes or comments, please review them on [Phabricator](https://our.internmc.facebook.com/intern/diff/D20408831/)!

[ghstack-poisoned]
…es without "_" prefix"

Use selective build with the full set of operators (vs. manually register each used op with "_" prefix).

Currently "-c pt.disable_gen_tracing=1" must be used to strip the tracing part of code-gen ops, so that the mobile code can build without dependency on full jit.

Differential Revision: [D20408831](https://our.internmc.facebook.com/intern/diff/D20408831/)

**NOTE FOR REVIEWERS**: This PR has internal Facebook specific changes or comments, please review them on [Phabricator](https://our.internmc.facebook.com/intern/diff/D20408831/)!

[ghstack-poisoned]
iseeyuan added a commit that referenced this pull request Apr 9, 2020
…tive build

Pull Request resolved: #35426

Use selective build with the full set of operators (vs. manually register each used op with "_" prefix).

Lite interpreter relies on JIT operator dispatch. In future we still need JIT operator dispatch dispatch ops that are not registered in c10.
Currently the selective build is for c10/aten dispatch in BUCK. There is JIT selective code-gen in OSS but not ported to BUCK yet.
This diff is also porting the selective code-gen in BUCK.
* The selected op list is passed to gen_jit_dispatch.py.
* The list passed to gen_jit_dispatch is the top-level ops (USED_PT_OPS) only, because the selective c10/aten dispatch already registered other ops that are called from the top-level ops.

ghstack-source-id: 101885215

Differential Revision: [D20408831](https://our.internmc.facebook.com/intern/diff/D20408831/)

**NOTE FOR REVIEWERS**: This PR has internal Facebook specific changes or comments, please review them on [Phabricator](https://our.internmc.facebook.com/intern/diff/D20408831/)!
@iseeyuan iseeyuan changed the title [Lite Interpreter] Add aten op registration and use op names without "_" prefix [Lite Interpreter] [Lite Interpreter] Operator registration migrate from manual to selective build Apr 9, 2020
@facebook-github-bot
Copy link
Copy Markdown
Contributor

This pull request has been merged in 7fcf8b0.

@ezyang
Copy link
Copy Markdown
Contributor

ezyang commented Apr 10, 2020

This broke clang-format

facebook-github-bot pushed a commit that referenced this pull request Apr 10, 2020
Summary:
Pull Request resolved: #36393

Fix the clang-format CI error caused in #35426

Test Plan: Imported from OSS

Differential Revision: D20964854

Pulled By: iseeyuan

fbshipit-source-id: 97f2ba1e006cac0f33b223315263b0b84c24cb15
@facebook-github-bot facebook-github-bot deleted the gh/iseeyuan/61/head branch April 13, 2020 14:16
ashishfarmer pushed a commit to ashishfarmer/pytorch that referenced this pull request Apr 13, 2020
…tive build (pytorch#35426)

Summary:
Pull Request resolved: pytorch#35426

Use selective build with the full set of operators (vs. manually register each used op with "_" prefix).

Lite interpreter relies on JIT operator dispatch. In future we still need JIT operator dispatch dispatch ops that are not registered in c10.
Currently the selective build is for c10/aten dispatch in BUCK. There is JIT selective code-gen in OSS but not ported to BUCK yet.
This diff is also porting the selective code-gen in BUCK.
* The selected op list is passed to gen_jit_dispatch.py.
* The list passed to gen_jit_dispatch is the top-level ops (USED_PT_OPS) only, because the selective c10/aten dispatch already registered other ops that are called from the top-level ops.

ghstack-source-id: 101885215

(Note: this ignores all push blocking failures!)

Test Plan:
1. In Python, run torch.jit.export_opnames(scripted_M_mod)
2. Append the operator names into fbcode/caffe2/pt_ops.bzl and the BUCK target.
3. Run
```
buck run xplat/caffe2/fb/lite_predictor:lite_predictor_bi -- --model=/home/myuan/temp/bi_pytext_0315.bc --input_dims "1,4" --input_type int64 --pytext_len=4
```
Should provide expected results.
In addition, the size of the generated code for JIT registration, for example, ```register_aten_ops_0.cpp```, should be significantly reduced (from ~250 KB to ~80KB). The non-selected op registration schema are still kept, but the registration functor is replaced by ```DUMMY_OPERATION```

Reviewed By: ljk53

Differential Revision: D20408831

fbshipit-source-id: ec75dd762c4613aeda3b2094f5dad11804dc9492
ashishfarmer pushed a commit to ashishfarmer/pytorch that referenced this pull request Apr 13, 2020
…ch#36393)

Summary:
Pull Request resolved: pytorch#36393

Fix the clang-format CI error caused in pytorch#35426

Test Plan: Imported from OSS

Differential Revision: D20964854

Pulled By: iseeyuan

fbshipit-source-id: 97f2ba1e006cac0f33b223315263b0b84c24cb15
okly366 pushed a commit to okly366/pytorch that referenced this pull request Apr 26, 2020
…"_" prefix

Use selective build with the full set of operators (vs. manually register each used op with "_" prefix).

Currently "-c pt.disable_gen_tracing=1" must be used to strip the tracing part of code-gen ops, so that the mobile code can build without dependency on full jit.

Differential Revision: [D20408831](https://our.internmc.facebook.com/intern/diff/D20408831/)

**NOTE FOR REVIEWERS**: This PR has internal Facebook specific changes or comments, please review them on [Phabricator](https://our.internmc.facebook.com/intern/diff/D20408831/)!

ghstack-source-id: 100876252
Pull Request resolved: pytorch/pytorch#35426
karansachdev-1012 pushed a commit to karansachdev-1012/pytorch that referenced this pull request Feb 17, 2026
…tive build

Pull Request resolved: pytorch/pytorch#35426

Use selective build with the full set of operators (vs. manually register each used op with "_" prefix).

Lite interpreter relies on JIT operator dispatch. In future we still need JIT operator dispatch dispatch ops that are not registered in c10.
Currently the selective build is for c10/aten dispatch in BUCK. There is JIT selective code-gen in OSS but not ported to BUCK yet.
This diff is also porting the selective code-gen in BUCK.
* The selected op list is passed to gen_jit_dispatch.py.
* The list passed to gen_jit_dispatch is the top-level ops (USED_PT_OPS) only, because the selective c10/aten dispatch already registered other ops that are called from the top-level ops.

ghstack-source-id: 101851352

Differential Revision: [D20408831](https://our.internmc.facebook.com/intern/diff/D20408831/)

**NOTE FOR REVIEWERS**: This PR has internal Facebook specific changes or comments, please review them on [Phabricator](https://our.internmc.facebook.com/intern/diff/D20408831/)!
laurentdupin pushed a commit to laurentdupin/pytorch that referenced this pull request Apr 24, 2026
…tive build (pytorch#35426)

Summary:
Pull Request resolved: pytorch#35426

Use selective build with the full set of operators (vs. manually register each used op with "_" prefix).

Lite interpreter relies on JIT operator dispatch. In future we still need JIT operator dispatch dispatch ops that are not registered in c10.
Currently the selective build is for c10/aten dispatch in BUCK. There is JIT selective code-gen in OSS but not ported to BUCK yet.
This diff is also porting the selective code-gen in BUCK.
* The selected op list is passed to gen_jit_dispatch.py.
* The list passed to gen_jit_dispatch is the top-level ops (USED_PT_OPS) only, because the selective c10/aten dispatch already registered other ops that are called from the top-level ops.

ghstack-source-id: 101885215

(Note: this ignores all push blocking failures!)

Test Plan:
1. In Python, run torch.jit.export_opnames(scripted_M_mod)
2. Append the operator names into fbcode/caffe2/pt_ops.bzl and the BUCK target.
3. Run
```
buck run xplat/caffe2/fb/lite_predictor:lite_predictor_bi -- --model=/home/myuan/temp/bi_pytext_0315.bc --input_dims "1,4" --input_type int64 --pytext_len=4
```
Should provide expected results.
In addition, the size of the generated code for JIT registration, for example, ```register_aten_ops_0.cpp```, should be significantly reduced (from ~250 KB to ~80KB). The non-selected op registration schema are still kept, but the registration functor is replaced by ```DUMMY_OPERATION```

Reviewed By: ljk53

Differential Revision: D20408831

fbshipit-source-id: ec75dd762c4613aeda3b2094f5dad11804dc9492
laurentdupin pushed a commit to laurentdupin/pytorch that referenced this pull request Apr 24, 2026
…ch#36393)

Summary:
Pull Request resolved: pytorch#36393

Fix the clang-format CI error caused in pytorch#35426

Test Plan: Imported from OSS

Differential Revision: D20964854

Pulled By: iseeyuan

fbshipit-source-id: 97f2ba1e006cac0f33b223315263b0b84c24cb15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Merged oncall: jit Add this issue/PR to JIT oncall triage queue

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants