fix: migrate EPAlias to EPName where possible (#646)#1005
Open
xieofxie wants to merge 3 commits into
Open
Conversation
added 2 commits
June 30, 2026 16:40
Compare against the canonical EPName instead of a single alias literal (ep == "qnn"). An EP can have multiple aliases (e.g. nv_tensorrt_rtx / nvtensorrtrtx) and the canonical name itself would not match, so the alias-literal comparison was fragile. Normalize via normalize_ep_name first and widen the parameter to EPNameOrAlias.
The map covers every canonical EPName, so an unknown name now signals a bug rather than silently defaulting to IHVType.MICROSOFT. InformationEngine already catches ValueError (falls back to loading all rules) and the model validator catches it defensively. Replace the per-EP unit tests with one that verifies every EP_NAMES member resolves to an IHVType (enforcing map/Literal parity) plus an unknown-raises test. Update fixtures that relied on the old lenient behavior to use canonical EP names.
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Summary
Addresses #646 (migrate
EPAliastoEPNamewhere possible).EPNameOrAliasis the public-facing input type;EPNameis the internal canonical form. This PR removes places where a bare alias was used where a canonical name belongs, and stops comparing against single alias literals.Changes
analyze/utils/ep_utils.py—infer_ihv_from_ep_namenow does a direct, exactdict[EPName, IHVType]lookup covering every member of theEPNameLiteral. An unknown name now raisesValueErrorinstead of silently defaulting toIHVType.MICROSOFT(the callers that matter already handle it:InformationEnginecatchesValueErrorand falls back to loading all rules; the model validator catches it defensively). Also fixes a latent miss whereCUDAExecutionProviderresolved toMICROSOFTinstead ofNVIDIA.serve/schema.py—EpSwitchRequest.epwas the onlyepfield still typed bareEPAlias; every sibling isEPNameOrAliasandmanager.switch_epalready acceptsEPNameOrAlias. Widened it for consistency so it accepts both"qnn"and"QNNExecutionProvider".compiler/utils.py—needs_format_conversioncomparedep == "qnn", a single alias literal. An EP can have multiple aliases (e.g.nv_tensorrt_rtx/nvtensorrtrtx), and the canonical name itself wouldn't match. Now normalizes vianormalize_ep_nameand compares against the canonical"QNNExecutionProvider"; parameter widened toEPNameOrAlias.Notes
EPConfig.providerdeliberately remains alias-typed: every value it holds is an alias (provider="qnn", etc.), so retyping toEPNamewould require a value migration with serialization back-compat — out of scope here.EPNameOrAliascall sites confirmed every one either normalizes before a canonical sink or forwards to a callee that does — no other un-normalized canonical-sink usages were found.Tests
infer_ihvunit tests with one that verifies everyEP_NAMESmember resolves to anIHVType(enforcing map/Literal parity) plus an unknown-raises test.ACEExecutionProvider→VitisAIExecutionProvider; alias"openvino"→"OpenVINOExecutionProvider"in the validator tests).test_qlinear_for_qnn_canonical_namecovering the canonical-name case that previously failed inneeds_format_conversion.