Add cache-friendly qubit index remapping - #1075
Conversation
There was a problem hiding this comment.
Code Review
This pull request introduces qubit remapping functionality (qubit_remap.h) to improve state-vector cache locality, adds a NEON-vectorized simulator (simulator_neon.h and statespace_neon.h), and updates the runner and build configurations to support these features. The code review identified critical issues in the new remapping logic, including a potential out-of-bounds memory access in RemapIndex, a logic bug in RemapMeasurementResult that corrupts measurement results by incorrectly rebuilding the bitstring, and undefined behavior in RemapControlQubits caused by shifting a boolean value by more than 31 bits.
2bd3c08 to
a48e67d
Compare
sergeisakov
left a comment
There was a problem hiding this comment.
Thank you for the PR! I took a look at the performance impact, but I'm not quite seeing the 9% runtime improvement on my end. Depending on the circuit and platform, my benchmarks show results fluctuating within about ±5% (runtime can increase). Because the gains seem marginal here, it might be worth exploring alternative strategies for optimizing performance.
|
close this, the main work is shifted into the #1092 which has more effective optimization. |
The remap scores circuit qubits by gate usage, places frequently used qubits on lower physical state-index bits, and rewrites gates so simulation preserves the original logical circuit semantics. This improves memory locality for hot qubits during gate application.
Summary:
Benchmark note: