`durationof({...})` is unsupported
Maintainer thường phản hồi trong vòng 1 ngày
Chưa có ai nhận issue này.
Đánh giá
- Độ khó
- 4/5
- Thời gian dự kiến
- 3-5 ngày
- Mức phù hợp với người mới
- 30/100
- Loại issue
- Tính năng
- Độ rõ ràng
- Khá rõ ràng
- Mức độ hoạt động
- Ít trao đổi
- Công nghệ
- python
- Lĩnh vực
- compilers, quantum-computing
Hướng nghiên cứu
Start by reproducing the failing duration a = durationof({x q[0];}); snippet to see the validation error. The evaluator has no branch for the DurationOf expression, so look in src/pyqasm/expressions.py, then at QubitDepthNode in src/pyqasm/elements.py and DURATION_UNITS in src/pyqasm/maps/expressions.py. Done means durationof works inside delay[...] and box[...], round-trips through dumps() when the length is unknown, and raises ValidationError for an undeclared qubit, as the tests in tests/qasm3/test_timing.py check. The issue also depends on the stretch arithmetic design, so confirm that representation with maintainers first.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
Limitation
Duration and stretch types defines
durationof(), which takes a block of quantum instructions and returns its duration. It is
how a program expresses a delay relative to the length of some other operation rather than as
an absolute time.
pyqasm does not evaluate it.
Example QASM failure
OPENQASM 3.0;
include "stdgates.inc";
qubit[1] q;
duration a = durationof({x q[0];});
ValidationError: Invalid initialization value for variable 'a'
Plain duration declarations, unit arithmetic, delay[...] and box[...] all work today, so
durationof is the isolated gap in the timing surface.
Change Requested
- Evaluate
durationof({ ... })to adurationvalue usable anywhere a duration literal is,
in particular indelay[...]andbox[...]. - Where the enclosed block's length is known — because the module was loaded with
device_cycle_time/ calibration information, or the block contains only explicitdelay
instructions — return the concrete value. - Where it is not known, keep it symbolic and emit
durationof({ ... })unchanged through
dumps(). Rejecting a valid program because a backend duration is unknown would be worse
than passing it through. - Validate the block itself: the enclosed statements must be legal quantum instructions, and
any qubit they reference must be declared.
Implementation Details
openqasm3parses this as aDurationOfexpression whosetargetis a statement list.
Qasm3ExprEvaluator(src/pyqasm/expressions.py) has no branch for it, which is why the
value reaches the declaration check as unresolved.pyqasmalready tracks per-qubit depth viaQubitDepthNodeinsrc/pyqasm/elements.py. The
duration of a block is the same walk over a smaller statement list, so the existing
bookkeeping is largely reusable.loads()already acceptsdevice_cycle_time, anddtunits are handled in
DURATION_UNITS(src/pyqasm/maps/expressions.py). A cycle-count result converts to a
concrete duration through that path when a cycle time is available.- This composes with the symbolic representation proposed in the
stretcharithmetic issue —
both need a duration value that is not necessarily a concrete number. Landing a single
representation that serves both is preferable to two partial ones. - The block must be visited in a child scope so that any temporary state it creates does not
leak, and its instructions must not be emitted into the unrolled output —durationof
measures the block, it does not execute it. - Tests:
tests/qasm3/test_timing.py—durationofof a single gate, of a multi-gate block,
of a block containing an explicitdelay, its use insidedelay[...], adumps()
round-trip of the symbolic form, and an undeclared qubit inside the block raising a
ValidationError.
- Ngôn ngữ chính
- Python
- Star
- 29
- Fork
- 33
- Merge trung bình
- 2 ngày 4 giờ
- Pull request đã merge (30 ngày)
- 15
Chuẩn bị môi trường
- Không có Dockerfile hay tệp Docker Compose
- Có mẫu pull request
- Đọc hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của qBraid/pyqasm
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 63/100
Maintainer thường phản hồi trong vòng 1 ngày
-
enhancement error-handling program-validation
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 65/100
Maintainer thường phản hồi trong vòng 1 ngày
-
Move the QASM 2 printer and its branch pre-processing out of qasm2.pyCó thể đã có người làm @danielgaskins đã nhận 7 ngày trước. Đang mởenhancement qasm2
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 22/100
qBraid/pyqasm#447 · 2 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
[BUG] dumps() emits extern calls without a semicolon, producing unparsable QASMCó thể đã có người làm @Jah-yee đã nhận 15 ngày trước. Đang mởbug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 25/100
qBraid/pyqasm#438 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Parse failures raise ValidationError with an empty message; the ANTLR diagnostic is lostCó thể đã có người làm @tonycoder-hub đã nhận 9 ngày trước. Đang mởbug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 22/100
qBraid/pyqasm#436 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
Tất cả issue của qBraid/pyqasm
Issue tương tự
-
Uninstall guide omits the CloudWatch log groups AWS CodeBuild creates for useCodeBuild pipelinesĐang mởbug documentation
Độ khó 1/5 1-3 giờ Mức phù hợp với người mới 88/100
awslabs/visual-asset-management-system#552 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
netbox status: needs triage type: documentation
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 76/100
netbox-community/netbox#23460 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 75/100
awslabs/threat-composer#362 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
Maintainer thường phản hồi trong vòng 1 ngày
-
bug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
ansys/pyansys-common-mcp#213 ·
Maintainer thường phản hồi trong vòng 3 ngày