Skip to content
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

[wasm] Make setWasmPaths require an entry for each WASM binary. #3749

Merged
merged 4 commits into from
Aug 10, 2020

Conversation

annxingyuan
Copy link
Contributor

@annxingyuan annxingyuan commented Aug 7, 2020

To see the logs from the Cloud Build CI, please join either our discussion or announcement mailing list.


This change is Reviewable

@annxingyuan annxingyuan changed the title [wasm] Make setWasmPaths stricter. [wasm] Make setWasmPaths require an entry for each WASM binary. Aug 7, 2020
@annxingyuan annxingyuan requested a review from tafsiri August 7, 2020 15:14
@annxingyuan annxingyuan self-assigned this Aug 7, 2020
Copy link
Collaborator

@pyu10055 pyu10055 left a comment

Choose a reason for hiding this comment

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

Reviewable status: 0 of 1 approvals obtained (waiting on @annxingyuan and @tafsiri)


tfjs-backend-wasm/src/backend_wasm.ts, line 426 at r1 (raw file):

          `${missingPaths.join(',')}. Please either call setWasmPaths with a ` +
          `map providing a path for each binary, or with a string indicating ` +
          `the directory where all the binaries can be found.`);

Does this works for url path for all binaries?

Copy link
Contributor

@tafsiri tafsiri left a comment

Choose a reason for hiding this comment

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

Reviewed 4 of 4 files at r1.
Reviewable status: :shipit: complete! 1 of 1 approvals obtained (waiting on @annxingyuan and @tafsiri)


tfjs-backend-wasm/karma.conf.js, line 64 at r1 (raw file):

      // Import the generated js library from emscripten.
      {pattern: 'wasm-out/**/*.js'},
      // Import the generated worker file from emscripten.

is this removal intended? how is it related to the rest of the change?


tfjs-backend-wasm/src/backend_wasm.ts, line 421 at r1 (raw file):

    const missingPaths =
        wasmBinaryNames.filter(name => wasmFileMap[name] == null);
    if (missingPaths.length) {

change this to a more explicit check >= 0

Copy link
Collaborator

@lina128 lina128 left a comment

Choose a reason for hiding this comment

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

Hi Ann, what will happen if user provide three paths, the basic one is valid, the other two are invalid, and we try to use the invalid one, if it fails, do we try the basic one or just return setBackend('wasm') false?

Reviewable status: :shipit: complete! 1 of 1 approvals obtained (waiting on @annxingyuan)

Copy link
Collaborator

@lina128 lina128 left a comment

Choose a reason for hiding this comment

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

Reviewable status: :shipit: complete! 1 of 1 approvals obtained (waiting on @annxingyuan and @tafsiri)


tfjs-backend-wasm/src/backend_wasm.ts, line 421 at r1 (raw file):

Previously, tafsiri (Yannick Assogba) wrote…

change this to a more explicit check >= 0

Isn't it > 0

Copy link
Collaborator

@pyu10055 pyu10055 left a comment

Choose a reason for hiding this comment

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

Reviewable status: :shipit: complete! 1 of 1 approvals obtained (waiting on @annxingyuan and @tafsiri)


tfjs-backend-wasm/src/backend_wasm.ts, line 426 at r1 (raw file):

Previously, pyu10055 (Ping Yu) wrote…

Does this works for url path for all binaries?

Is this a breaking change for existing code?

Copy link
Contributor Author

@annxingyuan annxingyuan left a comment

Choose a reason for hiding this comment

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

Hi Na, in this case WASM backend initialization will fail. Yannick and I discussed the possibility of falling back to the basic binary, but decided to stick with this behavior for now as it is more explicit. We can definitely revisit this though if you feel strongly about it one way or another.

Reviewable status: :shipit: complete! 1 of 1 approvals obtained (waiting on @pyu10055 and @tafsiri)


tfjs-backend-wasm/karma.conf.js, line 64 at r1 (raw file):

Previously, tafsiri (Yannick Assogba) wrote…

is this removal intended? how is it related to the rest of the change?

this is leftover from the previous PR where we removed the worker typescript module in favor of a plain JS one.


tfjs-backend-wasm/src/backend_wasm.ts, line 421 at r1 (raw file):

Previously, lina128 (Na Li) wrote…

Isn't it > 0

Done


tfjs-backend-wasm/src/backend_wasm.ts, line 426 at r1 (raw file):

Previously, pyu10055 (Ping Yu) wrote…

Is this a breaking change for existing code?

Yes, I added a test for calling setWasmPaths with a string indicating the folder where all binaries can be found. Existing code calls setWasmPath (note there is no 's' at the end), which still exists, although it now logs a deprecation warning (#3627).

Copy link
Collaborator

@lina128 lina128 left a comment

Choose a reason for hiding this comment

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

Got it. SG. Thanks for the explanation, Ann!

Reviewable status: :shipit: complete! 1 of 1 approvals obtained (waiting on @pyu10055 and @tafsiri)

Copy link
Collaborator

@pyu10055 pyu10055 left a comment

Choose a reason for hiding this comment

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

Reviewable status: :shipit: complete! 2 of 1 approvals obtained (waiting on @tafsiri)

@annxingyuan annxingyuan merged commit 6a5e29d into master Aug 10, 2020
@annxingyuan annxingyuan deleted the setwasmpaths branch August 10, 2020 15:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants