Skip to content

fix(optrace): include CPU fallback operators in QNN results - #1368

Open
xieofxie wants to merge 1 commit into
mainfrom
hualxie_copilot/98afd987d4424c3ba410d506d7726ca9
Open

xieofxie wants to merge 1 commit into
mainfrom
hualxie_copilot/98afd987d4424c3ba410d506d7726ca9

Conversation

@xieofxie

Copy link
Copy Markdown
Contributor

Summary

  • enable ONNX Runtime profiling for QNN op-trace sessions and merge CPU fallback node timings into the final operator result
  • preserve optimized node identity, exclude warmup samples, recalculate mixed-provider percentages, and label CPU operators
  • persist and support offline parsing of the ORT profile artifact

Validation

  • 260 affected unit tests passed
  • DenseNet QNN NPU trace completed with 27 QNN operators and 15 CPU fallback operators

Fixes #1362

@xieofxie
xieofxie requested a review from a team as a code owner August 27, 2026 09:37
self._ep_device,
self._ep_config,
None,
effective_monitor,

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This hook is only reached when _session_rebuilt is true, but that predicate compares only provider options and session-config entries. A monitor whose sole contribution is configure_session_options() therefore reuses the old session and never applies its native settings. Please make native monitor configuration participate in the rebuild decision.

samples_us = entry["samples_us"]
if self._expected_measured_samples is not None:
expected_total = self._warmup_samples + self._expected_measured_samples
if len(samples_us) != expected_total:

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A CPU fallback node inside Loop or Scan can emit multiple kernel events per top-level inference, so this count can legitimately exceed the perf-window iteration count. The current equality check rejects those valid mixed-provider traces as parse_failed; please account for repeated node executions within each run before validating/removing warmup samples.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

optrace: include cpu op result (from onnxruntime.json) into the final result

2 participants