[Piglit] [PATCH] Strengthen arb_shader_image_load_store-shader-mem-barrier test

Nicolai Hähnle nhaehnle at gmail.com
Sun Apr 17 22:06:29 UTC 2016


From: Nicolai Hähnle <nicolai.haehnle at amd.com>

By transposing the loop and the writer/reader branching, the effective level
of parallelism in the test is increased for a typical wave-based architecture.

Increasing the window size on top of that helps to reliably expose different
implementation errors for AMD GCN.

Cc: Francisco Jerez <currojerez at riseup.net>
---
After trying a bunch of different things, it turns out that the combination
of these rather small changes ends up covering all the cases.

 .../shader-mem-barrier.c                           | 32 ++++++++++------------
 1 file changed, 15 insertions(+), 17 deletions(-)

diff --git a/tests/spec/arb_shader_image_load_store/shader-mem-barrier.c b/tests/spec/arb_shader_image_load_store/shader-mem-barrier.c
index 5fdd86b..ddf5da6 100644
--- a/tests/spec/arb_shader_image_load_store/shader-mem-barrier.c
+++ b/tests/spec/arb_shader_image_load_store/shader-mem-barrier.c
@@ -48,7 +48,7 @@
 #define W 256
 
 /** Window height. */
-#define H 16
+#define H 64
 
 /** Total number of pixels in the image. */
 #define N (W * H)
@@ -142,15 +142,15 @@ run_test(const struct image_test_info *test,
                             "       int x = (idx.x % K) + (idx.x / (2 * K)) * (2 * K);\n"
                             "       int i, n = 1000;\n"
                             "\n"
-                            "       if (check) {\n"
-                            "              /*\n"
-                            "               * Consumer: Monitor the evolution of a pair of\n"
-                            "               * image locations until the test runs to\n"
-                            "               * completion or an inconsistency is observed.\n"
-                            "               */\n"
-                            "              for (i = 0; i < n; ++i) {\n"
-                            "                     uint u, v;\n"
+                            "       for (i = 0; i < n; ++i) {\n"
+                            "              uint u, v;\n"
                             "\n"
+                            "              if (check) {\n"
+                            "                     /*\n"
+                            "                      * Consumer: Monitor the evolution of a pair of\n"
+                            "                      * image locations until the test runs to\n"
+                            "                      * completion or an inconsistency is observed.\n"
+                            "                      */\n"
                             "                     v = imageLoad(img, ivec2(x, idx.y)).x;\n"
                             "                     MEMORY_BARRIER();\n"
                             "                     u = imageLoad(img, ivec2(x + K, idx.y)).x;\n"
@@ -158,14 +158,12 @@ run_test(const struct image_test_info *test,
                             "                     if (u < v)\n"
                             "                             /* Fail. */\n"
                             "                             return GRID_T(v << 16 | u, 0, 0, 1);\n"
-                            "             }\n"
-                            "       } else {\n"
-                            "              /*\n"
-                            "               * Producer: Update the same pair of image locations\n"
-                            "               * sequentially with increasing values ordering the\n"
-                            "               * stores with a barrier.\n"
-                            "               */\n"
-                            "              for (i = 0; i < n; ++i) {\n"
+                            "             } else {\n"
+                            "                     /*\n"
+                            "                      * Producer: Update the same pair of image locations\n"
+                            "                      * sequentially with increasing values ordering the\n"
+                            "                      * stores with a barrier.\n"
+                            "                      */\n"
                             "                     imageStore(img, ivec2(x + K, idx.y), DATA_T(i));\n"
                             "                     MEMORY_BARRIER();\n"
                             "                     imageStore(img, ivec2(x, idx.y), DATA_T(i));\n"
-- 
2.5.0



More information about the Piglit mailing list