-
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
Add trace event control for ORT Web performance profiling #23393
base: main
Are you sure you want to change the base?
Conversation
@microsoft-github-policy-service agree company="Intel" |
@Honry Please help review this PR, thanks~ |
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.
@fs-eire, please help review the type script files. Thanks!
@@ -37,6 +42,11 @@ common::Status DataTransfer::CopyTensor(const Tensor& src, Tensor& dst) const { | |||
} | |||
} | |||
|
|||
if (trace) { | |||
console.call<void>("timeEnd", emscripten::val("ORT::DataTransfer::CopyTensor")); |
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.
Do you want to distinguish the tensor downloading and tensor uploading? If so, you can add event tracing to both if and else branch.
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.
tensor downloading and uploading can be distinguished through MLContext::writeTensor and MLContenxt::readTensor event in tracing, so i simply add this trace event for both tensor downloading and uploading.
@@ -178,6 +183,9 @@ onnxruntime::common::Status Model::Dispatch(const InlinedHashMap<std::string, On | |||
promises.call<void>("push", ml_tensor); | |||
} | |||
auto ml_tensors = emscripten::val::global("Promise").call<emscripten::val>("all", promises).await(); |
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.
I'd suggest just adding the console.time
before this line, Promise.all
is the major time consumer for constructing the ml tensors.
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.
We can get a high level view of time spending before wasm Dispatch API call if Promise.all is included.
Description
Add trace event control to better profile ORT web performance
Motivation and Context
ORT Web's current tracing implementation lacks interfaces for performance profiling using about://tracing. This PR introduces these interfaces, enabling performance bottleneck identification in ORT Web and adding several trace events for WebNN.