Add IBM Z (s390x) support#1307
Conversation
|
We need to setup CI for this. @Andreas-Krebbel could you do that, probably based on how it's done for vsx? |
I can give it a try. Yes. |
c5da613 to
fccb073
Compare
|
I have tested the workflow locally and it seems to work fine. I see less testcases being executed though: |
serge-sans-paille
left a comment
There was a problem hiding this comment.
Some nit picking, just missing the runtime detection and we're good.
It also means we should improve CI to detect that...
| template <> | ||
| struct builtin_scalar<char> | ||
| { | ||
| using type = unsigned char; |
There was a problem hiding this comment.
could be using type = typename std::conditional<std::is_signed<char>::value, signed char, unsigned char>::type and that would avoid the #ifdef, right?
| template <class A, class T_in, class T_out> | ||
| XSIMD_INLINE batch<T_out, A> bitwise_cast(batch<T_in, A> const& self, batch<T_out, A> const&, requires_arch<vxe>) noexcept | ||
| { | ||
| return (typename batch<T_out, A>::register_type)(self.data); |
There was a problem hiding this comment.
nit: could be a static_cast, but we're not very diligent on this, so feel free to ignore.
| template <class A> | ||
| XSIMD_INLINE batch<float, A> complex_low(batch<std::complex<float>, A> const& self, requires_arch<vxe>) noexcept | ||
| { | ||
| uv16qi perm = (uv16qi) { 0, 1, 2, 3, 16, 17, 18, 19, 4, 5, 6, 7, 20, 21, 22, 23 }; |
There was a problem hiding this comment.
gcc constructor expression. that's a gnu extension, but I guess it's fine. I've been using it for PowerPC too.
| } | ||
| // round | ||
| // vec_round rounds ties to even instead of zero | ||
| #if defined __has_builtin && __has_builtin(__builtin_s390_vfi) |
There was a problem hiding this comment.
This seems to be supported on modern clang, good.
| ARCH_FIELD_EX(detail::rvv<128>, rvv128) | ||
| ARCH_FIELD(wasm) | ||
| ARCH_FIELD(vsx) | ||
| ARCH_FIELD(vxe) |
There was a problem hiding this comment.
you should also add a piece of code for runtime detection. See how it's done for power there: https://github.com/xtensor-stack/xsimd/blob/master/include/xsimd/config/xsimd_cpu_features_ppc.hpp
| // equivalent types. | ||
| XSIMD_DECLARE_SIMD_BOOL_VXE_REGISTER(signed char, signed char, char); | ||
| XSIMD_DECLARE_SIMD_BOOL_VXE_REGISTER(unsigned char, unsigned char, char); | ||
| #ifdef __CHAR_UNSIGNED__ |
There was a problem hiding this comment.
If you could avoid using a macro using a type alais instead, that would be cool.
This PR adds support for IBM Z. It leverages the compiler intrinsics available with GCC and Clang:
https://www.ibm.com/docs/en/open-xl-c-cpp-zos/2.2.0?topic=reference-vector-programming-support
The intrinsics are similar to what is available for IBM Power with altivec (VSX). I've started with an initial version of my patch before VSX has been added to XSIMD. However, while refreshing my changes to the latest upstream level I've used the VSX implementation as a base.
I've tested the patch on an IBM z17 (latest machine generation) with GCC and Clang: