language-authoring
Write, review, translate, and repair OpenQASM 3.0/3.1 programs, including circuit language, timing intent, calibration structure, typed I/O, and standard-library use.
- License 许可
- Apache-2.0
- 最近更新
- 2026-09-03
- Stars
- ★ 351
- Forks
- 27
01 前言 Front Matter
- name
- language-authoring
- license
- Apache 2.0
- metadata
- { "disco-role": "operating" }
- description
- Write, review, translate, and repair OpenQASM 3.0/3.1 programs, including circuit language, timing intent, calibration structure, typed I/O, and standard-library use.
- disable-model-invocation
- true
02 资源文件 6
- 参考文档references/core-language.md9.8 KB
- 参考文档references/directives-io-and-standard-library.md5.9 KB
- 参考文档references/example-patterns.md6.2 KB
- 参考文档references/quantum-workflows.md7.7 KB
- 参考文档references/timing-calibration-and-pulse.md6.9 KB
- 参考文档references/troubleshooting.md10.6 KB
03 SKILL.md 正文
OpenQASM language authoring
Use this sub-skill when the task is to write or explain OpenQASM 3.0/3.1
source, translate circuit pseudocode, select standard gates, or repair a
program involving classical control, timing, calibration, or pulse concepts.
The language baseline is OpenQASM 3.1. Keep the requested version explicit;
the reference Python parser commonly accepts both 3.0 and 3.1.
Choose the right boundary
- Use the rules and patterns in the bundled references for language meaning, source design, and author-level repairs.
- Route lexer/parser-rule questions, a parse failure, or a syntax-versus- context diagnosis to grammar-conformance.
- Route Python
openqasm3parsing, AST construction, visitors, transformers, printing, or helper-code questions to python-ast-tooling. - Do not promise simulator or QPU execution, provider compilation, pulse calibration values, semantic compiler implementation, OpenQASM 2 migration, or release/governance work.
Authoring contract
- Ask for the target language version, intended consumer, virtual versus physical qubits, and whether the output must be portable source, a parser fixture, or a provider-specific program.
- Start with comments, then an optional first non-comment
OPENQASM M.m;statement. Use one version statement only. Put globalinclude,defcalgrammar, andpragmastatements at global scope. - Declare every symbol before use. Declare virtual qubits as
qubitorqubit[n]; never declare physical$nqubits. Declare classical values one variable at a time and make width constantsconstwhen a type or index requires compile-time knowledge. - Separate the four checks: textual grammar acceptance, parser contextual checks, language semantic/type validity, and target/provider execution. Passing one does not prove the next.
- Validate the smallest complete program first. Then add includes, custom gates, aliases, control flow, timing, and calibration one layer at a time. Preserve a versioned minimal reproducer when repairing a failure.
Fast decision guide
- Need a unitary circuit operation? Use a standard gate or a preceding
gatedefinition. Agatedefines unitary meaning; it does not choose hardware implementation. - Need classical feed-forward? Measure into
bit/bit[n], then useif,while,for, or integer-onlyswitch. Usebreakandcontinueonly inside a loop; useendfor immediate termination. - Need ordered multi-qubit circuit intent? Prefer an explicit
forloop when order matters. Register gate broadcasting requires equal register lengths and promises commuting expanded operations. - Need a view of registers? Use
letaliases and index sets. Usearrayonly for global, statically shaped classical data and pass it todef/externwith an explicitreadonlyormutablereference contract. - Need scheduling intent? Use
duration,stretch,delay[...],box,barrier,nop, anddurationof(...); these describe timing constraints, not a backend's measured gate durations. - Need pulse-level work? Use
defcalgrammar,cal, anddefcalonly with a target's calibration grammar and physical-qubit mapping. Keep provider names, waveform templates, and values outside portable claims. - Need an opaque classical or pulse operation? Declare an
externsignature; its implementation, linkage, latency, and runtime support are outside the language text.
Compact review workflow
- Normalize the goal and classify each requested construct as portable language, parser-only illustration, semantic/compiler-dependent, or provider-dependent.
- Read the relevant bundled reference before editing. Check declaration order, scopes, types, register shapes, casts, qubit identity, and version/include assumptions.
- Write a self-contained minimal source. Name every input/output and choose explicit measurement destinations. Avoid undefined implementation externs unless the example is intentionally marked dependent.
- Run a parser check for grammar/context acceptance, then a semantic/compiler
check if one is available. Check include resolution separately; parsing an
includeline does not prove that the named file exists or has the expected definitions. - For timing or calibration, record the required target assumptions and verify definite durations, physical operands, and provider-owned symbols. Never infer execution from a successful parse.
- When repairing, report the first failing layer, the minimal change, and any remaining target-specific limitation. Use the troubleshooting reference for symptom-to-repair paths.
Reference map
- Core language: declarations, scope, types, literals, expressions, casts, arrays, aliases, and indexing.
- Quantum workflows: gates, modifiers, broadcasting, measurement, reset, flow control, subroutines, and externs.
- Timing, calibration, and pulse: timing constructs, calibration boundaries, and OpenPulse concepts.
- Directives, I/O, and standard library: pragmas, annotations, typed I/O, include contracts, and standard gates.
- Example patterns: compact complete patterns with portability labels and validation assumptions.
- Troubleshooting: actionable diagnosis for scope, type, qubit identity, include, timing, calibration, and execution confusion.
04 同仓库更多 Skills
passnet-triton-opt
Make a single PassNet Triton kernel fast AND numerically faithful: performance model (when a replacement can win at all), block/grid/warp tuning, autotune policy, launch overhead, and per-op numeric recipes to pass the dtype baseline tolerances. Use when a pass matches and is correct but speedup below expected, or when correctness fails by small numeric margins.
passnet-solve
END-TO-END playbook for solving one PassNet sample: analyze the computation graphs, decide the optimization strategy (what to fuse, what to replace, what to leave alone), drive the iteration loop, and maximize the sample score. This is the ENTRY skill — invoke it first for any PassNet optimization task; it tells you when to use passnet-pattern-fusion, passnet-triton-opt and passnet-feedback.
passnet-skill
PassNet GPU kernel optimization via compiler passes. Design and implement Triton-based optimization passes, create pass files under ./pass_dir/, self-evaluate with pass_evaluator, and iterate to maximize GPU speedup.
passnet-pattern-fusion
Author PassNet pass files: write patterns that actually MATCH the FX graph, pick fusion regions (which ops to absorb into one Triton kernel), and structure multi-pass submissions with the mandatory shared-dispatch architecture. Use when creating or fixing pattern()/replacement_args()/replacement_func() files, when a pass "failed to match", or when deciding how to fuse multiple kernels/ops.
passnet-orchestrate
Round/batch planning and decision support for PassNet graph optimization. Use for multi-sample triage, worker allocation, eval-budget policy, and post-eval keep/revert decisions. For solving one concrete sample end to end, use passnet-solve as the entry skill; consult this skill only when you need broader planning or a specific decision gate.
passnet-feedback
Fast, deterministic feedback for PassNet work: pre-flight pattern/match verification WITHOUT burning a GPU evaluation, per-node bottleneck analysis of a sample's graphs, and eval-log parsing into per-variant status + estimated score + failure classification. Use BEFORE every GPU evaluation (check_pattern), at the START of a sample (analyze_graph), and AFTER every evaluation (parse_eval_log).