Skip to content

Commit 45111b6

Browse files
committed
Add initial fixes to get MMseqs2 working on s390x
1 parent b1704cc commit 45111b6

File tree

3 files changed

+31
-2
lines changed

3 files changed

+31
-2
lines changed

CMakeLists.txt

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ set(HAVE_SSE2 0 CACHE BOOL "Have CPU with SSE2")
1515
set(HAVE_POWER9 0 CACHE BOOL "Have POWER9 CPU")
1616
set(HAVE_POWER8 0 CACHE BOOL "Have POWER8 CPU")
1717
set(HAVE_ARM8 0 CACHE BOOL "Have ARMv8 CPU")
18+
set(HAVE_S390X 0 CACHE BOOL "Have s390x architecture")
1819
set(NATIVE_ARCH 1 CACHE BOOL "Assume native architecture for SIMD. Use one of the HAVE_* options or set CMAKE_CXX_FLAGS to the appropriate flags if you disable this.")
1920
set(USE_SYSTEM_ZSTD 0 CACHE BOOL "Use zstd provided by system instead of bundled version")
2021

@@ -71,6 +72,9 @@ elseif (HAVE_POWER8)
7172
elseif (HAVE_ARM8)
7273
set(MMSEQS_ARCH "${MMSEQS_ARCH} -march=armv8-a+simd")
7374
set(ARM 1)
75+
elseif (HAVE_S390X)
76+
set(MMSEQS_ARCH "${MMSEQS_ARCH} -mzarch -march=z14")
77+
set(ZARCH 1)
7478
endif ()
7579

7680
if (NATIVE_ARCH AND (MMSEQS_ARCH STREQUAL ""))
@@ -82,6 +86,8 @@ if (NATIVE_ARCH AND (MMSEQS_ARCH STREQUAL ""))
8286
set(X64 1)
8387
elseif (CMAKE_SYSTEM_PROCESSOR MATCHES "x86|X86")
8488
set(X86 1)
89+
elseif(CMAKE_SYSTEM_PROCESSOR MATCHES "^s390")
90+
set(ZARCH 1)
8591
elseif(CMAKE_SYSTEM_PROCESSOR MATCHES "^sparc")
8692
set(SPARC 1)
8793
else ()
@@ -154,7 +160,7 @@ if ((CMAKE_CXX_COMPILER_ID STREQUAL "Clang" AND CMAKE_CXX_COMPILER_VERSION VERSI
154160
set(DISABLE_IPS4O 1)
155161
endif ()
156162

157-
if (PPC64 OR SPARC)
163+
if (PPC64 OR SPARC OR ZARCH)
158164
# FIXME: investigate why on ppc the regression seems to fail randomly
159165
set(DISABLE_IPS4O 1)
160166
endif ()

src/commons/Orf.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -207,7 +207,11 @@ inline bool isInCodons(const char* sequence, simd_int codons, simd_int) {
207207
// s: ATGA GTGA TGAT GAGT
208208
// c: ATGA ATGA ATGA ATGA
209209
simd_int c = simdi32_set(*(unsigned int*)sequence);
210+
#if SIMDE_ENDIAN_ORDER == SIMDE_ENDIAN_LITTLE
210211
simd_int mask = simdi32_set(0x00FFFFFF);
212+
#else
213+
simd_int mask = simdi32_set(0xFFFFFF00);
214+
#endif
211215
// c: ATG0 ATG0 ATG0 ATG0
212216
c = simdi_and(mask, c);
213217
// t: FFFF 0000 0000 0000

src/commons/itoa.h

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,26 @@ THE SOFTWARE.
2626
#include <cstdint>
2727

2828
#define SIMDE_ENABLE_NATIVE_ALIASES
29-
#include <simde/x86/sse2.h>
29+
#include <simde/simde-common.h>
3030

31+
#if SIMDE_ENDIAN_ORDER != SIMDE_ENDIAN_LITTLE
32+
class Itoa{
33+
public:
34+
static char* u32toa_sse2(uint32_t value, char* buffer) {
35+
return buffer + sprintf(buffer, "%d", value) + 1;
36+
}
37+
static char* i32toa_sse2(int32_t value, char* buffer) {
38+
return buffer + sprintf(buffer, "%d", value) + 1;
39+
}
40+
static char* u64toa_sse2(uint64_t value, char* buffer) {
41+
return buffer + sprintf(buffer, "%zu", value) + 1;
42+
}
43+
static char* i64toa_sse2(uint64_t value, char* buffer) {
44+
return buffer + sprintf(buffer, "%zu", value) + 1;
45+
}
46+
};
47+
#else
48+
#include <simde/x86/sse2.h>
3149
// FIXME: NEON throws many warnings due to the reinterpret casts
3250
#pragma GCC diagnostic push
3351
#pragma GCC diagnostic ignored "-Wstrict-aliasing"
@@ -309,3 +327,4 @@ class Itoa{
309327
#pragma GCC diagnostic pop
310328

311329
#endif
330+
#endif

0 commit comments

Comments
 (0)