Hacktoberfest 2026: những issue maintainer đã đánh dấu cho tháng Mười, đang mở và phù hợp người mới. Xem issue Hacktoberfest

[FEATURE] Add support for `pragma`

Đang mở
#8 0 bình luận 0 reaction 0 người được giao Xem trên GitHub

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ó
5/5
Thời gian dự kiến
Hơn một tuần
Mức phù hợp với người mới
25/100
Loại issue
Tính năng
Độ rõ ràng
Khá rõ ràng
Mức độ hoạt động
Đình trệ
Công nghệ
python
Lĩnh vực
compilers

Hướng nghiên cứu

Start with the Qasm3Module class in src/pyqasm/modules/qasm3.py, where the parsed program state would hold the new read-only pragma mapping, and read the OpenQASM directives page linked in the issue to confirm the pragma syntax. The open decisions are the identifier schema (__device_name__, __device_native_gates__, and so on) and whether unknown pragmas are ignored or stored, so the maintainers need to settle these before code is written. Done means pragma key/value pairs are parsed into a MappingProxyType on the module and can be read back, with tests for known and unknown keys.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Mô tả

enhancement qasm3 qasm3-coverage
Feature Description
  • Add support for pragma in openqasm
  • Motivation: Adding pragma compiler directives enables more granular optimization for specific programs. Eg. we can embed the device information in the openqasm program itself enabling target specific transformations / optimizations for an openqasm compiler.
Implementation (Optional)
  • Since the structure of #pragma annotations are left for the compiler to handle, we can use key value pairs such as -
pragma __device_name__ : "simulator_1" 
pragma __device_native_gates__ : { "h", "cx", "s", "t" }
  • We can have a list of predefined pragma identifiers such as __device_name__, __native_gate_set__, __device_qubits__, and so on, with a specified value schema. Following is a good place to start -

    • __device_name__ : string
    • __device_num_qubits__ : string
    • __device_native_gates__ : set of string
    • __device_architecture__ : string
  • Any other pragma values are ignored OR optionally stored as key value pairs without parsing the value further

  • These values can be stored using the MappingProxyType ( as an immutable dict ), inside the Qasm3Module objects and retrieved as required.

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

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. 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.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của qBraid/pyqasm

Tất cả issue của qBraid/pyqasm

Issue tương tự

Thêm issue về Python

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.