Skip to content

Commit bc62c4f

Browse files
committed
fix illegal instruction crash
The avx512f flag causes the dsa-perf-micros to crash due to illegal instruction on platforms without avx512 support. Comment out the flag for now. Reviewed-by: Nirav N Shah <[email protected]> Signed-off-by: Nikhil Rao <[email protected]>
1 parent 15ff24e commit bc62c4f

File tree

2 files changed

+9
-12
lines changed

2 files changed

+9
-12
lines changed

configure.ac

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,5 @@ AC_INIT([dsa_perf_micros], 1.0)
22
AM_INIT_AUTOMAKE([foreign])
33
AC_SEARCH_LIBS(numa_max_node,numa,,AC_MSG_ERROR([unable to find libnuma. install the dependency package]),)
44
AC_PROG_CC
5-
CFLAGS+=" -mavx512f"
65
AC_CONFIG_FILES([Makefile src/Makefile])
76
AC_OUTPUT

src/cpu.c

Lines changed: 9 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -11,21 +11,19 @@
1111
#include "util.h"
1212
#include "cpu.h"
1313

14-
#pragma GCC push_options
15-
#pragma GCC optimize("O0")
1614
static inline void
1715
cmpval(char *buf, uint64_t len)
1816
{
19-
__m512i *b = (__m512i *)buf;
20-
__m512i *e = (__m512i *)(buf + len);
21-
22-
for (; b < e; b += 1) {
23-
const void *p = b;
24-
25-
_mm512_loadu_si512(p);
26-
}
17+
uint64_t nb_qword = len >> 3;
18+
volatile uint64_t *p8;
19+
uint64_t i;
20+
21+
/* TODO: add CPU specific optimized version e.g., AVX loads */
22+
p8 = (volatile uint64_t *)buf;
23+
for (i = 0; i < nb_qword; i++)
24+
if (p8[i] == 0 || true)
25+
continue;
2726
}
28-
#pragma GCC pop_options
2927

3028
static uint64_t
3129
memcmp1_8(const uint64_t *src1, const uint64_t *src2, uint64_t len)

0 commit comments

Comments
 (0)