-
Notifications
You must be signed in to change notification settings - Fork 607
Introduce PAL function table #10675
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Introduce PAL function table #10675
Conversation
🔗 Helpful Links🧪 See artifacts and rendered test results at hud.pytorch.org/pr/pytorch/executorch/10675
Note: Links to docs will display an error until the docs builds have been completed. ⏳ No Failures, 1 PendingAs of commit c504b9b with merge base bfea626 ( This comment was automatically generated by Dr. CI and updates every 15 minutes. |
This pull request was exported from Phabricator. Differential Revision: D74121895 |
84a8e89
to
24a7b2e
Compare
Summary: This is the implementation of the PAL changes described in pytorch#10432. This PR introduces a struct (`pal_table`) to hold function pointers to the PAL function implementations. There is a singleton instance of this struct, which is initialized with the weak/strong et_pal_ functions - maintaining backwards compatibility with the existing override mechanism. I've then added wrapper functions for the PAL into the executorch::runtime namespace which dispatch through the function table. It is intended that callers use these functions instead of the "raw" et_pal_ methods in order to correctly dispatch through the function table. I also update ET callers to do this. Differential Revision: D74121895
This pull request was exported from Phabricator. Differential Revision: D74121895 |
Summary: This is the implementation of the PAL changes described in pytorch#10432. This PR introduces a struct (`pal_table`) to hold function pointers to the PAL function implementations. There is a singleton instance of this struct, which is initialized with the weak/strong et_pal_ functions - maintaining backwards compatibility with the existing override mechanism. I've then added wrapper functions for the PAL into the executorch::runtime namespace which dispatch through the function table. It is intended that callers use these functions instead of the "raw" et_pal_ methods in order to correctly dispatch through the function table. I also update ET callers to do this. Differential Revision: D74121895
24a7b2e
to
68fa8f6
Compare
This pull request was exported from Phabricator. Differential Revision: D74121895 |
Summary: This is the implementation of the PAL changes described in pytorch#10432. This PR introduces a struct (`pal_table`) to hold function pointers to the PAL function implementations. There is a singleton instance of this struct, which is initialized with the weak/strong et_pal_ functions - maintaining backwards compatibility with the existing override mechanism. I've then added wrapper functions for the PAL into the executorch::runtime namespace which dispatch through the function table. It is intended that callers use these functions instead of the "raw" et_pal_ methods in order to correctly dispatch through the function table. I also update ET callers to do this. Differential Revision: D74121895
68fa8f6
to
68cb729
Compare
Summary: This is the implementation of the PAL changes described in pytorch#10432. This PR introduces a struct (`pal_table`) to hold function pointers to the PAL function implementations. There is a singleton instance of this struct, which is initialized with the weak/strong et_pal_ functions - maintaining backwards compatibility with the existing override mechanism. I've then added wrapper functions for the PAL into the executorch::runtime namespace which dispatch through the function table. It is intended that callers use these functions instead of the "raw" et_pal_ methods in order to correctly dispatch through the function table. I also update ET callers to do this. Differential Revision: D74121895
68cb729
to
ec7ab47
Compare
runtime/platform/platform.h
Outdated
* | ||
* Returns true if the registration was successful, false otherwise. | ||
*/ | ||
bool register_pal(pal_table impl); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This API is returning bool primarily because using Error would introduce a circular header dependency and there's no current way for this call to fail. I'm open to switching to error, but would require a little bit of a header refactor.
Summary: This is the implementation of the PAL changes described in pytorch#10432. This PR introduces a struct (`pal_table`) to hold function pointers to the PAL function implementations. There is a singleton instance of this struct, which is initialized with the weak/strong et_pal_ functions - maintaining backwards compatibility with the existing override mechanism. I've then added wrapper functions for the PAL into the executorch::runtime namespace which dispatch through the function table. It is intended that callers use these functions instead of the "raw" et_pal_ methods in order to correctly dispatch through the function table. I also update ET callers to do this. Differential Revision: D74121895
ec7ab47
to
ea38267
Compare
Summary: This is the implementation of the PAL changes described in pytorch#10432. This PR introduces a struct (`pal_table`) to hold function pointers to the PAL function implementations. There is a singleton instance of this struct, which is initialized with the weak/strong et_pal_ functions - maintaining backwards compatibility with the existing override mechanism. I've then added wrapper functions for the PAL into the executorch::runtime namespace which dispatch through the function table. It is intended that callers use these functions instead of the "raw" et_pal_ methods in order to correctly dispatch through the function table. I also update ET callers to do this. Differential Revision: D74121895
Trying to repro the size test failure locally to investigate. For some reason, I'm only seeing a 64-byte increase in size between this PR and the base revision, which is more in line with what I'd expect. I am on Clang 14 locally vs 12 in CI. Maybe that's related?
Edit: Interestingly, it does seem to be reproducible on Clang 12:
|
Summary: This is the implementation of the PAL changes described in pytorch#10432. This PR introduces a struct (`pal_table`) to hold function pointers to the PAL function implementations. There is a singleton instance of this struct, which is initialized with the weak/strong et_pal_ functions - maintaining backwards compatibility with the existing override mechanism. I've then added wrapper functions for the PAL into the executorch::runtime namespace which dispatch through the function table. It is intended that callers use these functions instead of the "raw" et_pal_ methods in order to correctly dispatch through the function table. I also update ET callers to do this. Differential Revision: D74121895
20fd1b2
to
dc1d179
Compare
Summary: This is the implementation of the PAL changes described in pytorch#10432. This PR introduces a struct (`pal_table`) to hold function pointers to the PAL function implementations. There is a singleton instance of this struct, which is initialized with the weak/strong et_pal_ functions - maintaining backwards compatibility with the existing override mechanism. I've then added wrapper functions for the PAL into the executorch::runtime namespace which dispatch through the function table. It is intended that callers use these functions instead of the "raw" et_pal_ methods in order to correctly dispatch through the function table. I also update ET callers to do this. Differential Revision: D74121895
dc1d179
to
a4b85da
Compare
Summary: This is the implementation of the PAL changes described in pytorch#10432. This PR introduces a struct (`pal_table`) to hold function pointers to the PAL function implementations. There is a singleton instance of this struct, which is initialized with the weak/strong et_pal_ functions - maintaining backwards compatibility with the existing override mechanism. I've then added wrapper functions for the PAL into the executorch::runtime namespace which dispatch through the function table. It is intended that callers use these functions instead of the "raw" et_pal_ methods in order to correctly dispatch through the function table. I also update ET callers to do this. Differential Revision: D74121895
a4b85da
to
5f4ef12
Compare
Summary: This is the implementation of the PAL changes described in pytorch#10432. This PR introduces a struct (`pal_table`) to hold function pointers to the PAL function implementations. There is a singleton instance of this struct, which is initialized with the weak/strong et_pal_ functions - maintaining backwards compatibility with the existing override mechanism. I've then added wrapper functions for the PAL into the executorch::runtime namespace which dispatch through the function table. It is intended that callers use these functions instead of the "raw" et_pal_ methods in order to correctly dispatch through the function table. I also update ET callers to do this. Differential Revision: D74121895
5f4ef12
to
e2961e8
Compare
Summary: This is the implementation of the PAL changes described in pytorch#10432. This PR introduces a struct (`pal_table`) to hold function pointers to the PAL function implementations. There is a singleton instance of this struct, which is initialized with the weak/strong et_pal_ functions - maintaining backwards compatibility with the existing override mechanism. I've then added wrapper functions for the PAL into the executorch::runtime namespace which dispatch through the function table. It is intended that callers use these functions instead of the "raw" et_pal_ methods in order to correctly dispatch through the function table. I also update ET callers to do this. Differential Revision: D74121895
e2961e8
to
8231dcb
Compare
@@ -371,7 +371,7 @@ jobs: | |||
size=${arr[4]} | |||
# threshold=48120 on devserver with gcc11.4 | |||
# todo(lfq): update once binary size is below 50kb. | |||
threshold="51408" | |||
threshold="55584" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Note that the "true" size increase is around ~80 bytes, due to some instability in the size test on older toolchains. See https://github.com/pytorch/executorch/pull/11217/files. This is confirmed with manual builds on newer toolchains and Meta app build size checks.
.github/workflows/pull.yml
Outdated
@@ -406,7 +406,7 @@ jobs: | |||
output=$(ls -la cmake-out/test/size_test) | |||
arr=($output) | |||
size=${arr[4]} | |||
threshold="47560" | |||
threshold="51720" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Similar to above, note that the "true" size increase is around ~64 bytes. See https://github.com/pytorch/executorch/pull/11217/files.
@GregoryComer has imported this pull request. If you are a Meta employee, you can view this diff on Phabricator. |
Summary: This is the implementation of the PAL changes described in pytorch#10432. This PR introduces a struct (`pal_table`) to hold function pointers to the PAL function implementations. There is a singleton instance of this struct, which is initialized with the weak/strong et_pal_ functions - maintaining backwards compatibility with the existing override mechanism. I've then added wrapper functions for the PAL into the executorch::runtime namespace which dispatch through the function table. It is intended that callers use these functions instead of the "raw" et_pal_ methods in order to correctly dispatch through the function table. I also update ET callers to do this. Differential Revision: D74121895
8231dcb
to
d8535b2
Compare
Summary: This is the implementation of the PAL changes described in pytorch#10432. This PR introduces a struct (`pal_table`) to hold function pointers to the PAL function implementations. There is a singleton instance of this struct, which is initialized with the weak/strong et_pal_ functions - maintaining backwards compatibility with the existing override mechanism. I've then added wrapper functions for the PAL into the executorch::runtime namespace which dispatch through the function table. It is intended that callers use these functions instead of the "raw" et_pal_ methods in order to correctly dispatch through the function table. I also update ET callers to do this. Differential Revision: D74121895
d8535b2
to
c504b9b
Compare
@GregoryComer has imported this pull request. If you are a Meta employee, you can view this diff on Phabricator. |
### Summary The recent PAL changes (#10675) increased runtime size slightly. This was approved and size targets were updated for the main size jobs. However, I missed the Cortex-M job and am updating here. ### Test plan CI
### Summary Update PAL docs in using-executorch-runtime-integration.md to describe the new PAL override mechanism introduced in #10675. I've left the docs in for the weak symbol override mechanism, as well, though I've recommended use of the runtime APIs. ### Test plan I built the docs locally to validate form and content.
### Summary Update PAL docs in using-executorch-runtime-integration.md to describe the new PAL override mechanism introduced in pytorch#10675. I've left the docs in for the weak symbol override mechanism, as well, though I've recommended use of the runtime APIs. ### Test plan I built the docs locally to validate form and content.
Summary:
This is part 1 of the implementation of the PAL changes described in #10432. This PR introduces a struct (
pal_table
) to hold function pointers to the PAL function implementations. There is a singleton instance of this struct, which is initialized with the weak/strong et_pal_ functions - maintaining backwards compatibility with the existing override mechanism.I've then added wrapper functions for the PAL into the executorch::runtime namespace which dispatch through the function table. It is intended that callers use these functions instead of the "raw" et_pal_ methods in order to correctly dispatch through the function table. In the following PR, I update ET callers to do this.
Differential Revision: D74121895