Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PORTABLE_ALIGN<x> should use __declspec on MSVC #137

Open
Agritite opened this issue Nov 20, 2024 · 0 comments
Open

PORTABLE_ALIGN<x> should use __declspec on MSVC #137

Agritite opened this issue Nov 20, 2024 · 0 comments

Comments

@Agritite
Copy link

Agritite commented Nov 20, 2024

sqlite-vec/sqlite-vec.c

Lines 119 to 122 in ee36547

#ifdef SQLITE_VEC_ENABLE_AVX
#include <immintrin.h>
#define PORTABLE_ALIGN32 __attribute__((aligned(32)))
#define PORTABLE_ALIGN64 __attribute__((aligned(64)))

Currently this causes SQLITE_VEC_ENABLE_AVX to fail with MSVC

prolly should be something like:

#ifdef SQLITE_VEC_ENABLE_AVX
#include <immintrin.h>
#ifdef _MSC_VER // Visual Studio
#define PORTABLE_ALIGN32 __declspec(align(32))
#define PORTABLE_ALIGN64 __declspec(align(64))
#else
#define PORTABLE_ALIGN32 __attribute__((aligned(32)))
#define PORTABLE_ALIGN64 __attribute__((aligned(64)))
#endif

(this compiles on my computer with MSVC, and seems to function correctly with my dataset)

Or more elifdefs for other compilers I'm not aware of

I can submit PR if this fix is acceptable, or suggestions provided

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

No branches or pull requests

1 participant