Skip to content

Conversation

Conarnar
Copy link
Contributor

@Conarnar Conarnar commented Jun 26, 2025

Summary

Today our python apis in executorch.runtime are implemented off of extension/pybindings which only offers a module api. We would like to migrate to having the lower level ET api exposed to python directly and then writing the module api in python. The first step to this is adding pybindings for Program.

Bindings for the class Program and its methods num_methods and get_method_name were added.

Test plan

Tests were added to extension/pybindings/test/make_test.py

  1. test_program_methods_one -- verifies num_methods and get_method_name works with one method
  2. test_program_methods_multi -- verifies num_methods and get_method_name works with multiple methods
  3. test_program_method_index_out_of_bounds -- verifies get_method_name raises a runtime error if index is out of bounds

Copy link

pytorch-bot bot commented Jun 26, 2025

🔗 Helpful Links

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

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

✅ You can merge normally! (2 Unrelated Failures)

As of commit fa7e447 with merge base 3ba0466 (image):

BROKEN TRUNK - The following jobs failed but were present on the merge base:

👉 Rebase onto the `viable/strict` branch to avoid these failures

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 26, 2025
@facebook-github-bot
Copy link
Contributor

This pull request was exported from Phabricator. Differential Revision: D77388495

@facebook-github-bot
Copy link
Contributor

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

@Conarnar Conarnar changed the title Added PyProgram methods and tests Add Pybindings for Program.h/cpp Jun 26, 2025
@Conarnar
Copy link
Contributor Author

@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 26, 2025
@facebook-github-bot
Copy link
Contributor

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

@Conarnar Conarnar requested review from GregoryComer and lucylq July 1, 2025 17:41
@Conarnar Conarnar force-pushed the export-D77388495 branch from 7454544 to 9b95924 Compare July 1, 2025 21:10
Conarnar added a commit to Conarnar/executorch that referenced this pull request Jul 1, 2025
Summary:
Today our python apis in executorch.runtime are implemented off of extension/pybindings which only offers a module api. We would like to migrate to having the lower level ET api exposed to python directly and then writing the module api in python. The first step to this is adding pybindings for Program.

Bindings for the class Program and its methods num_methods and get_method_name were added.


Test Plan:
Tests were added to `extension/pybindings/test/make_test.py`
1. test_program_methods_one -- verifies num_methods and get_method_name works with one method
2. test_program_methods_multi -- verifies num_methods and get_method_name works with multiple methods
3. test_program_method_index_out_of_bounds -- verifies get_method_name raises a runtime error if index is out of bounds

Rollback Plan:

Reviewed By: JacobSzwejbka

Differential Revision: D77388495

Pulled By: Conarnar
@facebook-github-bot
Copy link
Contributor

This pull request was exported from Phabricator. Differential Revision: D77388495

Summary:
Today our python apis in executorch.runtime are implemented off of extension/pybindings which only offers a module api. We would like to migrate to having the lower level ET api exposed to python directly and then writing the module api in python. The first step to this is adding pybindings for Program.

Bindings for the class Program and its methods num_methods and get_method_name were added.


Test Plan:
Tests were added to `extension/pybindings/test/make_test.py`
1. test_program_methods_one -- verifies num_methods and get_method_name works with one method
2. test_program_methods_multi -- verifies num_methods and get_method_name works with multiple methods
3. test_program_method_index_out_of_bounds -- verifies get_method_name raises a runtime error if index is out of bounds

Rollback Plan:

Reviewed By: JacobSzwejbka

Differential Revision: D77388495

Pulled By: Conarnar
@Conarnar Conarnar force-pushed the export-D77388495 branch from 9b95924 to fa7e447 Compare July 1, 2025 21:19
@facebook-github-bot
Copy link
Contributor

This pull request was exported from Phabricator. Differential Revision: D77388495

@facebook-github-bot facebook-github-bot merged commit 5cc5421 into pytorch:main Jul 2, 2025
95 of 98 checks passed
@Conarnar Conarnar deleted the export-D77388495 branch July 2, 2025 19:14
BujSet pushed a commit to BujSet/executorch that referenced this pull request Jul 2, 2025
Differential Revision: D77388495

Pull Request resolved: pytorch#12016
Tanish2101 pushed a commit to Tanish2101/executorch that referenced this pull request Jul 9, 2025
Differential Revision: D77388495

Pull Request resolved: pytorch#12016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. fb-exported release notes: none Do not include this in the release notes

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants