Skip to content

Commit

Permalink
[js/web] release session after use in npm test (microsoft#17470)
Browse files Browse the repository at this point in the history
### Description
release session after use in npm test.

This is one of the prerequisites for supporting IO binding for WebGPU
buffer in onnxruntime-web.

list of prerequisites PRs:
microsoft#17465
microsoft#17469
microsoft#17470 (this one)
  • Loading branch information
fs-eire authored Sep 12, 2023
1 parent 49511b5 commit f923eec
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
4 changes: 2 additions & 2 deletions js/web/test/test-main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -110,9 +110,9 @@ for (const group of ORT_WEB_TEST_CONFIG.model) {
test, ORT_WEB_TEST_CONFIG.profile, ORT_WEB_TEST_CONFIG.options.sessionOptions);
});

after('release session', () => {
after('release session', async () => {
if (context) {
context.release();
await context.release();
}
});

Expand Down
3 changes: 2 additions & 1 deletion js/web/test/test-runner.ts
Original file line number Diff line number Diff line change
Expand Up @@ -210,11 +210,12 @@ export class ModelTestContext {
Logger.verbose('TestRunner.Perf', '***Perf Data End');
}

release(): void {
async release(): Promise<void> {
if (this.profile) {
this.session.endProfiling();
}
this.logPerfData();
await this.session.release();
}

/**
Expand Down

0 comments on commit f923eec

Please sign in to comment.