test/memcpy: reduce alignment offset coverage to fix timeout
PATCH 1/1 test/memcpy: reduce alignment offset coverage to fix timeout
The memcpy test sweeps all 32x32 src/dst alignment offset pairs which causes it to timeout on slow emulated 32-bit build environments [1].
Replace with a curated set of 7 offsets {0, 1, 7, 15, 16, 17, 31} that cover the interesting alignment boundaries. This reduces the iterations from 38912 to 1862 while covering the same code paths.
[1] https://build.opensuse.org/package/live_build_log/home:bluca:dpdk/dpdk/Debian_Testing/i586
--- app/test/test_memcpy.c | 20 ++++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-)
app/test/test_memcpy.c +16 -4
@@ -36,6 +36,16 @@ static size_t buf_sizes[TEST_VALUE_RANGE];/* Data is aligned on this many bytes (power of 2) */ #define ALIGNMENT_UNIT 32 +/* +* Subset of offsets to test. These values cover the structurally +* interesting alignment cases for SSE/AVX/AVX512 copy paths: +* aligned (0), off-by-one (1), partial vector (7, 15, 17), +* vector boundaries (16, 31). Testing all 1024 src x dst +* combinations of offsets 0..31 is unnecessary since many +* map to the same code paths, and causes the test to timeout +* on slow (e.g. emulated 32-bit) build environments. +*/ +static const unsigned int test_offsets[] = {0 ,1 ,7 ,15 ,16 ,17 ,31 };/* * Create two buffers, and initialise one with random values. These are copied
@@ -103,13 +113,15 @@ static intfunc_test (void) {unsigned int off_src, off_dst, i; +unsigned int n_offsets =RTE_DIM (test_offsets);int ret; -for (off_src =0 ; off_src <ALIGNMENT_UNIT ; off_src++) { -for (off_dst =0 ; off_dst <ALIGNMENT_UNIT ; off_dst++) { +for (off_src =0 ; off_src < n_offsets; off_src++) { +for (off_dst =0 ; off_dst < n_offsets; off_dst++) {for (i =0 ; i <RTE_DIM (buf_sizes); i++) { - ret =test_single_memcpy (off_src, off_dst, - buf_sizes[i]); + ret =test_single_memcpy (test_offsets[off_src], + test_offsets[off_dst], + buf_sizes[i]);if (ret !=0 )return -1 ; }
Signature · 1 line
2.51.0
LGTM,
I'm not AVX-512 expert, but I think AVX-512 might expect 64-bytes alignment,. As the original ALIGNMENT_UNIT is 32, so I think the selection of offsets is no problem. Maybe remove AVX-512 from the comments ?
Regards
Kai
________________________________
From: Stephen Hemminger <[email protected]>
Sent: Thursday, February 26, 2026 16:48
To: [email protected] <[email protected]>
Cc: Stephen Hemminger <[email protected]>; Luca Boccassi <[email protected]>
Subject: [PATCH] test/memcpy: reduce alignment offset coverage to fix timeout
The memcpy test sweeps all 32x32 src/dst alignment offset pairs which causes it to timeout on slow emulated 32-bit build environments [1].
Replace with a curated set of 7 offsets {0, 1, 7, 15, 16, 17, 31} that cover the interesting alignment boundaries. This reduces the iterations from 38912 to 1862 while covering the same code paths.
[1] https://build.opensuse.org/package/live_build_log/home:bluca:dpdk/dpdk/Debian_Testing/i586
--- app/test/test_memcpy.c | 20 ++++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-)
app/test/test_memcpy.c +16 -4
@@ -36,6 +36,16 @@ static size_t buf_sizes[TEST_VALUE_RANGE];/* Data is aligned on this many bytes (power of 2) */ #define ALIGNMENT_UNIT 32 +/* +* Subset of offsets to test. These values cover the structurally +* interesting alignment cases for SSE/AVX/AVX512 copy paths: +* aligned (0), off-by-one (1), partial vector (7, 15, 17), +* vector boundaries (16, 31). Testing all 1024 src x dst +* combinations of offsets 0..31 is unnecessary since many +* map to the same code paths, and causes the test to timeout +* on slow (e.g. emulated 32-bit) build environments. +*/ +static const unsigned int test_offsets[] = {0 ,1 ,7 ,15 ,16 ,17 ,31 };/* * Create two buffers, and initialise one with random values. These are copied
@@ -103,13 +113,15 @@ static intfunc_test (void) {unsigned int off_src, off_dst, i; +unsigned int n_offsets =RTE_DIM (test_offsets);int ret; -for (off_src =0 ; off_src <ALIGNMENT_UNIT ; off_src++) { -for (off_dst =0 ; off_dst <ALIGNMENT_UNIT ; off_dst++) { +for (off_src =0 ; off_src < n_offsets; off_src++) { +for (off_dst =0 ; off_dst < n_offsets; off_dst++) {for (i =0 ; i <RTE_DIM (buf_sizes); i++) { - ret =test_single_memcpy (off_src, off_dst, - buf_sizes[i]); + ret =test_single_memcpy (test_offsets[off_src], + test_offsets[off_dst], + buf_sizes[i]);if (ret !=0 )return -1 ; }
--
2.51.0
Quoted 14 lines
Quoted 7 lines
The memcpy test sweeps all 32x32 src/dst alignment offset pairs which causes it to timeout on slow emulated 32-bit build environments [1].
Replace with a curated set of 7 offsets {0, 1, 7, 15, 16, 17, 31} that cover the interesting alignment boundaries. This reduces the iterations from 38912 to 1862 while covering the same code paths.
Quoted 6 lines
[1]
https://build.opensuse.org/package/live_build_log/home:bluca:dpdk/dpdk/De
bian_Testing/i586Reported-by Luca Boccassi <[email protected]>Signed-off-by Stephen Hemminger <[email protected]>
Quoted 6 lines
10/03/2026 18:04, Ji, Kai:
LGTM,I'm not AVX-512 expert, but I think AVX-512 might expect 64-bytes alignment,. As the original
ALIGNMENT_UNITis 32, so I think the selection of offsets is no problem. Maybe remove AVX-512 from the comments ?
Applied with AVX512 removed from the comment, thanks.