-
Notifications
You must be signed in to change notification settings - Fork 5.5k
add aitk profiling doc #9153
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
Merged
Merged
add aitk profiling doc #9153
Changes from all commits
Commits
Show all changes
27 commits
Select commit
Hold shift + click to select a range
9cc968d
init
9259280
update
0b66b69
add overview
f0fe91b
add playground
4b4b020
Merge branch 'main' into hualxie/aitk_profiling
xieofxie 6d9c1ac
Update docs/intelligentapps/overview.md
xieofxie ff0a8a1
Update docs/intelligentapps/playground.md
xieofxie 526ac70
Update docs/intelligentapps/playground.md
xieofxie cd13998
Update docs/intelligentapps/profiling.md
xieofxie 3edc3f2
Update docs/intelligentapps/profiling.md
xieofxie 3d1edcd
Update docs/intelligentapps/profiling.md
xieofxie f6349ac
Update docs/intelligentapps/profiling.md
xieofxie 294c9ca
Update docs/intelligentapps/profiling.md
xieofxie 4bbdab6
Update docs/intelligentapps/profiling.md
xieofxie 6c68eff
Update docs/intelligentapps/profiling.md
xieofxie 08b401b
Update docs/intelligentapps/profiling.md
xieofxie f19cee5
Update docs/intelligentapps/profiling.md
xieofxie efc4a89
Update docs/intelligentapps/profiling.md
xieofxie bbaaaa4
Update docs/intelligentapps/profiling.md
xieofxie 23700bb
Update docs/intelligentapps/profiling.md
xieofxie b52cec9
Update docs/intelligentapps/profiling.md
xieofxie c5246fd
Update docs/intelligentapps/profiling.md
xieofxie 636f487
Apply suggestions from code review
xieofxie 2462aff
Update docs/intelligentapps/profiling.md
xieofxie c4d4715
Merge branch 'main' into hualxie/aitk_profiling
xieofxie eaf4f1b
more fix
162b5e7
Merge branch 'main' into hualxie/aitk_profiling
xieofxie File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 3 additions & 0 deletions
3
docs/intelligentapps/images/playground/parameters-show-resource-usage.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 3 additions & 0 deletions
3
docs/intelligentapps/images/playground/response-resource-usage.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 3 additions & 0 deletions
3
docs/intelligentapps/images/profiling/by-model-file-result.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 3 additions & 0 deletions
3
docs/intelligentapps/images/profiling/by-process-id-or-name.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 3 additions & 0 deletions
3
docs/intelligentapps/images/profiling/resource-usage-view.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 3 additions & 0 deletions
3
docs/intelligentapps/images/profiling/the-next-session-admin.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,92 @@ | ||
| --- | ||
| ContentId: 8105f83b-8291-467e-abac-2344b4f368cd | ||
| DateApproved: 12/14/2025 | ||
| MetaDescription: Profiling Quickstart in AI Toolkit. | ||
| --- | ||
| # Profiling an app using Windows Machine Learning | ||
|
|
||
| Profiling is a tool designed to help developers and AI engineers to diagnose the CPU, GPU, NPU resource usages of processes, ONNX model on different execution providers, and Windows ML events. | ||
|
|
||
| In this article, you could learn how to start profiling and how to inspect the resource usages view and the events view. | ||
|
|
||
xieofxie marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| ## Prerequisites | ||
|
|
||
| - Install the latest version of [Visual Studio Code](/download). | ||
| - Install the AI Toolkit VS Code extension. For more information, see [install AI Toolkit](/docs/intelligentapps/overview.md#install-and-setup). | ||
|
|
||
| ## Profile on app startup | ||
|
|
||
| In this mode, the profiling tool profiles the next app that is started and that is sending out Windows ML events. | ||
| This option is ideal for testing a run-once app. In this case, you start profiling, then run the app, and the resource usages will begin showing up. | ||
|
|
||
|  | ||
|
|
||
xieofxie marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| The tool starts profiling a newly started app. This means that for profiling a Python notebook, if the kernel is already running, you need to restart the kernel to begin profiling for it. Just starting a new notebook does not automatically start profiling. | ||
|
|
||
| > [!IMPORTANT] | ||
| > To receive Windows ML events, the tool needs to be run in admin mode. If VS Code is not started in admin mode, a notification shows up and guides you to restart VS Code. You need to close all other VS Code instances to make the restart in admin mode work. | ||
| >  | ||
|
|
||
|
|
||
| ## Profile a running app | ||
|
|
||
| In this mode, the profiling tool starts profiling an already running app. You can select a process based on these criteria: | ||
|
|
||
| - Process ID: like 12345 | ||
| - Process name: usually the name of app without `.exe`. The first match will be profiled. | ||
| - Process path: like `c:\Users\xxx\Inference.Service.Agent.exe`. The first match will be profiled. | ||
|
|
||
| This option is ideal for profiling an app that is already running and you're unable to restart it for profiling purposes. | ||
|
|
||
|  | ||
|
|
||
| ## Profile an ONNX model | ||
|
|
||
| In this mode, the profiling tool starts profiling an ONNX model file on a target execution provider (EP) for a given duration. You can see the resource usage while it's running. | ||
|
|
||
| This option is ideal for profiling an ONNX model on different EPs. | ||
|
|
||
|  | ||
|
|
||
| After profiling, a report folder is created with logs and data. | ||
|
|
||
|  | ||
|
|
||
| ## Resource Usages view | ||
|
|
||
| In the main window, the plot on the top shows usage of CPU, GPU, NPU, and memory. The usage is updated every second, and kept for 10 minutes. You can use the tools on the top right to navigate the timeline by zooming in, zooming out, and panning. | ||
|
|
||
|  | ||
|
|
||
| > [!NOTE] | ||
| > This feature uses performance counters. To achieve higher accuracy, you could also try [Windows Performance Recorder](https://learn.microsoft.com/en-us/windows-hardware/test/wpt/windows-performance-recorder). | ||
|
|
||
| ## Windows ML Events view | ||
|
|
||
| In the main window, the plot on the bottom shows Windows ML events. Its timeline is synced with the Resource Usages view, so you can easily determine how resources are used when certain events occur. | ||
|
|
||
| > [!Important] | ||
| > To receive Windows ML events, the tool needs to be run in admin mode. If VS Code is not started in admin mode, a notification shows up and guides you to restart VS Code. You need to close all other VS Code instances to make the restart in admin mode work. | ||
| >  | ||
|
|
||
| Currently, we only show events of the following types: | ||
|
|
||
| - Ensure ExecutionProvider Ready: when Windows ML is preparing the EP | ||
| - Session Creation: when the session is created | ||
| - Inference: when the model inferences on the session | ||
|
|
||
|  | ||
|
|
||
| ## What you learned | ||
|
|
||
| In this article, you learned how to: | ||
|
|
||
| - Start profiling in different ways | ||
| - Inspect the Resource Usages view | ||
| - Inspect the Windows ML Events view | ||
|
|
||
| ## See also | ||
|
|
||
| - [How to measure performance of AI models running locally](https://learn.microsoft.com/en-us/windows/ai/npu-devices/#how-to-measure-performance-of-ai-models-running-locally-on-the-device-npu) | ||
| - [Performance Monitor](https://learn.microsoft.com/en-us/troubleshoot/windows-server/support-tools/troubleshoot-issues-performance-monitor) | ||
| - [ONNX Runtime Tracing](https://onnxruntime.ai/docs/performance/tune-performance/logging_tracing.html) | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.