Skip to content

Commit ba1e504

Browse files
committed
BUG: Fix build on ppc64 when the baseline set to Power9 or higher
Backport of numpy#24806. This backport was already made in numpy#25083, but that didn't make use of the linux_qemu.yml action, so this tweaks it a bit.
1 parent 882a5a0 commit ba1e504

File tree

5 files changed

+23
-12
lines changed

5 files changed

+23
-12
lines changed

.github/workflows/linux_qemu.yml

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,9 @@ concurrency:
2323
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
2424
cancel-in-progress: true
2525

26+
permissions:
27+
contents: read
28+
2629
jobs:
2730
linux_qemu:
2831
if: "github.repository == 'numpy/numpy'"
@@ -48,6 +51,13 @@ jobs:
4851
"-Dallow-noblas=true",
4952
"test_kind or test_multiarray or test_simd or test_umath or test_ufunc",
5053
]
54+
- [
55+
"ppc64le - baseline(Power9)",
56+
"powerpc64le-linux-gnu",
57+
"ppc64le/ubuntu:22.04",
58+
"-Dallow-noblas=true -Dcpu-baseline=vsx3",
59+
"test_kind or test_multiarray or test_simd or test_umath or test_ufunc",
60+
]
5161
- [
5262
"s390x",
5363
"s390x-linux-gnu",
@@ -74,7 +84,7 @@ jobs:
7484

7585
name: "${{ matrix.BUILD_PROP[0] }}"
7686
steps:
77-
- uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # v3.5.3
87+
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
7888
with:
7989
submodules: recursive
8090
fetch-depth: 0

meson_cpu/ppc64/meson.build

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ VSX3 = mod_features.new(
3333
VSX4 = mod_features.new(
3434
'VSX4', 4, implies: VSX3, args: {'val': '-mcpu=power10', 'match': '.*[mcpu=|vsx].*'},
3535
detect: {'val': 'VSX4', 'match': 'VSX.*'},
36-
test_code: files(source_root + '/numpy/distutils/checks/cpu_vsx3.c')[0],
36+
test_code: files(source_root + '/numpy/distutils/checks/cpu_vsx4.c')[0],
3737
extra_tests: {
3838
'VSX4_MMA': files(source_root + '/numpy/distutils/checks/extra_vsx4_mma.c')[0]
3939
}

numpy/core/src/common/half.hpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ class Half final {
4747
/// Default constructor. initialize nothing.
4848
Half() = default;
4949

50-
/// Constract from float
50+
/// Construct from float
5151
/// If there are no hardware optimization available, rounding will always
5252
/// be set to ties to even.
5353
explicit Half(float f)
@@ -118,7 +118,7 @@ class Half final {
118118
#endif
119119
}
120120

121-
/// Returns a new Half constracted from the IEEE 754 binary16.
121+
/// Returns a new Half constructed from the IEEE 754 binary16.
122122
static constexpr Half FromBits(uint16_t bits)
123123
{
124124
Half h{};
@@ -131,7 +131,7 @@ class Half final {
131131
return bits_;
132132
}
133133

134-
/// @name Comparison operators (orderd)
134+
/// @name Comparison operators (ordered)
135135
/// @{
136136
constexpr bool operator==(Half r) const
137137
{
@@ -155,7 +155,7 @@ class Half final {
155155
}
156156
/// @}
157157

158-
/// @name Comparison operators (unorderd)
158+
/// @name Comparison operators (unordered)
159159
/// @{
160160
constexpr bool operator!=(Half r) const
161161
{

numpy/core/tests/test_half.py

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -274,17 +274,17 @@ def test_half_correctness(self):
274274
if len(a32_fail) != 0:
275275
bad_index = a32_fail[0]
276276
assert_equal(self.finite_f32, a_manual,
277-
"First non-equal is half value %x -> %g != %g" %
278-
(self.finite_f16[bad_index],
277+
"First non-equal is half value 0x%x -> %g != %g" %
278+
(a_bits[bad_index],
279279
self.finite_f32[bad_index],
280280
a_manual[bad_index]))
281281

282282
a64_fail = np.nonzero(self.finite_f64 != a_manual)[0]
283283
if len(a64_fail) != 0:
284284
bad_index = a64_fail[0]
285285
assert_equal(self.finite_f64, a_manual,
286-
"First non-equal is half value %x -> %g != %g" %
287-
(self.finite_f16[bad_index],
286+
"First non-equal is half value 0x%x -> %g != %g" %
287+
(a_bits[bad_index],
288288
self.finite_f64[bad_index],
289289
a_manual[bad_index]))
290290

@@ -327,7 +327,8 @@ def test_half_funcs(self):
327327
a = np.array([0, 0, -1, -1/1e20, 0, 2.0**-24, 7.629e-6], dtype=float16)
328328
assert_equal(a.nonzero()[0],
329329
[2, 5, 6])
330-
a = a.byteswap().newbyteorder()
330+
a = a.byteswap()
331+
a = a.view(a.dtype.newbyteorder())
331332
assert_equal(a.nonzero()[0],
332333
[2, 5, 6])
333334

numpy/distutils/ccompiler_opt.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1309,7 +1309,7 @@ def feature_names(self, names=None, force_flags=None, macros=[]):
13091309
def feature_is_exist(self, name):
13101310
"""
13111311
Returns True if a certain feature is exist and covered within
1312-
`_Config.conf_features`.
1312+
``_Config.conf_features``.
13131313
13141314
Parameters
13151315
----------

0 commit comments

Comments
 (0)