Expand description
Knowledge-based local circuit rewrite.
This pass consumes validated compiler knowledge rules and applies them as dependency-aware local rewrites. It is a local rewrite engine, not a global optimizer: it searches bounded operation windows, checks rule conditions, applies cost policy, and rebuilds the affected circuit regions.
RewriteConfig::production selects the conservative optimization mode
used by normal compiler cleanup. It enables simplification, cancellation,
merge, and canonicalization rules and accepts rewrites only under the local
cost model. RewriteConfig::lowering enables decomposition and
hardware-native rules as well, allowing local expansion when the caller has
requested explicit target-basis lowering.
Target-basis translation is expressed by calling
RewriteConfig::with_target_instructions. The rewriter then rejects a
lowering result that still contains gate-like instructions outside the
configured basis.
The pass recurses into supported structured classical-control bodies. It does not synthesize arbitrary matrix-backed unitaries, choose layouts, route through device topology, or perform directed-coupling legalization.
Structs§
- Knowledge
Rewrite Diagnostics - Performance diagnostics produced by rewrite execution.
- Knowledge
Rewrite Result - Public result for running the rewriter directly.
- Knowledge
Rewrite Stats - Aggregate statistics produced by one knowledge rewrite run.
- Knowledge
Rewriter - Transformer that optimizes circuits using the compiler knowledge base.
- Rewrite
Config - Stable configuration for the knowledge-based rewrite transformer.
Enums§
- Rewrite
Mode - High-level rule application mode.
Functions§
- rewrite_
circuit - Rewrites a circuit with the supplied configuration.