Skip to content

Replace SSE3 intrinsics in Index2Layer with portable scalar code#5076

Open
algoriddle wants to merge 1 commit intofacebookresearch:mainfrom
algoriddle:export-D100144911
Open

Replace SSE3 intrinsics in Index2Layer with portable scalar code#5076
algoriddle wants to merge 1 commit intofacebookresearch:mainfrom
algoriddle:export-D100144911

Conversation

@algoriddle
Copy link
Copy Markdown
Contributor

Summary:
Index2Layer's distance computers (DistanceXPQ4, Distance2xXPQ4) used raw
SSE3 intrinsics guarded by #ifdef SSE3, with the #else branch throwing
"not implemented for non-x64 platforms". Since pq.dsub is always 4, the
inner loop is just 4 float ops per sub-vector — scalar code is simple and
the compiler will auto-vectorize it. This makes Index2Layer work on ARM
and removes the last raw SSE3 usage from the codebase.

Differential Revision: D100144911

Summary:
Index2Layer's distance computers (DistanceXPQ4, Distance2xXPQ4) used raw
SSE3 intrinsics guarded by #ifdef __SSE3__, with the #else branch throwing
"not implemented for non-x64 platforms". Since pq.dsub is always 4, the
inner loop is just 4 float ops per sub-vector — scalar code is simple and
the compiler will auto-vectorize it. This makes Index2Layer work on ARM
and removes the last raw SSE3 usage from the codebase.

Differential Revision: D100144911
@meta-cla meta-cla bot added the CLA Signed label Apr 10, 2026
@meta-codesync
Copy link
Copy Markdown
Contributor

meta-codesync bot commented Apr 10, 2026

@algoriddle has exported this pull request. If you are a Meta employee, you can view the originating Diff in D100144911.

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant