Skip to content

Conversation

@Conarnar
Copy link
Contributor

@Conarnar Conarnar commented Aug 4, 2025

Summary

Before, if dependencies for the API were not enabled in the cmake command, you would get linking errors when trying to compile. Now, if EXECUTORCH_BUILD_WASM is turned on, an error will occur during configure stage if dependencies were not enabled.

Also changed the API to use executorch_kernels rather than hardcoding in portable_ops_lib.

For the unit tests, changed the libraries to PRIVATE instead of PUBLIC and to use --pre-js instead of --post-js as that is the recommended way of interfacing with the Embind Module.

Test plan

bash scripts/build_wasm_tests.sh
cd cmake-out-wasm/extension/wasm/test/
npm test # after installing Jest

@pytorch-bot
Copy link

pytorch-bot bot commented Aug 4, 2025

🔗 Helpful Links

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

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

❗ 1 Active SEVs

There are 1 currently active SEVs. If your PR is affected, please view them below:

❌ 2 New Failures, 1 Unrelated Failure

As of commit 13a5315 with merge base e55bf54 (image):

NEW FAILURES - The following jobs have failed:

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.

@meta-cla meta-cla 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 Aug 4, 2025
@github-actions
Copy link

github-actions bot commented Aug 4, 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.

target_link_libraries(
executorch_wasm
PUBLIC ${link_libraries}
INTERFACE executorch_kernels
Copy link
Contributor

Choose a reason for hiding this comment

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

So executorch_kernels is only built when one of the selective build options is enabled - maybe there should be some documentation indicating that wasm build must use the toplevel selective build API?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Actually, if none of the selective build options are used, executorch_kernels will default to optimized_native_cpu_ops_lib if EXECUTORCH_BUILD_KERNELS_OPTIMIZED is turned on, portable_ops_lib otherwise.
https://github.com/pytorch/executorch/blob/main/CMakeLists.txt#L885-L892

@Conarnar Conarnar merged commit caefefe into pytorch:main Aug 6, 2025
99 of 102 checks passed
@Conarnar Conarnar deleted the wasm-bindings-opt branch August 6, 2025 20:56
agrima1304 pushed a commit to agrima1304/executorch that referenced this pull request Aug 26, 2025
### Summary
Before, if dependencies for the API were not enabled in the cmake
command, you would get linking errors when trying to compile. Now, if
EXECUTORCH_BUILD_WASM is turned on, an error will occur during configure
stage if dependencies were not enabled.

Also changed the API to use executorch_kernels rather than hardcoding in
portable_ops_lib.

For the unit tests, changed the libraries to PRIVATE instead of PUBLIC
and to use `--pre-js` instead of `--post-js` as that is the recommended
way of interfacing with the Embind Module.

### Test plan
```bash
bash scripts/build_wasm_tests.sh
cd cmake-out-wasm/extension/wasm/test/
npm test # after installing Jest
```
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.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants