Skip to content

Commit

Permalink
pmem2: enable movdir64b compilation but disable it in the runtime
Browse files Browse the repository at this point in the history
  • Loading branch information
lplewa committed Aug 5, 2022
1 parent 91f4159 commit 29c453f
Show file tree
Hide file tree
Showing 20 changed files with 68 additions and 157 deletions.
4 changes: 2 additions & 2 deletions src/libpmem2/x86_64/init.c
Original file line number Diff line number Diff line change
Expand Up @@ -419,7 +419,7 @@ use_avx512f_memcpy_memset(struct pmem2_arch_info *info,

/*
* use_movdir64b_memcpy_memset -- (internal) movdir64b detected, use it if
* possible
* enabled by environment variable
*/
static void
use_movdir64b_memcpy_memset(struct pmem2_arch_info *info,
Expand All @@ -429,7 +429,7 @@ use_movdir64b_memcpy_memset(struct pmem2_arch_info *info,
LOG(3, "movdir64b supported");

char *e = os_getenv("PMEM_MOVDIR64B");
if (e != NULL && strcmp(e, "0") == 0) {
if (e == NULL || strcmp(e, "0") == 0) {
LOG(3, "PMEM_MOVDIR64B set to 0");
return;
}
Expand Down
4 changes: 2 additions & 2 deletions src/libpmem2/x86_64/memset/memset_movdir64b.h
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
/* SPDX-License-Identifier: BSD-3-Clause */
/* Copyright 2022, Intel Corporation */

#ifndef PMEM2_MEMSET_AVX512F_H
#define PMEM2_MEMSET_AVX512F_H
#ifndef PMEM2_MEMSET_MOVDIR64B_H
#define PMEM2_MEMSET_MOVDIR64B_H

#include <stddef.h>

Expand Down
1 change: 0 additions & 1 deletion src/libpmem2/x86_64/sources.inc
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@ endif
MOVDIR64B_PROG="\#include <immintrin.h>\n\#include <stdint.h>\nint main(){ uint64_t v, w; _movdir64b(&v, &w); return 0;}"
MOVDIR64B_AVAILABLE := $(shell printf $(MOVDIR64B_PROG) |\
$(CC) $(CFLAGS) -x c -mmovdir64b -o /dev/null - 2>/dev/null && echo y || echo n)
MOVDIR64B_AVAILABLE=n # XXX delete this when movdir64b is ready to be upstreamed

ifeq ($(MOVDIR64B_AVAILABLE), y)
LIBPMEM2_ARCH_SOURCE += \
Expand Down
28 changes: 8 additions & 20 deletions src/test/pmem2_memcpy/TESTS.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,41 +52,29 @@ class TEST0(Pmem2Memcpy):
pass


@t.require_architectures('x86_64')
@t.add_params('wc_workaround', ['on', 'off', 'default'])
class TEST1(Pmem2Memcpy):
envs0 = ("PMEM_AVX512F",)


@t.require_architectures('x86_64')
@t.add_params('wc_workaround', ['on', 'off', 'default'])
class TEST2(Pmem2Memcpy):
envs0 = ("PMEM_AVX512F", "PMEM_AVX",)


@t.add_params('wc_workaround', ['default'])
class TEST3(Pmem2Memcpy):
class TEST1(Pmem2Memcpy):
envs1 = ("PMEM_NO_MOVNT",)


@t.add_params('wc_workaround', ['default'])
class TEST4(Pmem2Memcpy):
class TEST2(Pmem2Memcpy):
envs1 = ("PMEM_NO_MOVNT", "PMEM_NO_GENERIC_MEMCPY")


@t.require_architectures('x86_64')
@t.add_params('wc_workaround', ['on', 'off', 'default'])
class TEST5(Pmem2Memcpy):
envs0 = ("PMEM_MOVDIR64B",)
class TEST3(Pmem2Memcpy):
envs0 = ("PMEM_AVX512F",)


@t.require_architectures('x86_64')
@t.add_params('wc_workaround', ['on', 'off', 'default'])
class TEST6(Pmem2Memcpy):
envs0 = ("PMEM_MOVDIR64B", "PMEM_AVX512F",)
class TEST4(Pmem2Memcpy):
envs0 = ("PMEM_AVX512F", "PMEM_AVX",)


@t.require_architectures('x86_64')
@t.add_params('wc_workaround', ['on', 'off', 'default'])
class TEST7(Pmem2Memcpy):
envs0 = ("PMEM_MOVDIR64B", "PMEM_AVX512F", "PMEM_AVX",)
class TEST5(Pmem2Memcpy):
envs1 = ("PMEM_MOVDIR64B",)
28 changes: 8 additions & 20 deletions src/test/pmem2_memset/TESTS.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,41 +42,29 @@ class TEST0(Pmem2Memset):
pass


@t.require_architectures('x86_64')
@t.add_params('wc_workaround', ['on', 'off', 'default'])
class TEST1(Pmem2Memset):
envs0 = ("PMEM_AVX512F",)


@t.require_architectures('x86_64')
@t.add_params('wc_workaround', ['on', 'off', 'default'])
class TEST2(Pmem2Memset):
envs0 = ("PMEM_AVX512F", "PMEM_AVX",)


@t.add_params('wc_workaround', ['default'])
class TEST3(Pmem2Memset):
class TEST1(Pmem2Memset):
envs1 = ("PMEM_NO_MOVNT",)


@t.add_params('wc_workaround', ['default'])
class TEST4(Pmem2Memset):
class TEST2(Pmem2Memset):
envs1 = ("PMEM_NO_MOVNT", "PMEM_NO_GENERIC_MEMCPY")


@t.require_architectures('x86_64')
@t.add_params('wc_workaround', ['on', 'off', 'default'])
class TEST5(Pmem2Memset):
envs0 = ("PMEM_MOVDIR64B",)
class TEST3(Pmem2Memset):
envs0 = ("PMEM_AVX512F",)


@t.require_architectures('x86_64')
@t.add_params('wc_workaround', ['on', 'off', 'default'])
class TEST6(Pmem2Memset):
envs0 = ("PMEM_MOVDIR64B", "PMEM_AVX512F",)
class TEST4(Pmem2Memset):
envs0 = ("PMEM_AVX512F", "PMEM_AVX",)


@t.require_architectures('x86_64')
@t.add_params('wc_workaround', ['on', 'off', 'default'])
class TEST7(Pmem2Memset):
envs0 = ("PMEM_MOVDIR64B", "PMEM_AVX512F", "PMEM_AVX",)
class TEST5(Pmem2Memset):
envs1 = ("PMEM_MOVDIR64B",)
26 changes: 8 additions & 18 deletions src/test/pmem2_movnt/TESTS.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,24 +36,14 @@ class TEST0(Pmem2Movnt):
pass


@t.require_architectures('x86_64')
class TEST1(Pmem2Movnt):
envs0 = ("PMEM_AVX512F",)


@t.require_architectures('x86_64')
class TEST2(Pmem2Movnt):
envs0 = ("PMEM_AVX512F", "PMEM_AVX",)


class TEST3(Pmem2MovntCommon):
class TEST1(Pmem2MovntCommon):
def run(self, ctx):
super().create_file(ctx)
ctx.env['PMEM_NO_MOVNT'] = '1'
ctx.exec('pmem2_movnt', self.filepath)


class TEST4(Pmem2MovntCommon):
class TEST2(Pmem2MovntCommon):
def run(self, ctx):
super().create_file(ctx)
ctx.env['PMEM_NO_MOVNT'] = '1'
Expand All @@ -62,15 +52,15 @@ def run(self, ctx):


@t.require_architectures('x86_64')
class TEST5(Pmem2Movnt):
envs0 = ("PMEM_MOVDIR64B",)
class TEST3(Pmem2Movnt):
envs0 = ("PMEM_AVX512F",)


@t.require_architectures('x86_64')
class TEST6(Pmem2Movnt):
envs0 = ("PMEM_MOVDIR64B", "PMEM_AVX512F",)
class TEST4(Pmem2Movnt):
envs0 = ("PMEM_AVX512F", "PMEM_AVX",)


@t.require_architectures('x86_64')
class TEST7(Pmem2Movnt):
envs0 = ("PMEM_MOVDIR64B", "PMEM_AVX512F", "PMEM_AVX",)
class TEST5(Pmem2Movnt):
envs1 = ("PMEM_MOVDIR64B",)
12 changes: 1 addition & 11 deletions src/test/pmem2_movnt_align/TESTS.py
Original file line number Diff line number Diff line change
Expand Up @@ -101,14 +101,4 @@ def run(self, ctx):

@t.require_architectures('x86_64')
class TEST10(Pmem2MovntAlign):
envs0 = ("PMEM_MOVDIR64B",)


@t.require_architectures('x86_64')
class TEST11(Pmem2MovntAlign):
envs0 = ("PMEM_MOVDIR64B", "PMEM_AVX512F",)


@t.require_architectures('x86_64')
class TEST12(Pmem2MovntAlign):
envs0 = ("PMEM_MOVDIR64B", "PMEM_AVX512F", "PMEM_AVX",)
envs1 = ("PMEM_MOVDIR64B",)
24 changes: 7 additions & 17 deletions src/test/pmem_memcpy/TESTS.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,34 +42,24 @@ class TEST0(PmemMemcpy):
pass


@t.require_architectures('x86_64')
class TEST1(PmemMemcpy):
envs0 = ("PMEM_AVX512F",)


@t.require_architectures('x86_64')
class TEST2(PmemMemcpy):
envs0 = ("PMEM_AVX512F", "PMEM_AVX",)


class TEST3(PmemMemcpy):
envs1 = ("PMEM_NO_MOVNT",)


class TEST4(PmemMemcpy):
class TEST2(PmemMemcpy):
envs1 = ("PMEM_NO_MOVNT", "PMEM_NO_GENERIC_MEMCPY")


@t.require_architectures('x86_64')
class TEST5(PmemMemcpy):
envs0 = ("PMEM_MOVDIR64B",)
class TEST3(PmemMemcpy):
envs0 = ("PMEM_AVX512F",)


@t.require_architectures('x86_64')
class TEST6(PmemMemcpy):
envs0 = ("PMEM_MOVDIR64B", "PMEM_AVX512F",)
class TEST4(PmemMemcpy):
envs0 = ("PMEM_AVX512F", "PMEM_AVX",)


@t.require_architectures('x86_64')
class TEST7(PmemMemcpy):
envs0 = ("PMEM_MOVDIR64B", "PMEM_AVX512F", "PMEM_AVX",)
class TEST5(PmemMemcpy):
envs1 = ("PMEM_MOVDIR64B",)
2 changes: 1 addition & 1 deletion src/test/pmem_memmove/TEST0
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ export PMEM_NO_GENERIC_MEMCPY=1

test_all

export PMEM_MOVDIR64B=0
export PMEM_MOVDIR64B=1

test_all

Expand Down
2 changes: 1 addition & 1 deletion src/test/pmem_memmove/TEST0.PS1
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ $Env:PMEM_NO_GENERIC_MEMCPY = 1

test_all

$Env:PMEM_MOVDIR64B = 0
$Env:PMEM_MOVDIR64B = 1

test_all

Expand Down
2 changes: 1 addition & 1 deletion src/test/pmem_memset/TEST0
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ export PMEM_NO_GENERIC_MEMCPY=1

test_all

export PMEM_MOVDIR64B=0
export PMEM_MOVDIR64B=1

test_all

Expand Down
2 changes: 1 addition & 1 deletion src/test/pmem_memset/TEST0.PS1
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ $Env:PMEM_NO_GENERIC_MEMCPY = 1

test_all

$Env:PMEM_MOVDIR64B = 0
$Env:PMEM_MOVDIR64B = 1

test_all

Expand Down
2 changes: 1 addition & 1 deletion src/test/pmem_movnt/TEST0
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ export PMEM_NO_GENERIC_MEMCPY=1

test

export PMEM_MOVDIR64B=0
export PMEM_MOVDIR64B=1

test_all

Expand Down
2 changes: 1 addition & 1 deletion src/test/pmem_movnt/TEST0.PS1
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ $Env:PMEM_NO_GENERIC_MEMCPY = 1

test

$Env:PMEM_MOVDIR64B = 0
$Env:PMEM_MOVDIR64B = 1

test_all

Expand Down
2 changes: 1 addition & 1 deletion src/test/pmem_movnt_align/TEST0
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ export PMEM_NO_GENERIC_MEMCPY=1

test

export PMEM_MOVDIR64B=0
export PMEM_MOVDIR64B=1

test_all

Expand Down
2 changes: 1 addition & 1 deletion src/test/pmem_movnt_align/TEST0.PS1
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ $Env:PMEM_NO_GENERIC_MEMCPY = 1

test

$Env:PMEM_MOVDIR64B = 0
$Env:PMEM_MOVDIR64B = 1

test_all

Expand Down
2 changes: 1 addition & 1 deletion src/test/pmem_movnt_align/TEST1
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ export PMEM_NO_GENERIC_MEMCPY=1

test

export PMEM_MOVDIR64B=0
export PMEM_MOVDIR64B=1

test_all

Expand Down
28 changes: 8 additions & 20 deletions src/test/pmemset_memcpy/TESTS.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,41 +52,29 @@ class TEST0(PmemsetMemcpy):
pass


@t.require_architectures('x86_64')
@t.add_params('wc_workaround', ['on', 'off', 'default'])
class TEST1(PmemsetMemcpy):
envs0 = ("PMEM_AVX512F",)


@t.require_architectures('x86_64')
@t.add_params('wc_workaround', ['on', 'off', 'default'])
class TEST2(PmemsetMemcpy):
envs0 = ("PMEM_AVX512F", "PMEM_AVX",)


@t.add_params('wc_workaround', ['default'])
class TEST3(PmemsetMemcpy):
class TEST1(PmemsetMemcpy):
envs1 = ("PMEM_NO_MOVNT",)


@t.add_params('wc_workaround', ['default'])
class TEST4(PmemsetMemcpy):
class TEST2(PmemsetMemcpy):
envs1 = ("PMEM_NO_MOVNT", "PMEM_NO_GENERIC_MEMCPY")


@t.require_architectures('x86_64')
@t.add_params('wc_workaround', ['on', 'off', 'default'])
class TEST5(PmemsetMemcpy):
envs0 = ("PMEM_MOVDIR64B",)
class TEST3(PmemsetMemcpy):
envs0 = ("PMEM_AVX512F",)


@t.require_architectures('x86_64')
@t.add_params('wc_workaround', ['on', 'off', 'default'])
class TEST6(PmemsetMemcpy):
envs0 = ("PMEM_MOVDIR64B", "PMEM_AVX512F",)
class TEST4(PmemsetMemcpy):
envs0 = ("PMEM_AVX512F", "PMEM_AVX",)


@t.require_architectures('x86_64')
@t.add_params('wc_workaround', ['on', 'off', 'default'])
class TEST7(PmemsetMemcpy):
envs0 = ("PMEM_MOVDIR64B", "PMEM_AVX512F", "PMEM_AVX",)
class TEST5(PmemsetMemcpy):
envs1 = ("PMEM_MOVDIR64B",)
Loading

0 comments on commit 29c453f

Please sign in to comment.