Skip to content

Commit

Permalink
Fixes to yEnc module (#117)
Browse files Browse the repository at this point in the history
* Fix RISC-V compile flags not being included
Fixes #116

* Fix ARM PMULL clearing declared CRC ISA

* Remove invalid CRC32 tests
See last point from #114

* Remove UNSUPPORTED_PLATFORM_ARM
Ref #114
  • Loading branch information
animetosho committed May 18, 2024
1 parent c085cb1 commit 5dfb7c7
Show file tree
Hide file tree
Showing 4 changed files with 3 additions and 16 deletions.
11 changes: 2 additions & 9 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -124,13 +124,6 @@ def build_extension(self, ext: Extension):
# Verify specific flags for ARM chips
# macOS M1 do not need any flags, they support everything
if IS_ARM and not IS_MACOS:
if not autoconf_check(self.compiler, include_check="sys/auxv.h"):
# We only tested this for GCC, might still be valid on MS-ARM compiler (see #38)
if autoconf_check(self.compiler, define_check="__GNUC__"):
log.info("==> On GGC and sys/auxv.h not available, setting UNSUPPORTED_PLATFORM_ARM=1")
ext.define_macros.append(("UNSUPPORTED_PLATFORM_ARM", "1"))
gcc_macros.append(("UNSUPPORTED_PLATFORM_ARM", "1"))
IS_ARM = False
if not autoconf_check(self.compiler, define_check="__aarch64__"):
log.info("==> __aarch64__ not available, disabling 64bit extensions")
IS_AARCH64 = False
Expand Down Expand Up @@ -288,12 +281,12 @@ def build_extension(self, ext: Extension):
{
"sources": ["src/yencode/encoder_rvv.cc", "src/yencode/decoder_rvv.cc"],
"depends": srcdeps_enc_common + srcdeps_dec_common,
"gcc_rv_flags": gcc_rvv_flags,
"gcc_flags": gcc_rvv_flags,
},
{
"sources": ["src/yencode/crc_riscv.cc"],
"depends": srcdeps_crc_common,
"gcc_rv_flags": gcc_rvzbkc_flags,
"gcc_flags": gcc_rvzbkc_flags,
},
{
"sources": [
Expand Down
4 changes: 0 additions & 4 deletions src/yencode/common.h
Original file line number Diff line number Diff line change
Expand Up @@ -34,10 +34,6 @@
#define PLATFORM_ARM 1
#endif

#if defined(UNSUPPORTED_PLATFORM_ARM)
#undef PLATFORM_ARM
#endif

#include <stdlib.h>
#if defined(_MSC_VER) || defined(__MINGW32__) || defined(__MINGW64__)
// MSVC doesn't support C11 aligned_alloc: https://stackoverflow.com/a/62963007
Expand Down
2 changes: 1 addition & 1 deletion src/yencode/crc_arm_pmull.cc
Original file line number Diff line number Diff line change
Expand Up @@ -207,7 +207,7 @@ static uint32_t crc32_shift_pmull(uint32_t crc1, uint32_t n) {
void RapidYenc::crc_pmull_set_funcs() {
_crc32_multiply = &crc32_multiply_pmull;
_crc32_shift = &crc32_shift_pmull;
_crc32_isa &= ISA_FEATURE_PMULL;
_crc32_isa |= ISA_FEATURE_PMULL;
}

#else
Expand Down
2 changes: 0 additions & 2 deletions tests/test_crc32.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,6 @@
(0, 4294967295, 0, 4294967295),
(4294967295, 4294967295, 0, 0),
(4, 16, 256, 2385497022),
(18446744073709551615, 0, 0, 4294967295),
(18446744073709551615, 18446744073709551615, 0, 0),
(100, 200, 300, 1009376567),
(0, 0, 18446744073709551615, 0),
(4294967295, 4294967295, 18446744073709551615, 0),
Expand Down

0 comments on commit 5dfb7c7

Please sign in to comment.