microsoft / microsoft/winml-cli

P1-INFRA-006: Static Analyzer — Commutative Op Matching

Open
#161 0 comments 0 reactions 1 assignee View on GitHub

@vortex-captain is already working on this.

Since Mar 31, 2026.

infrastructure P1 static-analyzer triaged
Dominant language
Python
Stars
40
Forks
11
Avg merge
1d 8h
Merged PRs (30d)
50

Description

Summary

Implement commutative operator matching in the static analyzer's subgraph pattern matching, allowing binary operators with swapped inputs (e.g., Add(a, b) matching Add(b, a)) to match correctly against EP-provided skeleton patterns.

Context

Many neural network operators are commutative (Add, Mul, MatMul in some contexts). The static analyzer currently requires exact input order matching against EP subgraph patterns. This causes false negatives — patterns that should match fail because inputs are in a different order than the skeleton.

From plans/release/0315_release_plan/P1_CHECKLIST.md (P1-INFRA-006).

Current State

  • Subgraph pattern matching uses strict input order
  • Commutative ops (Add, Mul, etc.) with swapped inputs don't match EP patterns
  • Causes false "not supported" reports in the static analyzer

Desired State

  • Commutative ops matched with input-order-independent logic
  • Pattern matching tries both input orderings for commutative binary ops
  • No false negatives due to input order differences

Acceptance Criteria

  • Commutative op list defined (Add, Mul, Max, Min, BiasGelu variants, etc.)
  • Pattern matching tries both orderings for commutative binary ops
  • Validated: known commutative patterns in QNN/OpenVINO skeleton match correctly
  • No regressions in existing pattern matching tests
  • All existing tests pass

Technical Notes

  • CARDINAL RULE: no hardcoded model assumptions — commutative op list must be config/spec-driven
  • Standard ONNX commutative ops: Add, Mul, Max, Min, And, Or, Xor, Equal
  • Test with real QNN subgraph patterns that have commutative ops

Related Files

  • plans/release/0315_release_plan/P1_CHECKLIST.md — P1-INFRA-006

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.