Skip to content

Add Windows ARM64 wheel support - #703

Open
ssss141414 wants to merge 2 commits into
spotify:mainfrom
ssss141414:win-arm64-1.17.3
Open

ssss141414 wants to merge 2 commits into
spotify:mainfrom
ssss141414:win-arm64-1.17.3

Conversation

@ssss141414

@ssss141414 ssss141414 commented Aug 21, 2026

Copy link
Copy Markdown

Summary

  • add native Windows ARM64 CI coverage for Python 3.11-3.13 on windows-11-arm
  • build win_arm64 wheels in the existing tag-triggered cibuildwheel release workflow
  • remove the obsolete nose build hook and stabilize two ARM64-exposed test behaviors

Local validation

  • built annoy-1.17.3-cp313-cp313-win_arm64.whl on native Windows ARM64
  • verified the extension PE machine is ARM64 (0xAA64)
  • clean-installed the wheel outside the source checkout and ran native functional smoke tests
  • ran the upstream test suite: 107 passed, 1 skipped

Publication behavior

The wheel is not committed to this repository and this PR does not publish to PyPI. The existing publish workflow remains tag-push-only; after merge, a maintainer-created release tag can build and publish the ARM64 wheel through the normal release path.

Comment thread src/annoylib.h
T pq = dot(x->v, y->v, f);
T ppqq = pp * qq;
if (ppqq > 0) return 2.0 - 2.0 * pq / sqrt(ppqq);
if (ppqq > 0) return memcmp(x->v, y->v, f * sizeof(T)) == 0 ? 0 : 2.0 - 2.0 * pq / sqrt(ppqq);

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Hi,

The annoylib.h change is needed because the existing angular-distance tests fail on native Windows ARM64 without it.

For two byte-identical vectors, the angular distance should be exactly zero. However, with the optimized MSVC ARM64 build, the dot product and cached norm can have slightly different floating-point rounding. As a result, this expression:

2.0 - 2.0 * pq / sqrt(pp * qq)

returns a small positive value instead of zero. The observed self-distances were approximately 0.0001957 and 0.0002183.

This causes the existing test_include_dists and test_include_dists_check_ranges tests to fail. The memcmp check only handles vectors with identical stored representations and returns the mathematically correct distance of zero before evaluating the floating-point formula.

Without this change, the Windows ARM64 wheel still builds and imports, but its native CI test suite reports 2 failures. With the change, those tests pass.

This is therefore a runtime correctness fix exposed by Windows ARM64 rather than a wheel-build configuration change. If preferred, it can be submitted as a separate prerequisite bug-fix PR, with the Windows ARM64 wheel PR depending on it.

Thank you!

@ssss141414

Copy link
Copy Markdown
Author

Hi annoy maintainers,

I'm from Microsoft and recently I'm working on improving Python ecosystem support for Windows on Arm. So I also adds CI support for Windows ARM64. Could you please help to review?

Thanks.

@ssss141414
ssss141414 marked this pull request as ready for review August 25, 2026 04:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant