Skip to content

Allow operators to be called outside of the kernel registry #7329

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

Merged
merged 1 commit into from
Dec 16, 2024

Conversation

lucylq
Copy link
Contributor

@lucylq lucylq commented Dec 14, 2024

Summary:
Usecase from Whatsapp (D67169920) to:

  • use dtype selective build to create executorch_generated_lib
  • use portable lib operators directly in C++
  • ^cover these usecases in the same dependency

This requires removing the compiler flag '-fvisibility=hidden', so that the operator symbols are exposed in the archive file. Otherwise, we get missing operator symbols, like in P1697209425.

Duplicate symbols occur when we add the operator dependency explicitly, eg. adding //executorch/kernels/portable/cpu:op_cat, to the dep list. This is because dtype selective build re-builds the portable lib, and does not use the dependency //executorch/kernels/portable:operators, which uses the individual operator targets under the hood.

Another alternative is to expose the operator registry and add a helper utility to return the function ptr to the kernel, though this could be an intrusive change that opens operator registry to external clients outside the core runtime. cc tarun292.

Differential Revision: D67229096

Copy link

pytorch-bot bot commented Dec 14, 2024

🔗 Helpful Links

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

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

✅ You can merge normally! (1 Unrelated Failure)

As of commit 9c45ef7 with merge base 7924942 (image):

BROKEN TRUNK - The following job 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 Dec 14, 2024
@facebook-github-bot
Copy link
Contributor

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

Summary:
Usecase from Whatsapp (D67169920) to:
- use dtype selective build to create executorch_generated_lib
- use portable lib operators directly in C++
- ^cover these usecases in the same dependency

This requires removing the compiler flag '-fvisibility=hidden', so that the operator symbols are exposed in the archive file. Otherwise, we get missing operator symbols, like in P1697209425.

Alternative solution 1:
Add the operator dependency explicitly, eg. adding `//executorch/kernels/portable/cpu:op_cat`, to the dep list, to allow C++ usage.
This causes duplicate symbols for dependencies in op_cat, because dtype selective build re-builds the portable lib.
Without dtype selective build, this would be OK, as we use `//executorch/kernels/portable:operators` that aggregates the individual operator targets under the hood; this would be deduplicated with the explicit operator dependency.

Alternative solution 2:
Expose the operator registry and add a helper utility to return the function ptr to the kernel, though this could be an intrusive change that opens operator registry to external clients outside the core runtime. cc tarun292.

Differential Revision: D67229096
@facebook-github-bot
Copy link
Contributor

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

@facebook-github-bot facebook-github-bot merged commit f109b44 into pytorch:main Dec 16, 2024
44 of 47 checks passed
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 topic: not user facing
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants