Skip to content

Commit

Permalink
temp
Browse files Browse the repository at this point in the history
  • Loading branch information
ashbob999 committed Sep 21, 2024
1 parent 29f9bb4 commit 713afd3
Show file tree
Hide file tree
Showing 4 changed files with 74 additions and 11 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/prerelease.yml
Original file line number Diff line number Diff line change
Expand Up @@ -323,7 +323,7 @@ jobs:
run: |
python -m pip install --upgrade pip
pip install pytest pytest-repeat numpy pyarrow
python -m pip install .
python -m pip install . -vv
- name: Test Python
run: pytest scripts/test.py -s -x

Expand Down
68 changes: 61 additions & 7 deletions include/stringzilla/stringzilla.h
Original file line number Diff line number Diff line change
Expand Up @@ -1106,50 +1106,104 @@ SZ_PUBLIC void sz_sort_intro(sz_sequence_t *sequence, sz_sequence_comparator_t l
* All of those can be controlled by the user.
*/
#ifndef SZ_USE_X86_AVX512
#ifdef __AVX512BW__
#if defined(__AVX512BW__) //&& SZ_TARGET_X86
#define SZ_USE_X86_AVX512 1
#pragma message("SZ_USE_X86_AVX512")
#else
#define SZ_USE_X86_AVX512 0
#pragma message("NOT SZ_USE_X86_AVX512")
#endif
#endif

#ifndef SZ_USE_X86_AVX2
#ifdef __AVX2__
#if defined(__AVX2__) //&& SZ_TARGET_X86
#define SZ_USE_X86_AVX2 1
#pragma message("SZ_USE_X86_AVX2")
#else
#define SZ_USE_X86_AVX2 0
#pragma message("NOT SZ_USE_X86_AVX2")
#endif
#endif

#ifndef SZ_USE_ARM_NEON
#if defined(__ARM_NEON) || defined(_M_ARM64)
#if (defined(__ARM_NEON) || defined(_M_ARM64))// && SZ_TARGET_ARM
#define SZ_USE_ARM_NEON 1
#pragma message("SZ_USE_ARM_NEON")
#else
#define SZ_USE_ARM_NEON 0
#pragma message("NOT SZ_USE_ARM_NEON")
#endif
#endif

#ifndef SZ_USE_ARM_SVE
#if defined(__ARM_FEATURE_SVE)
#if defined(__ARM_FEATURE_SVE)// && SZ_TARGET_ARM
#define SZ_USE_ARM_SVE 1
#pragma message("SZ_USE_ARM_SVE")
#else
#define SZ_USE_ARM_SVE 0
#pragma message("NOT SZ_USE_ARM_SVE")
#endif
#endif

#if 0
#ifndef SZ_TARGET_ARM
#if defined(__arm__) || defined(__aarch64__) || defined(_M_ARM) || defined(_M_ARM64)
#define SZ_TARGET_ARM 1
#pragma message("SZ_TARGET_ARM")
#else
#define SZ_TARGET_ARM 0
#pragma message("NOT SZ_TARGET_ARM")
#endif
#endif

#ifndef SZ_TARGET_X86
#if defined(__i386__) || defined(__amd64__) || defined(_M_IX86) || defined(_M_AMD64)
#define SZ_TARGET_X86 1
#pragma message("SZ_TARGET_X86")
#else
#define SZ_TARGET_X86 0
#pragma message("NOT SZ_TARGET_X86")
#endif
#endif
#endif

#ifndef SZ_TARGET_X86
#if !(defined(__i386__) || defined(__amd64__) || defined(_M_IX86) || defined(_M_AMD64))
#undef SZ_USE_X86_AVX2
#define SZ_USE_X86_AVX2 0
#undef SZ_USE_X86_AVX512
#define SZ_USE_X86_AVX512 0
#pragma message("NOT SZ_TARGET_X86")
#else
#pragma message("SZ_TARGET_X86")
#endif
#endif

#ifndef SZ_TARGET_ARM
#if !(defined(__arm__) || defined(__aarch64__) || defined(_M_ARM) || defined(_M_ARM64))
#undef SZ_USE_ARM_NEON
#define SZ_USE_ARM_NEON 0
#undef SZ_USE_ARM_SVE
#define SZ_USE_ARM_SVE 0
#pragma message("NOT SZ_TARGET_ARM")
#else
#pragma message("SZ_TARGET_ARM")
#endif
#endif

/*
* Include hardware-specific headers.
*/
#if SZ_USE_X86_AVX512 || SZ_USE_X86_AVX2
#if (SZ_USE_X86_AVX512 || SZ_USE_X86_AVX2)// && SZ_TARGET_X86
#include <immintrin.h>
#endif // SZ_USE_X86...
#if SZ_USE_ARM_NEON
#if SZ_USE_ARM_NEON// && SZ_TARGET_ARM
#if !defined(_MSC_VER)
#include <arm_acle.h>
#endif
#include <arm_neon.h>
#endif // SZ_USE_ARM_NEON
#if SZ_USE_ARM_SVE
#if SZ_USE_ARM_SVE// && SZ_TARGET_ARM
#if !defined(_MSC_VER)
#include <arm_sve.h>
#endif
Expand Down
6 changes: 6 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -116,3 +116,9 @@ environment.SZ_ARM64="1"
select = "*-macos*_arm64"
inherit.environment = "append"
environment.SZ_ARM64="1"

[[tool.cibuildwheel.overrides]]
select = "*-macos*_universal2"
inherit.environment = "append"
environment.SZ_X86_64="1"
environment.SZ_ARM64="1"
9 changes: 6 additions & 3 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -80,16 +80,19 @@ def darwin_settings() -> Tuple[List[str], List[str], List[Tuple[str]]]:
"-fPIC", # to enable dynamic dispatch
]

print("system", sysconfig.get_platform())

# Apple Clang doesn't support the `-march=native` argument,
# so we must pre-set the CPU generation. Technically the last Intel-based Apple
# product was the 2021 MacBook Pro, which had the "Coffee Lake" architecture.
# During Universal builds, however, even AVX header cause compilation errors.
can_use_avx2 = is_64bit_x86() and sysconfig.get_platform().startswith("universal")
is_building_x86 = is_64bit_x86() and "universal" in sysconfig.get_platform()
is_building_arm = is_64bit_arm() and "universal" in sysconfig.get_platform()
macros_args = [
("SZ_USE_X86_AVX512", "0"),
("SZ_USE_X86_AVX2", "1" if can_use_avx2 else "0"),
("SZ_USE_X86_AVX2", "1" if is_building_x86 else "0"),
("SZ_USE_ARM_SVE", "0"),
("SZ_USE_ARM_NEON", "1" if is_64bit_arm() else "0"),
("SZ_USE_ARM_NEON", "1" if is_building_arm else "0"),
]

return compile_args, link_args, macros_args
Expand Down

0 comments on commit 713afd3

Please sign in to comment.