Faster CPU backend for large registers (≥ 20 qubits)

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

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
48/100
Loại issue
Tính năng
Độ rõ ràng
Khá rõ ràng
Mức độ hoạt động
Sôi nổi
Công nghệ
rust
Lĩnh vực
performance

Hướng nghiên cứu

Start with apply_gate_kernel in src/engine.rs around line 75 and compare its CPU benchmark with Qiskit Aer at 20 or more qubits. The issue lists gate special cases, controlled-gate indexing, cache blocking, and two-qubit fusion as possible optimization paths. Done means CPU circuits run faster without an API change; the issue names no benchmark file or test command.

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

Mô tả

enhancement
What you want to do

In the benchmark the CPU backend falls behind Qiskit Aer from 20 qubits (1.17 s vs 431 ms at 22). Each extra qubit costs 3–4× instead of 2× once the 16 MiB state stops fitting in L3 cache. Users without a GPU hit this wall first.

Implementation notes

Ranked roughly by expected gain per line of code:

  1. Special-case permutation and diagonal gates. apply_gate_kernel (src/engine.rs:75) runs a
    full 2×2 complex multiply for X, CX, Z, CZ, S, T, P and RZ. X and CX only need to swap amplitudes.
    Diagonal gates only need to multiply one half (or both halves by a phase). This halves the
    arithmetic and the memory writes for diagonal gates.
  2. Controlled gates should only visit pairs whose control bits are set. At the moment the kernel
    visits every pair and skips non-matching ones with a branch. Enumerating only the indices that
    match turns a full pass into half a pass (CX) or a quarter (CCX).
  3. Cache blocking. Apply runs of gates whose targets are all below some qubit k to one
    2^k-amplitude block at a time, so each block stays in L2/L3 while several gates hit it.
  4. Two-qubit fusion. Merge consecutive gates on the same pair of qubits into one 4×4 matrix.
    That needs a 4×4 kernel.
What it could look like
No API change: the same circuits just run faster on `backend="cpu"`.
Contributing
  • I would like to open a pull request for this (see CONTRIBUTING.md).
Ngôn ngữ chính
Rust
Star
1
Fork
0
Merge trung bình
12 phút
Pull request đã merge (30 ngày)
4

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 kaiwave/qsengine

Tất cả issue của kaiwave/qsengine

Issue tương tự

Thêm issue về Rust

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.