Skip to content

bug: WinMLSession silently drops provider_options in policy-based (default) compile path #240

@DingmaomaoBJTU

Description

@DingmaomaoBJTU

Summary

WinMLSession._build_session_options takes provider_options from ep_config and passes them only in the explicit-EP path (add_provider_for_devices). In the policy-based path (the default for device="npu"/"auto"), they are silently ignored.

Affected code

src/winml/modelkit/session/session.py L387-L414

# Explicit EP path — provider_options correctly forwarded
opts.add_provider_for_devices([matched], self._provider_options)   # ✓

# Policy-based path (default) — provider_options silently dropped
opts.set_provider_selection_policy(policy)
return opts   # ✗ self._provider_options never used

Impact

Any option set via ep_config.provider_options is silently dropped during a normal winml compile run. Confirmed affected option: htp_performance_mode, set in:

The compile pipeline (CompileStage) passes ep_config to WinMLSession, but the session never applies provider_options when using the standard policy path. As a result, QNN provider options (HTP performance mode, SOC model, etc.) have no effect.

Expected behavior

provider_options should be forwarded to ORT regardless of whether explicit-EP or policy-based selection is used.

Steps to reproduce

from winml.modelkit.compiler.configs import WinMLCompileConfig
config = WinMLCompileConfig.for_qnn()
config.ep_config.provider_options["htp_performance_mode"] = "burst"
# Compile a model — htp_performance_mode is silently ignored

Notes

  • Discovered during investigation of QNN compilation behavior for deberta Slice ops.
  • The policy-based path uses set_provider_selection_policy, which may have a different API for passing provider options — needs investigation.

Metadata

Metadata

Labels

NPUNPU specificbugSomething isn't workingdev experienceDeveloper experience improvementsneed triageNeeds triage

Type

No fields configured for Bug.

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions