Skip to content

Conversation

@bbernhar
Copy link
Contributor

@bbernhar bbernhar commented Mar 19, 2025

As noted in the issue, sharing weights between graphs is a effective way to enable reuse of device buffers, allowing web developers to manage weight data in graphs similarly to other input or output buffers.

@fdwr @huningxin @reillyeon

Based on the work in Chromium by Austin Sullivan.

Resolves #760


Preview | Diff

@bbernhar
Copy link
Contributor Author

Thanks @inexorabletash and @huningxin! Addressed comments.

Copy link
Contributor

@inexorabletash inexorabletash left a comment

Choose a reason for hiding this comment

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

Overall LGTM, just some annoying nitpicks. I ran the lint tool locally over the PR to avoid surprises later.

@anssiko
Copy link
Member

anssiko commented Mar 25, 2025

(FYI - I enabled the CI workflow for this PR and all the tests passed, including the newly added lint rules from #831)

Copy link
Contributor

@inexorabletash inexorabletash left a comment

Choose a reason for hiding this comment

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

LGTM! Thank you for your patience.

Copy link
Collaborator

@fdwr fdwr left a comment

Choose a reason for hiding this comment

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

👍

@reillyeon
Copy link
Member

Thank you for the discussion here. I'm starting to come around to the idea of constness being just another property of an MLTensor like readable or writable and the debugging story is compelling. This does make me wonder as Dwayne did about whether it's worthwhile to have a separate interface name. After all, we have similar requirements on readTensor() and writeTensor() for the readable and writable properties without creating additional types.

As noted in the issue, sharing weights between graphs is a effective way
to enable reuse of device buffers, allowing web developers to manage
weight data in graphs similarly to other input or output buffers.

Resolves webmachinelearning#760
Copy link
Collaborator

@fdwr fdwr left a comment

Choose a reason for hiding this comment

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

👍

Copy link
Contributor

@inexorabletash inexorabletash left a comment

Choose a reason for hiding this comment

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

One tiny nit

@bbernhar
Copy link
Contributor Author

@fdwr Feel free to merge when ready. Thanks reviewers for the help.

Copy link
Collaborator

@fdwr fdwr left a comment

Choose a reason for hiding this comment

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

Looks fine to me. Deferring to Ningxin for final review, approval, and merging.

Copy link
Contributor

@huningxin huningxin left a comment

Choose a reason for hiding this comment

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

LGTM

@huningxin huningxin merged commit d98e86d into webmachinelearning:main Apr 22, 2025
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Support building graphs from MLTensor containing constants

6 participants