Mesa (master): aco/tests: Allow specifiying the test subvariant in setup_cs

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Tue Dec 29 19:05:36 UTC 2020


Module: Mesa
Branch: master
Commit: a240341ec94b3932ebe8b3a4fe014833380eb29f
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=a240341ec94b3932ebe8b3a4fe014833380eb29f

Author: Tony Wasserka <tony.wasserka at gmx.de>
Date:   Thu Nov  5 12:43:14 2020 +0100

aco/tests: Allow specifiying the test subvariant in setup_cs

Reviewed-by: Daniel Schürmann <daniel at schuermann.dev>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7461>

---

 src/amd/compiler/tests/helpers.cpp        | 8 +++-----
 src/amd/compiler/tests/helpers.h          | 4 ++--
 src/amd/compiler/tests/test_optimizer.cpp | 4 +---
 3 files changed, 6 insertions(+), 10 deletions(-)

diff --git a/src/amd/compiler/tests/helpers.cpp b/src/amd/compiler/tests/helpers.cpp
index 724c86b971f..f0ab616d27e 100644
--- a/src/amd/compiler/tests/helpers.cpp
+++ b/src/amd/compiler/tests/helpers.cpp
@@ -43,7 +43,6 @@ std::unique_ptr<Program> program;
 Builder bld(NULL);
 Temp inputs[16];
 Temp exec_input;
-const char *subvariant = "";
 
 static VkInstance instance_cache[CHIP_LAST] = {VK_NULL_HANDLE};
 static VkDevice device_cache[CHIP_LAST] = {VK_NULL_HANDLE};
@@ -94,11 +93,10 @@ void create_program(enum chip_class chip_class, Stage stage, unsigned wave_size,
 }
 
 bool setup_cs(const char *input_spec, enum chip_class chip_class,
-              enum radeon_family family, unsigned wave_size)
+              enum radeon_family family, const char* subvariant,
+              unsigned wave_size)
 {
-   const char *old_subvariant = subvariant;
-   subvariant = "";
-   if (!set_variant(chip_class, old_subvariant))
+   if (!set_variant(chip_class, subvariant))
       return false;
 
    memset(&info, 0, sizeof(info));
diff --git a/src/amd/compiler/tests/helpers.h b/src/amd/compiler/tests/helpers.h
index 11fa546217b..3ce9fab3de3 100644
--- a/src/amd/compiler/tests/helpers.h
+++ b/src/amd/compiler/tests/helpers.h
@@ -66,12 +66,12 @@ extern std::unique_ptr<aco::Program> program;
 extern aco::Builder bld;
 extern aco::Temp exec_input;
 extern aco::Temp inputs[16];
-extern const char *subvariant;
 
 void create_program(enum chip_class chip_class, aco::Stage stage,
                     unsigned wave_size=64, enum radeon_family family=CHIP_UNKNOWN);
 bool setup_cs(const char *input_spec, enum chip_class chip_class,
-              enum radeon_family family=CHIP_UNKNOWN, unsigned wave_size=64);
+              enum radeon_family family=CHIP_UNKNOWN, const char* subvariant = "",
+              unsigned wave_size=64);
 
 void finish_program(aco::Program *program);
 void finish_validator_test();
diff --git a/src/amd/compiler/tests/test_optimizer.cpp b/src/amd/compiler/tests/test_optimizer.cpp
index da00fce832f..08cd7d1e0bc 100644
--- a/src/amd/compiler/tests/test_optimizer.cpp
+++ b/src/amd/compiler/tests/test_optimizer.cpp
@@ -521,9 +521,7 @@ static const clamp_config clamp_configs[] = {
 
 BEGIN_TEST(optimize.clamp)
    for (clamp_config cfg : clamp_configs) {
-      subvariant = cfg.name;
-
-      if (!setup_cs("v1 v1 v1", GFX9))
+      if (!setup_cs("v1 v1 v1", GFX9, CHIP_UNKNOWN, cfg.name))
          continue;
 
       //! cfg: @match_func(min max med3 lb ub)



More information about the mesa-commit mailing list