8000 BUG: Resolve build issue on ppc64 with Power9 or higher as baseline · numpy/numpy@0e81137 · GitHub
[go: up one dir, main page]

Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 0e81137

Browse files
committed
BUG: Resolve build issue on ppc64 with Power9 or higher as baseline
This fix addresses two issues: * Corrects the use of unsupported instructions by the assembler in half-precision to double-precision conversion. * Resolves a code error related to variable naming during conversion.
1 parent 3c083c9 commit 0e81137

File tree

1 file changed

+9
-12
lines changed

1 file changed

+9
-12
lines changed

numpy/_core/src/common/half.hpp

Lines changed: 9 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -73,11 +73,8 @@ class Half final {
7373
#if defined(NPY_HAVE_AVX512FP16)
7474
__m128d md = _mm_load_sd(&f);
7575
bits_ = static_cast<uint16_t>(_mm_cvtsi128_si32(_mm_castph_si128(_mm_cvtpd_ph(md))));
76-
#elif defined(NPY_HAVE_VSX3) && defined(NPY_HAVE_VSX_ASM)
77-
__vector double vf64 = vec_splats(f);
78-
__vector unsigned short vf16;
79-
__asm__ __volatile__ ("xvcvdphp %x0,%x1" : "=wa" (vf16) : "wa" (vf64));
80-
bits_ = vec_extract(vf16, 0);
76+
#elif defined(NPY_HAVE_VSX3) && defined(NPY_HAVE_VSX3_HALF_DOUBLE)
77+
__asm__ __volatile__ ("xscvdphp %x0,%x1" : "=wa" (bits_) : "wa" (f));
8178
#else
8279
bits_ = half_private::FromDoubleBits(BitCast<uint64_t>(f));
8380
#endif
@@ -96,7 +93,7 @@ class Half final {
9693
__vector float vf32;
9794
__asm__ __volatile__("xvcvhpsp %x0,%x1"
9895
: "=wa"(vf32)
99-
: "wa"(vec_splats(bits_.u)));
96+
: "wa"(vec_splats(bits_)));
10097
return vec_extract(vf32, 0);
10198
#else
10299
return BitCast<float>(half_private::ToFloatBits(bits_));
@@ -110,12 +107,12 @@ class Half final {
110107
double ret;
111108
_mm_store_sd(&ret, _mm_cvtph_pd(_mm_castsi128_ph(_mm_cvtsi32_si128(bits_))));
112109
return ret;
113-
#elif defined(NPY_HAVE_VSX3) && defined(NPY_HAVE_VSX_ASM)
114-
__vector float vf64;
115-
__asm__ __volatile__("xvcvhpdp %x0,%x1"
116-
: "=wa"(vf32)
117-
: "wa"(vec_splats(bits_)));
118-
return vec_extract(vf64, 0);
110+
#elif defined(NPY_HAVE_VSX3) && defined(NPY_HAVE_VSX3_HALF_DOUBLE)
111+
double f64;
112+
__asm__ __volatile__("xscvhpdp %x0,%x1"
113+
: "=wa"(f64)
114+
: "wa"(bits_));
115+
return f64;
119116
#else
120117
return BitCast<double>(half_private::ToDoubleBits(bits_));
121118
#endif

0 commit comments

Comments
 (0)
0