-
Notifications
You must be signed in to change notification settings - Fork 89
Added windows cross compile builds & fixed build issues #169
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
base: main-dev
Are you sure you want to change the base?
Conversation
8279247
to
713afd3
Compare
Also added popcnt32 intrinsic support for win32.
Fixes issue with building MacOS universal2, as both the x86 and arm feature flags can be enabled at the same time.
@ashvardanian
Functions where this happens: Plus there are other places where the StringZilla/include/stringzilla/stringzilla.h Lines 3478 to 3487 in a34d836
Other functions it occurs in: So should all of these be changed to use Also should we be running the NumPy tests when building the python binaries? |
Hey @ashbob999! Those places require the unsigned integer to be 64 bit, so it shouldn't be changed. |
Although, if I have understood the That the And because the order pointer array is populated with the data ptr from a |
@ashvardanian what should I do about the warnings for the 32-builds (for the sorting functions)? |
@ashbob999, what's the cleanest way to reproduce some of those warnings/errors with GCC/Clang? It would be easier to choose a path forward if I can better understand their nature. |
Just building it as 32-bit ( For example the warning about converting the result of StringZilla/include/stringzilla/stringzilla.h Line 3162 in dd2b949
But only a very few actually get emitted (GCC). [1/2] Building CXX object CMakeFiles/stringzilla_test_cpp14.dir/scripts/test.cpp.o
In file included from /usr/include/c++/11/cassert:44,
from ../include/stringzilla/stringzilla.hpp:57,
from ../scripts/test.cpp:21:
../scripts/test.cpp: In function ‘void test_sequence_algorithms()’:
../scripts/test.cpp:1347:90: warning: conversion from ‘__gnu_cxx::__alloc_traits<std::allocator<long long unsigned int>, long long unsigned int>::value_type’ {aka ‘long long unsigned int’} to ‘std::vector<std::__cxx11::basic_string<char> >::size_type’ {aka ‘unsigned int’} may change value [-Wconversion]
1347 | for (std::size_t i = 1; i != dataset_size; ++i) { assert(dataset[order[i - 1]] <= dataset[order[i]]); }
| ^
../scripts/test.cpp:1347:111: warning: conversion from ‘__gnu_cxx::__alloc_traits<std::allocator<long long unsigned int>, long long unsigned int>::value_type’ {aka ‘long long unsigned int’} to ‘std::vector<std::__cxx11::basic_string<char> >::size_type’ {aka ‘unsigned int’} may change value [-Wconversion]
1347 | for (std::size_t i = 1; i != dataset_size; ++i) { assert(dataset[order[i - 1]] <= dataset[order[i]]); }
| ^
[2/2] Linking CXX executable stringzilla_test_cpp14 But for whatever reason (maybe my building of the 32-bit with GCC/Clang is broken) but if I build it as 64-bit but with |
I would stick to |
e3e8491
to
4ee87f4
Compare
Hey @ashbob999! I'll have more time to look into this next week. I want to thank you for following the git message style - it's very pleasing to see! Unlike most PRs, where I end up squashing the patches and merging under a new name, I would love to preserve your entire commit history. I'd just ask you to reformat/squash the last three commits that deviate from the style. Thanks again! |
@ashvardanian no problem, I purposely did not make them that way jsut because they were fixing issues that I noticed from previous commits in the merge. I can squash them into a single one, labelled as minor fixes (or equivalent), do you also want me to rebate to fix one in the middle a35cc50? |
e0a9e4e
to
c8c6c7c
Compare
Imported from #169 Co-authored-by: ashbob999 <32575256+ashbob999@users.noreply.github.com>
Imported from #169 Co-authored-by: ashbob999 <32575256+ashbob999@users.noreply.github.com>
|
1 similar comment
|
#ifdef _M_IX86 | ||
|
||
// 64-bit math operators for 32-bit systems | ||
void __declspec(naked) _allmul() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Incorrect function declaration. _allmul is a compiler intrinsic that must return ULONGLONG (64-bit unsigned integer), but it's declared as void. This could cause issues with the compiler's handling of the return value and potentially lead to runtime errors. The function should be declared as: 'ULONGLONG __declspec(naked) _allmul()'.
React with 👍 to tell me that this comment was useful, or 👎 if not (and I'll stop posting more comments like this in the future)
/* *INDENT-ON* */ | ||
} | ||
|
||
void __declspec(naked) _aullrem() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Incorrect function declaration. _aullrem is a compiler intrinsic that must return ULONGLONG (64-bit unsigned integer), but it's declared as void. This mismatched return type could cause improper handling of the remainder value in arithmetic operations. The function should be declared as: 'ULONGLONG __declspec(naked) _aullrem()'.
React with 👍 to tell me that this comment was useful, or 👎 if not (and I'll stop posting more comments like this in the future)
#else | ||
sz_u32_vec_t h_even_vec, h_odd_vec, n_vec, matches_even_vec, matches_odd_vec; | ||
n_vec.u32 = 0; | ||
n_vec.u8s[0] = n[0], n_vec.u8s[1] = n[1]; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Potential integer overflow and incorrect size handling in sz_fill_serial(). The multiplication of value by 0x0101010101010101ull assumes a 64-bit size_t. On 32-bit platforms, this will result in undefined behavior due to integer overflow, as sz_size_t would be 32-bit. This affects memory filling operations.
React with 👍 to tell me that this comment was useful, or 👎 if not (and I'll stop posting more comments like this in the future)
if (!h_length) return SZ_NULL_CHAR; | ||
sz_cptr_t const h_end = h + h_length; | ||
|
||
#if !SZ_DETECT_BIG_ENDIAN // Use SWAR only on little-endian platforms for brevety. | ||
#if !SZ_USE_MISALIGNED_LOADS // Process the misaligned head, to void UB on unaligned 64-bit loads. | ||
for (; ((sz_size_t)h & 7ull) && h < h_end; ++h) | ||
#if !SZ_USE_MISALIGNED_LOADS // Process the misaligned head, to void UB on unaligned 32/64 bit loads. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Incorrect comment indicates misaligned memory access prevention, but the code actually doesn't handle alignment properly for both 32-bit and 64-bit architectures, which could lead to undefined behavior on certain platforms. The alignment check should use sizeof(sz_size_t) consistently rather than hardcoded values.
React with 👍 to tell me that this comment was useful, or 👎 if not (and I'll stop posting more comments like this in the future)
😱 Found 4 issues. Time to roll up your sleeves! 😱 |
sz_u32_clz
which will help catch if the tests are run withoutBMI
support.release.yml
to build x86/x64/arm64 windows versions, and included the.lib
file in the archive.stringzillite
is built without any dependencies.