Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 7 additions & 6 deletions js/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions js/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
"@types/npmlog": "^4.1.4",
"@typescript-eslint/eslint-plugin": "^8.46.2",
"@typescript-eslint/parser": "^8.46.2",
"baseline-browser-mapping": "^2.9.13",
"dir-compare": "^4.2.0",
"esbuild": "^0.25.0",
"esbuild-plugin-polyfill-node": "^0.3.0",
Expand Down
13 changes: 6 additions & 7 deletions js/web/lib/wasm/jsep/backend-webgpu.ts
Original file line number Diff line number Diff line change
Expand Up @@ -247,7 +247,7 @@ export class WebGpuBackend {
const requireFeatureIfAvailable = (feature: GPUFeatureName) =>
adapter.features.has(feature) && requiredFeatures.push(feature) && true;
// Try chromium-experimental-timestamp-query-inside-passes and fallback to timestamp-query
if (!requireFeatureIfAvailable('chromium-experimental-timestamp-query-inside-passes' as GPUFeatureName)) {
if (!requireFeatureIfAvailable('chromium-experimental-timestamp-query-inside-passes')) {
requireFeatureIfAvailable('timestamp-query');
}
requireFeatureIfAvailable('shader-f16');
Expand All @@ -263,7 +263,7 @@ export class WebGpuBackend {
this.kernelCustomData = new Map();

// set up flags for logger
configureLogger(env.logLevel!, !!env.debug);
configureLogger(env.logLevel, !!env.debug);

// TODO: set up flags

Expand Down Expand Up @@ -341,10 +341,10 @@ export class WebGpuBackend {
let queryReadBuffer: GPUBuffer;
if (this.queryType !== 'none') {
this.commandEncoder.resolveQuerySet(
this.querySet!,
this.querySet,
0,
this.pendingDispatchNumber * 2,
this.queryResolveBuffer!,
this.queryResolveBuffer,
0,
);

Expand All @@ -356,7 +356,7 @@ export class WebGpuBackend {
this.pendingQueries.set(queryReadBuffer, this.pendingKernels);
this.pendingKernels = [];
this.commandEncoder.copyBufferToBuffer(
this.queryResolveBuffer!,
this.queryResolveBuffer,
0,
queryReadBuffer,
0,
Expand Down Expand Up @@ -827,8 +827,7 @@ export class WebGpuBackend {
return;
}

// eslint-disable-next-line @typescript-eslint/no-explicit-any
(this.computePassEncoder as any).writeTimestamp(this.querySet, index);
this.computePassEncoder.writeTimestamp(this.querySet, index);
}
setQueryType(): void {
this.queryType = 'none';
Expand Down
2 changes: 1 addition & 1 deletion js/web/lib/wasm/jsep/backend-webnn.ts
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ export class WebNNBackend {
private mlOpSupportLimitsBySessionId = new Map<number, MLOpSupportLimits>();

constructor(env: Env) {
configureLogger(env.logLevel!, !!env.debug);
configureLogger(env.logLevel, !!env.debug);
}

public get currentSessionId(): number {
Expand Down
2 changes: 1 addition & 1 deletion js/web/lib/wasm/jsep/init.ts
Original file line number Diff line number Diff line change
Expand Up @@ -200,7 +200,7 @@ export const init = async (
// eslint-disable-next-line @typescript-eslint/no-require-imports, @typescript-eslint/no-var-requires
const webGpuBackendImpl = require('./backend-webgpu').WebGpuBackend;
const backend = new webGpuBackendImpl();
await backend.initialize(env, gpuAdapter!);
await backend.initialize(env, gpuAdapter);

jsepInit('webgpu', [
// backend
Expand Down
2 changes: 1 addition & 1 deletion js/web/lib/wasm/proxy-worker/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ if (isProxyWorker) {
case 'init-wasm':
initializeWebAssembly(message!.wasm).then(
() => {
initRuntime(message!).then(
initRuntime(message).then(
() => {
postMessage({ type });
},
Expand Down
4 changes: 2 additions & 2 deletions js/web/lib/wasm/run-options.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,8 @@ export const setRunOptions = (options: InferenceSession.RunOptions): [number, nu
}

runOptionsHandle = wasm._OrtCreateRunOptions(
runOptions.logSeverityLevel!,
runOptions.logVerbosityLevel!,
runOptions.logSeverityLevel,
runOptions.logVerbosityLevel,
!!runOptions.terminate!,
tagDataOffset,
);
Expand Down
4 changes: 2 additions & 2 deletions js/web/lib/wasm/wasm-core-impl.ts
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ const initOrt = (numThreads: number, loggingLevel: number): void => {
*/
export const initRuntime = async (env: Env): Promise<void> => {
// init ORT
initOrt(env.wasm.numThreads!, logLevelStringToEnum(env.logLevel));
initOrt(env.wasm.numThreads, logLevelStringToEnum(env.logLevel));
};

/**
Expand Down Expand Up @@ -955,7 +955,7 @@ export const run = async (
gpuBuffer,
download: async () => {
const arrayBuffer = await downloadDataFunction();
const data = new (tensorTypeToTypedArrayConstructor(type!))(arrayBuffer);
const data = new (tensorTypeToTypedArrayConstructor(type))(arrayBuffer);
return data as Tensor.DataTypeMap[Tensor.GpuBufferDataTypes];
},
dispose: () => {
Expand Down
Loading