Skip to content

docs: expand analyze/optimize content, rename hub→catalog#769

Merged
DingmaomaoBJTU merged 1 commit into
docs/draftfrom
qiowu/docs/draft
May 27, 2026
Merged

docs: expand analyze/optimize content, rename hub→catalog#769
DingmaomaoBJTU merged 1 commit into
docs/draftfrom
qiowu/docs/draft

Conversation

@DingmaomaoBJTU

Copy link
Copy Markdown
Collaborator

Summary

  • Rewrote docs/concepts/analyze-and-optimize.md with source-verified content: SupportLevel classification table, lint vs autoconf outputs, analysis modes, optimizer pipe architecture (4 pipes, 43 capabilities, 5 rewrite groups / 12 rules), and autoconf loop SVG diagram
  • Updated docs/commands/analyze.md with corrected EP aliases, exit-code table, and additional CLI examples
  • Renamed hub.mdcatalog.md and updated all cross-references (inspect, overview, sys, mkdocs.yml)
  • Fixed check-yaml pre-commit hook to support !!python/name tags in mkdocs.yml (--unsafe)

🤖 Generated with Claude Code

Rewrite the analyze-and-optimize concept page with source-verified
content: SupportLevel classification table, lint vs autoconf outputs,
analysis modes, three finding classes, local op execution, HTP metadata,
internal pipeline stages, optimizer pipe architecture (4 pipes, 43
capabilities across 13 categories, 5 rewrite groups / 12 rules), and
the autoconf loop diagram (SVG).  Update the analyze command reference
with corrected EP aliases, exit-code table, and additional examples.
Rename hub.md → catalog.md and update all cross-references.

Also fix check-yaml pre-commit hook to support !!python/name tags in
mkdocs.yml (--unsafe).
@DingmaomaoBJTU DingmaomaoBJTU requested a review from a team as a code owner May 27, 2026 10:09
@DingmaomaoBJTU DingmaomaoBJTU changed the base branch from main to docs/draft May 27, 2026 10:10
@DingmaomaoBJTU DingmaomaoBJTU merged commit 612d692 into docs/draft May 27, 2026
9 checks passed
@DingmaomaoBJTU DingmaomaoBJTU deleted the qiowu/docs/draft branch May 27, 2026 10:28

When a model is exported with hierarchy-preserving tags (HTP), the export produces a sidecar `_htp_metadata.json` that maps each ONNX node back to its source module (e.g., `encoder.layer.0.attention.self.GELUActivation`). Passing this file via `--htp-metadata` lets the `PatternExtractor` use the module hierarchy to match subgraph patterns more accurately than operator-level heuristics alone.

HTP metadata is consumed at the pattern extraction stage — before any EP-specific runtime checking — so the enriched patterns benefit all target EPs equally (QNN, OpenVINO, VitisAI, etc.). Without HTP metadata, the analyzer falls back to attribute-based tag matching and then the general-purpose `PatternMatcher`; with it, the analyzer can correctly identify fused patterns (GELU, LayerNorm, Attention) that are difficult to detect from the raw operator graph. See the [analyze command reference](../commands/analyze.md) for usage examples.

@vortex-captain vortex-captain May 28, 2026

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

The explanation of relation between HTP metadata and PatternMatcher seems a bit fuzzy, and unclear on why both would be needed in our system. Maybe simply state the benefits of HTP metadata when it's available, and it can be obtained in winml export/build stage by passing a HTP flag, without mentioning PatternMatcher?

This granularity matters when a specific fusion breaks a downstream step or when you need an exact optimization profile for a given EP. Some capabilities declare dependencies (e.g., `bias-gelu-fusion` requires `gelu-fusion`); the optimizer resolves these automatically when you enable a flag.

**Pattern rewrites** are a complementary mechanism: instead of folding nodes, rewrites replace one subgraph pattern with a structurally equivalent alternative. Rules are defined in JSON files (`default.json` for general rewrites, `qnn.json` for QNN-specific rewrites). The optimizer currently ships 5 rewrite groups containing 12 individual rules — for example, four GELU source variants can each be rewritten to a single `Gelu` op, and a MatMul+Add pattern can be rewritten to a GEMM or to a Conv2D for Qualcomm NPU targets. Run `--list-rewrites` to discover available families and their flag names. Flags follow the form `--enable-<source-slug>-<target-slug>`.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

nit: a md file with all the optimizer flags would also be convenient for user's reference

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.

2 participants