Skip to content

Commit

Permalink
PR feedback
Browse files Browse the repository at this point in the history
  • Loading branch information
egalli committed Aug 1, 2024
1 parent a82a261 commit 25e3a0f
Showing 1 changed file with 7 additions and 8 deletions.
15 changes: 7 additions & 8 deletions onnxruntime/wasm/pre-jsep.js
Original file line number Diff line number Diff line change
Expand Up @@ -200,19 +200,19 @@ Module['jsepInit'] = (name, params) => {
};
} else if(name === 'webnn') {
// Functions called from EM_ASM need to be assigned in a way that can be minified.
// Functions called via emscripten::val::module_property need to be assigned by name so that the minifier doesn't
// change the name.

[Module.jsepBackend,
Module.jsepReserveBufferId,
Module.jsepReleaseBufferId,
Module.jsepEnsureBuffer,
Module['jsepEnsureBuffer'],
Module.jsepUploadBuffer,
Module.jsepDownloadBuffer,
Module['jsepDownloadBuffer'],
] = params;


// Functions called via emscripten::val::module_property need to be assigned in a way that the minifier won't
// change the name
Module['jsepEnsureBuffer'] = Module.jsepEnsureBuffer;
Module['jsepDownloadBuffer'] = Module.jsepDownloadBuffer;
// This function is called from both JS and an EM_ASM block, it needs both a minifiable name and an explicit name.
Module['jsepReleaseBufferId'] = Module.jsepReleaseBufferId;

// Functions called from JS also need to have explicit names.
const backend = Module.jsepBackend;
Expand All @@ -225,7 +225,6 @@ Module['jsepInit'] = (name, params) => {
Module['jsepOnReleaseSession'] = sessionId => {
backend['onReleaseSession'](sessionId);
};
Module['jsepReleaseBufferId'] = Module.jsepReleaseBufferId;
Module['jsepCreateMLBufferDownloader'] = (bufferId, type) => {
return backend['createMLBufferDownloader'](bufferId, type);
}
Expand Down

0 comments on commit 25e3a0f

Please sign in to comment.