-
Notifications
You must be signed in to change notification settings - Fork 598
Update PAL override docs for new APIs #11747
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
base: main
Are you sure you want to change the base?
Conversation
🔗 Helpful Links🧪 See artifacts and rendered test results at hud.pytorch.org/pr/pytorch/executorch/11747
Note: Links to docs will display an error until the docs builds have been completed. ✅ No FailuresAs of commit 51b2155 with merge base 7b39a0c ( This comment was automatically generated by Dr. CI and updates every 15 minutes. |
ET_UNUSED bool registration_result = runtime::register_pal(build_pal()); | ||
``` |
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.
Is this how you do static initialization? It should be a static variable right?
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.
@larryliu0820 I updated the example code to be slightly more clear. The original snippet is inside an anonymous namespace, which serves the same purpose of translation-unit scoping for the variable. But it is a global constructor in the same way. I've included the anonymous namespace in the snippet so that this is more clear.
- Call `executorch::platform::register_pal(pal_impl)` to register the implementation. | ||
- This can be done from as as a global constructor, as in the example below. | ||
|
||
Here is a complete example from [pybindings.cpp](https://github.com/pytorch/executorch/blob/7b39a0ce63bfb5124d4d29cfb6c8af85a3c580ba/extension/pybindings/pybindings.cpp#L4), where logs are redirected to show up properly in a Python notebook environment. |
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 link is pointing to a comment though
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.