Skip to content

Commit

Permalink
[js/webgpu] Fix the undefined push error (#19366)
Browse files Browse the repository at this point in the history
### Description
This PR fixes below errors when enable webgpu profiling: 
```
TypeError: Cannot read properties of undefined (reading 'push')
```
  • Loading branch information
qjia7 authored Feb 2, 2024
1 parent 9139bdd commit efc17e7
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions js/web/lib/wasm/jsep/backend-webgpu.ts
Original file line number Diff line number Diff line change
Expand Up @@ -530,8 +530,10 @@ export class WebGpuBackend {
};
this.pendingKernels.push(pendingKernelInfo);

const sessionPendingKernels = this.capturedPendingKernels.get(this.currentSessionId!);
sessionPendingKernels!.push(pendingKernelInfo);
if (this.sessionStatus === 'capturing') {
const sessionPendingKernels = this.capturedPendingKernels.get(this.currentSessionId!);
sessionPendingKernels!.push(pendingKernelInfo);
}
}

this.programManager.run(artifact, inputDatas, outputDatas, normalizedDispatchGroup, uniformBufferBinding);
Expand Down

0 comments on commit efc17e7

Please sign in to comment.