Skip to content

Add NEON simulator and statespace headers#1050

Open
xxie24 wants to merge 4 commits intoquantumlib:mainfrom
xxie24:add-neon
Open

Add NEON simulator and statespace headers#1050
xxie24 wants to merge 4 commits intoquantumlib:mainfrom
xxie24:add-neon

Conversation

@xxie24
Copy link
Copy Markdown

@xxie24 xxie24 commented Apr 20, 2026

This PR adds initial ARM NEON integration by introducing:

  • lib/simulator_neon.h
  • lib/statespace_neon.h
  • lib/simmux.h dispatch updates for __ARM_NEON__

Notes:

  • The NEON headers are ARM-NEON-only and use __ARM_NEON__.
  • Naming and public structure were aligned with the SSE counterparts.

@github-actions github-actions Bot added the size: XL lines changed >1000 label Apr 20, 2026
Copy link
Copy Markdown
Contributor

@gemini-code-assist gemini-code-assist Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request introduces NEON vectorization support for the quantum circuit simulator, including a new SimulatorNEON class and a corresponding StateSpaceNEON implementation. The feedback identifies a critical type safety issue where a template parameter could lead to compilation errors and suggests using existing vectorized methods for state norm calculations to improve performance.

Comment thread lib/simulator_neon.h Outdated
Comment thread lib/simulator_neon.h Outdated
Comment thread lib/simulator_neon.h Outdated
Comment thread lib/statespace_neon.h Outdated
@xxie24 xxie24 force-pushed the add-neon branch 4 times, most recently from 7b7e2e8 to 3b6accd Compare April 20, 2026 22:01
@xxie24 xxie24 changed the title Add NEON simulator and statespace headers WIP: Add NEON simulator and statespace headers Apr 20, 2026
@xxie24 xxie24 changed the title WIP: Add NEON simulator and statespace headers Add NEON simulator and statespace headers Apr 28, 2026
@sergeisakov sergeisakov self-requested a review May 4, 2026 14:55
Copy link
Copy Markdown
Collaborator

@sergeisakov sergeisakov left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for adding this. In general, it looks good to me. I have just two minor requests.

Comment thread lib/simulator_neon.h
return 0;
}

static unsigned SIMDRegisterSize() { return 4; }
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you format this function as

  /**
   * @return The size of SIMD register if applicable.
   */
  static unsigned SIMDRegisterSize() {
    return 4;
  }

Comment thread lib/simulator_neon.h

using Op = std::plus<std::complex<double>>;
return for_.RunReduce(size, f, Op(), w, ms, xss, qs[0], state.get());
}
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you add an empty line between } and For for_;?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size: XL lines changed >1000

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants