Skip to content

Conversation

@BujSet
Copy link
Contributor

@BujSet BujSet commented Jun 9, 2025

Summary

Previously, exporting kernel dtypes was accomplished via gen_oplist.py but was only supported in internal-only scripts. This functionality of scraping models for dtypes to make them available for the dtype selective build is now implemented for OSS and internal, removing dependance on internal only scripts.

Fixes #11434 : 11434

Test plan

Manually tested on the add_mul.pte and mv3.pte example models. After building executorch, ran python3 -m codegen.tools.gen_oplist --model_file_path add_mul.pte --output_path add_mul_model.txt. The results add_mul_model.txt file is a YAML file that now includes dtype info in the kernel metadata section, as shown below:

build_features: []
custom_classes: []
et_kernel_metadata:
  aten::add:
  - v1/6;0,1|6;0,1|6;0,1|6;0,1
  aten::mm:
  - v1/6;0,1|6;0,1|6;0,1|6;0,1
include_all_non_op_selectives: false
include_all_operators: false
kernel_metadata: {}
operators:
  aten::add:
    debug_info:
    - add_mul.pte
    include_all_overloads: false
    is_root_operator: true
    is_used_for_training: true
  aten::mm:
    debug_info:
    - add_mul.pte
    include_all_overloads: false
    is_root_operator: true
    is_used_for_training: true

Comparable results were seen on the mve3.pte model (generated via python -m examples.portable.scripts.export --model_name="mv3").

CI flow is also updated to enable unittests for gen_oplist.py for the selective build process.

@pytorch-bot
Copy link

pytorch-bot bot commented Jun 9, 2025

🔗 Helpful Links

🧪 See artifacts and rendered test results at hud.pytorch.org/pr/pytorch/executorch/11504

Note: Links to docs will display an error until the docs builds have been completed.

❌ 187 New Failures

As of commit ed4c08d with merge base 0d244f9 (image):

NEW FAILURES - The following jobs have failed:

This comment was automatically generated by Dr. CI and updates every 15 minutes.

@facebook-github-bot facebook-github-bot added the CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. label Jun 9, 2025
@BujSet
Copy link
Contributor Author

BujSet commented Jun 9, 2025

@pytorchbot label "release notes: none"

@pytorch-bot pytorch-bot bot added the release notes: none Do not include this in the release notes label Jun 9, 2025
@BujSet BujSet self-assigned this Jun 9, 2025
@BujSet BujSet added ciflow/trunk ciflow/binaries and removed release notes: none Do not include this in the release notes labels Jun 9, 2025
@BujSet BujSet marked this pull request as ready for review June 9, 2025 21:55
@github-actions
Copy link

github-actions bot commented Jun 9, 2025

This PR needs a release notes: label

If your change should be included in the release notes (i.e. would users of this library care about this change?), please use a label starting with release notes:. This helps us keep track and include your important work in the next release notes.

To add a label, you can comment to pytorchbot, for example
@pytorchbot label "release notes: none"

For more information, see
https://github.com/pytorch/pytorch/wiki/PyTorch-AutoLabel-Bot#why-categorize-for-release-notes-and-how-does-it-work.

@lucylq
Copy link
Contributor

lucylq commented Jun 9, 2025

Thanks for adding this! Can we check against mv3.pte, which has some more operators than addmul?

python -m examples.portable.scripts.export --model_name="mv3"

Result from internal: P1836375803

@BujSet BujSet force-pushed the enable_selective_build_model_in_oss branch from 1abc18a to 087a853 Compare June 10, 2025 00:45
@BujSet BujSet force-pushed the enable_selective_build_model_in_oss branch from 087a853 to 366c47a Compare June 10, 2025 00:58
@facebook-github-bot
Copy link
Contributor

@BujSet has imported this pull request. If you are a Meta employee, you can view this diff on Phabricator.

@BujSet BujSet marked this pull request as draft June 10, 2025 01:49
@BujSet BujSet force-pushed the enable_selective_build_model_in_oss branch 6 times, most recently from 81af05e to 901a262 Compare June 10, 2025 21:58
@facebook-github-bot
Copy link
Contributor

@BujSet has imported this pull request. If you are a Meta employee, you can view this diff on Phabricator.

deps = [
":gen_oplist_lib",
],
] + [] if runtime.is_oss else ["//exir:lib"], # TODO This is a hack to run on fbcode. These targets depends on exir which is only available in fbcode.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it should be //executorch/exir:lib

@facebook-github-bot
Copy link
Contributor

@BujSet has imported this pull request. If you are a Meta employee, you can view this diff on Phabricator.

@BujSet BujSet force-pushed the enable_selective_build_model_in_oss branch 3 times, most recently from 9159927 to c47f1ba Compare June 11, 2025 21:51
@BujSet BujSet force-pushed the enable_selective_build_model_in_oss branch from c47f1ba to ed4c08d Compare June 12, 2025 00:55
@BujSet BujSet closed this Jun 19, 2025
@BujSet BujSet deleted the enable_selective_build_model_in_oss branch June 19, 2025 00:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ciflow/binaries ciflow/trunk CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants