Faster CPU backend for large registers (≥ 20 qubits)

Abierto
#9 0 comentarios 0 reacciones 0 asignados Ver en GitHub

Nadie ha tomado este issue todavía.

Evaluación

Dificultad
5/5
Tiempo estimado
Más de una semana
Aptitud para principiantes
48/100
Tipo de issue
Nueva funcionalidad
Claridad
Bastante claro
Estado de actividad
Activo
Stack tecnológico
rust
Área
performance

Línea de trabajo

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.

Escrito por el modelo de indexación a partir del texto del issue.

Descripción

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).
Lenguaje dominante
Rust
Estrellas
1
Forks
0
Merge medio
12 min
PR fusionados (30 d)
4

Preparar el entorno

Primeros pasos

  1. Lee el issue completo y luego la guía de contribución del proyecto.
  2. Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
  3. Haz un fork del repositorio y trabaja en una rama.
  4. Abre un pull request que haga referencia al número del issue.

Más de kaiwave/qsengine

Todos los issues de kaiwave/qsengine

Issues similares

Más issues de Rust

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.