GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — MAINT: Fix for segfaults with GCC 15 · charris/numpy@01db43d

File tree

Expand file treeCollapse file tree
Open diff view settings
Filter options
  • numpy/_core
    • include/numpy
      • npy_cpu.h
    • src/multiarray
      • common.h
      • compiled_base.c
      • item_selection.c
      • lowlevel_strided_loops.c.src
Expand file treeCollapse file tree
Open diff view settings
Collapse file

‎numpy/_core/include/numpy/npy_cpu.h‎

Copy file name to clipboardExpand all lines: numpy/_core/include/numpy/npy_cpu.h
-12Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -120,16 +120,4 @@
120120
information about your platform (OS, CPU and compiler)
121121
#endif
122122

123-
/*
124-
* Except for the following architectures, memory access is limited to the natural
125-
* alignment of data types otherwise it may lead to bus error or performance regression.
126-
* For more details about unaligned access, see https://www.kernel.org/doc/Documentation/unaligned-memory-access.txt.
127-
*/
128-
#if defined(NPY_CPU_X86) || defined(NPY_CPU_AMD64) || defined(__aarch64__) || defined(__powerpc64__)
129-
#define NPY_ALIGNMENT_REQUIRED 0
130-
#endif
131-
#ifndef NPY_ALIGNMENT_REQUIRED
132-
#define NPY_ALIGNMENT_REQUIRED 1
133-
#endif
134-
135123
#endif /* NUMPY_CORE_INCLUDE_NUMPY_NPY_CPU_H_ */
Collapse file

‎numpy/_core/src/multiarray/common.h‎

Copy file name to clipboardExpand all lines: numpy/_core/src/multiarray/common.h
-23Lines changed: 0 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -230,15 +230,6 @@ npy_uint_alignment(int itemsize)
230230
* compared to memchr it returns one stride past end instead of NULL if needle
231231
* is not found.
232232
*/
233-
#ifdef __clang__
234-
/*
235-
* The code below currently makes use of !NPY_ALIGNMENT_REQUIRED, which
236-
* should be OK but causes the clang sanitizer to warn. It may make
237-
* sense to modify the code to avoid this "unaligned" access but
238-
* it would be good to carefully check the performance changes.
239-
*/
240-
__attribute__((no_sanitize("alignment")))
241-
#endif
242233
static inline char *
243234
npy_memchr(char * haystack, char needle,
244235
npy_intp stride, npy_intp size, npy_intp * psubloopsize, int invert)
@@ -258,20 +249,6 @@ npy_memchr(char * haystack, char needle,
258249
}
259250
}
260251
else {
261-
/* usually find elements to skip path */
262-
if (!NPY_ALIGNMENT_REQUIRED && needle == 0 && stride == 1) {
263-
/* iterate until last multiple of 4 */
264-
char * block_end = haystack + size - (size % sizeof(unsigned int));
265-
while (p < block_end) {
266-
unsigned int v = *(unsigned int*)p;
267-
if (v != 0) {
268-
break;
269-
}
270-
p += sizeof(unsigned int);
271-
}
272-
/* handle rest */
273-
subloopsize = (p - haystack);
274-
}
275252
while (subloopsize < size && *p == needle) {
276253
subloopsize++;
277254
p += stride;
Collapse file

‎numpy/_core/src/multiarray/compiled_base.c‎

Copy file name to clipboardExpand all lines: numpy/_core/src/multiarray/compiled_base.c
+1-2Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1620,8 +1620,7 @@ pack_inner(const char *inptr,
16201620
bb[1] = npyv_tobits_b8(npyv_cmpneq_u8(v1, v_zero));
16211621
bb[2] = npyv_tobits_b8(npyv_cmpneq_u8(v2, v_zero));
16221622
bb[3] = npyv_tobits_b8(npyv_cmpneq_u8(v3, v_zero));
1623-
if(out_stride == 1 &&
1624-
(!NPY_ALIGNMENT_REQUIRED || isAligned)) {
1623+
if(out_stride == 1 && isAligned) {
16251624
npy_uint64 *ptr64 = (npy_uint64*)outptr;
16261625
#if NPY_SIMD_WIDTH == 16
16271626
npy_uint64 bcomp = bb[0] | (bb[1] << 16) | (bb[2] << 32) | (bb[3] << 48);
Collapse file

‎numpy/_core/src/multiarray/item_selection.c‎

Copy file name to clipboardExpand all lines: numpy/_core/src/multiarray/item_selection.c
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2525,7 +2525,7 @@ count_nonzero_u8(const char *data, npy_intp bstride, npy_uintp len)
25252525
len -= len_m;
25262526
count = len_m - zcount;
25272527
#else
2528-
if (!NPY_ALIGNMENT_REQUIRED || npy_is_aligned(data, sizeof(npy_uint64))) {
2528+
if (npy_is_aligned(data, sizeof(npy_uint64))) {
25292529
int step = 6 * sizeof(npy_uint64);
25302530
int left_bytes = len % step;
25312531
for (const char *end = data + len; data < end - left_bytes; data += step) {
Collapse file

‎numpy/_core/src/multiarray/lowlevel_strided_loops.c.src‎

Copy file name to clipboardExpand all lines: numpy/_core/src/multiarray/lowlevel_strided_loops.c.src
+1-5Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -33,11 +33,7 @@
3333
* instructions (16 byte).
3434
* So this flag can only be enabled if autovectorization is disabled.
3535
*/
36-
#if NPY_ALIGNMENT_REQUIRED
37-
# define NPY_USE_UNALIGNED_ACCESS 0
38-
#else
39-
# define NPY_USE_UNALIGNED_ACCESS 0
40-
#endif
36+
#define NPY_USE_UNALIGNED_ACCESS 0
4137

4238
#define _NPY_NOP1(x) (x)
4339
#define _NPY_NOP2(x) (x)

0 commit comments

Comments
0 (0)
You are visitor 01402792 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.