Skip to content

Commit b2d0110

Browse files
committed
PR feedback
1 parent 6ec6b4b commit b2d0110

File tree

1 file changed

+7
-8
lines changed

1 file changed

+7
-8
lines changed

onnxruntime/wasm/pre-jsep.js

+7-8
Original file line numberDiff line numberDiff line change
@@ -200,19 +200,19 @@ Module['jsepInit'] = (name, params) => {
200200
};
201201
} else if(name === 'webnn') {
202202
// Functions called from EM_ASM need to be assigned in a way that can be minified.
203+
// Functions called via emscripten::val::module_property need to be assigned by name so that the minifier doesn't
204+
// change the name.
205+
203206
[Module.jsepBackend,
204207
Module.jsepReserveBufferId,
205208
Module.jsepReleaseBufferId,
206-
Module.jsepEnsureBuffer,
209+
Module['jsepEnsureBuffer'],
207210
Module.jsepUploadBuffer,
208-
Module.jsepDownloadBuffer,
211+
Module['jsepDownloadBuffer'],
209212
] = params;
210213

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

217217
// Functions called from JS also need to have explicit names.
218218
const backend = Module.jsepBackend;
@@ -225,7 +225,6 @@ Module['jsepInit'] = (name, params) => {
225225
Module['jsepOnReleaseSession'] = sessionId => {
226226
backend['onReleaseSession'](sessionId);
227227
};
228-
Module['jsepReleaseBufferId'] = Module.jsepReleaseBufferId;
229228
Module['jsepCreateMLBufferDownloader'] = (bufferId, type) => {
230229
return backend['createMLBufferDownloader'](bufferId, type);
231230
}

0 commit comments

Comments
 (0)