-
Notifications
You must be signed in to change notification settings - Fork 243
Adding Estimate NPU Latency pass and unit test #2178
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
base: main
Are you sure you want to change the base?
Conversation
@microsoft-github-policy-service agree company="AMD" |
/azp run |
Azure Pipelines successfully started running 1 pipeline(s). |
from estimator.run import run_perf_estimate | ||
except ImportError: | ||
perf_installed = False | ||
logger.warning("Estimator module not found. Skipping EstimateNPULatency pass.") |
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 think instead of raising a warning, it might be better to fail with import a helpful import error which tells what package to install. since olive caches runs, to rerun the pass with the dependency installed, they would have to clean the cache or delete the cached run that skipped the estimation.
"supported_accelerators": [ "*" ], | ||
"supported_precisions": [ "*" ], | ||
"supported_algorithms": [ ], | ||
"supported_quantization_encodings": [ ] |
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.
could you add a "module_dependencies"
option like under the autoawqquantizer pass for the package required to run this estimation?
class TestEstimateNPULatency: | ||
"""Test cases for EstimateNPULatency pass.""" | ||
|
||
def test_estimate_latency_basic(self, tmp_path): |
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.
please also add the required dependency to the requirements-test.txt under test
Describe your changes
Overview
Added the EstimateNPULatency pass under
olive/onnx/vitis_ai/estimate_latency.py
EstimateNPULatency makes use of the NPU Perf Estimator tool to predict computational performance of workloads given a set of parameters.
This is an analysis pass and does not transform the graph at all. Used for performance analysis only.
Installation
To install (if not installed through requirements.txt), run the following:
pip install [placeholder for wheel]
Confirm python version installed is >= 3.10 for compatibility.
If perf estimator package is not installed, the following warning will show and the pass will simply be bypassed:

Usage
Inputs
EstimateNPULatency takes in both the model in the form of an
OnnxModelHandler
object and a list of optional parameters in the form of a dict ofPassConfigParams
(consistent with all other passes).Optional Parameters
To pass in optional parameters, list parameter name and parameter value as key-value pairs in the json file. See example:
str
stx
["stx"]
Adding Pass to Config File
Should ideally be run as the last pass and listed last in the
<model>.json
file. For example:Output
Generates a
concise_summary
directory within the run directory with the following files:{model_name}_concise_summary.txt
will display the following info on roofline latency, total compute ops, and what conclusion can be drawn on performance bottleneck (whether it is DDR Bandwidth bound or Compute bound):{model_name}_concise_summary.csv
will display the same info but specific to per op. Ops are listed in descending order of latency:Known Passing Tests
Resnet w/ Perf Estimator
Refer to Olive Recipes Repo
MobileNet w/ Perf Estimator
Refer to Olive Recipes Repo
Unit Test
python -m pytest test/unit_test/passes/vitis_ai/test_estimate_latency.py
Checklist before requesting a review
lintrunner -a
(Optional) Issue link