public inbox for dev@dpdk.org
 help / color / mirror / Atom feed
* [PATCH] test/memcpy: reduce alignment offset coverage to fix timeout
@ 2026-02-26 16:48 Stephen Hemminger
  2026-03-10 17:04 ` Ji, Kai
  0 siblings, 1 reply; 3+ messages in thread
From: Stephen Hemminger @ 2026-02-26 16:48 UTC (permalink / raw)
  To: dev; +Cc: Stephen Hemminger, Luca Boccassi

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

Reported-by: Luca Boccassi <bluca@debian.org>
Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
---
 app/test/test_memcpy.c | 20 ++++++++++++++++----
 1 file changed, 16 insertions(+), 4 deletions(-)

diff --git a/app/test/test_memcpy.c b/app/test/test_memcpy.c
index 7273c17a06..12e491034f 100644
--- a/app/test/test_memcpy.c
+++ b/app/test/test_memcpy.c
@@ -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 int
 func_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


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] test/memcpy: reduce alignment offset coverage to fix timeout
  2026-02-26 16:48 [PATCH] test/memcpy: reduce alignment offset coverage to fix timeout Stephen Hemminger
@ 2026-03-10 17:04 ` Ji, Kai
  2026-03-17 17:01   ` Thomas Monjalon
  0 siblings, 1 reply; 3+ messages in thread
From: Ji, Kai @ 2026-03-10 17:04 UTC (permalink / raw)
  To: Stephen Hemminger, dev@dpdk.org; +Cc: Luca Boccassi

[-- Attachment #1: Type: text/plain, Size: 3205 bytes --]

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 <stephen@networkplumber.org>
Sent: Thursday, February 26, 2026 16:48
To: dev@dpdk.org <dev@dpdk.org>
Cc: Stephen Hemminger <stephen@networkplumber.org>; Luca Boccassi <bluca@debian.org>
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

Reported-by: Luca Boccassi <bluca@debian.org>
Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
---
 app/test/test_memcpy.c | 20 ++++++++++++++++----
 1 file changed, 16 insertions(+), 4 deletions(-)

diff --git a/app/test/test_memcpy.c b/app/test/test_memcpy.c
index 7273c17a06..12e491034f 100644
--- a/app/test/test_memcpy.c
+++ b/app/test/test_memcpy.c
@@ -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 int
 func_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


[-- Attachment #2: Type: text/html, Size: 7818 bytes --]

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] test/memcpy: reduce alignment offset coverage to fix timeout
  2026-03-10 17:04 ` Ji, Kai
@ 2026-03-17 17:01   ` Thomas Monjalon
  0 siblings, 0 replies; 3+ messages in thread
From: Thomas Monjalon @ 2026-03-17 17:01 UTC (permalink / raw)
  To: Stephen Hemminger; +Cc: dev@dpdk.org, Luca Boccassi, Ji, Kai

> > 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/De
> > bian_Testing/i586
> > 
> > Reported-by: Luca Boccassi <bluca@debian.org>
> > Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
> 
> 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_UNIT is 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.



^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2026-03-17 17:01 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-02-26 16:48 [PATCH] test/memcpy: reduce alignment offset coverage to fix timeout Stephen Hemminger
2026-03-10 17:04 ` Ji, Kai
2026-03-17 17:01   ` Thomas Monjalon

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox