Skip to content

Conversation

@Conarnar
Copy link
Contributor

@Conarnar Conarnar commented Jul 17, 2025

Summary

The next step for building Executorch for the web is to write JavaScript bindings for the API.

Added bindidngs that would allow for loading modules and executing methods in JavaScript, along with a few functions to create tensors and read its data.

Test plan

Assuming you already have Emscripten and Node.js version >= 17, you also need Jest as the testing framework. That can be installed with npm install --save-dev jest

To build and run the tests, run the commands

# Build the library and unit tests
bash extension/wasm/build_wasm.sh

# Navigate to the testing output directory
cd cmake-out-wasm/extension/wasm/test/

# Run unit tests
npm test

Added CI for unit tests.

@pytorch-bot
Copy link

pytorch-bot bot commented Jul 17, 2025

🔗 Helpful Links

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

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

✅ No Failures

As of commit ddbc698 with merge base ce9da63 (image):
💚 Looks good so far! There are no failures yet. 💚

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 Jul 17, 2025
@Conarnar Conarnar requested a review from GregoryComer as a code owner July 18, 2025 01:04
Copy link
Contributor

@mergennachin mergennachin left a comment

Choose a reason for hiding this comment

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

Thanks!

executorch_wasm PUBLIC ${_common_include_directories}
)
target_link_libraries(executorch_wasm PUBLIC ${link_libraries})

Copy link
Contributor

Choose a reason for hiding this comment

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

should there be a default target_link_options for emscripten?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The link options used for the unit tests are specific for that target. I don't think there are link options that would be widely applicable for this.

@Conarnar Conarnar merged commit 9f86cf0 into pytorch:main Jul 29, 2025
375 of 393 checks passed
@Conarnar Conarnar added the release notes: api Changes to public facing apis (any interfaces, pybinded runtime methods, etc.) label Jul 29, 2025
@Conarnar Conarnar deleted the wasm-bindings-js branch July 29, 2025 16:02

cmake_minimum_required(VERSION 3.29)

project(executorch_wasm)
Copy link
Contributor

Choose a reason for hiding this comment

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

I don't think this directory belongs to a new project so should delete this.

set(link_libraries)
list(
APPEND
link_libraries
Copy link
Contributor

Choose a reason for hiding this comment

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

nit: should follow the naming convention with a prepending _

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. release notes: api Changes to public facing apis (any interfaces, pybinded runtime methods, etc.)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants