-
Notifications
You must be signed in to change notification settings - Fork 3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[js/webgpu] allow to specify callback for profiling data #17820
Conversation
// eslint-disable-next-line no-console | ||
console.log(`[profiling] kernel "${kernelId}|${kernelName}" ${inputShapes}${outputShapes}execution time: ${ | ||
endTime - startTime} ns`); | ||
if (this.backend.env.webgpu.profiling?.ondata) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Default startTime is always 0. And any use case for profilingTimeBase?
if (typeof this.backend.profilingTimeBase === 'undefined') {
this.backend.profilingTimeBase = startTimeU64;
}
const startTime = Number(startTimeU64 - this.backend.profilingTimeBase);
const endTime = Number(endTimeU64 - this.backend.profilingTimeBase);
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
backend.profilingTimeBase
is designed to log the time of the start time of the first completed kernel (startTime64
). By using this, the startTime and endTime can be relatively small to fit into int53.
Close this one. Use #18732 instead. The reason why I create a new PR is because somehow the check "license/cla" is not triggered for this PR and seems there is no way to manually trigger it unless create a new PR. |
### Description **This PR is a replacement of #17820.** allow to specify callback for profiling data *Previous*: ```js ort.env.webgpu.profilingMode = 'default'; // enable profiling // profiling data will output to console. ``` *Now*: ```js ort.env.webgpu.profiling = { mode: 'default'; // enable profiling ondata: (data) => { // .. process the profiling data } }; //for each kernel, "ondata" will be called once. only output to console if ondata is not specified. ```
…8732) ### Description **This PR is a replacement of microsoft#17820.** allow to specify callback for profiling data *Previous*: ```js ort.env.webgpu.profilingMode = 'default'; // enable profiling // profiling data will output to console. ``` *Now*: ```js ort.env.webgpu.profiling = { mode: 'default'; // enable profiling ondata: (data) => { // .. process the profiling data } }; //for each kernel, "ondata" will be called once. only output to console if ondata is not specified. ```
Description
allow to specify callback for profiling data
Previous:
Now: