[Mesa-dev] [PATCH 2/2] intel/compiler: Use gen_get_device_info() in test_eu_validate

Matt Turner mattst88 at gmail.com
Fri Mar 16 17:56:24 UTC 2018


Previously the unit test filled out a minimal devinfo struct. A previous
patch caused the test to begin assert failing because the devinfo was
not complete. Avoid this by using the real mechanism to create devinfo.

Note that we have to drop icl from the table, since we now rely on the
name -> PCI ID translation done by gen_device_name_to_pci_device_id(),
and ICL's PCI IDs are not upstream yet.

Fixes: f89e735719a6 ("intel/compiler: Check for unsupported register sizes.")
---
 src/intel/Makefile.compiler.am          |  1 +
 src/intel/compiler/meson.build          |  2 +-
 src/intel/compiler/test_eu_validate.cpp | 55 ++++++++++-----------------------
 3 files changed, 19 insertions(+), 39 deletions(-)

diff --git a/src/intel/Makefile.compiler.am b/src/intel/Makefile.compiler.am
index 45e7a6ccce8..af30a58a1d6 100644
--- a/src/intel/Makefile.compiler.am
+++ b/src/intel/Makefile.compiler.am
@@ -48,6 +48,7 @@ TEST_LIBS = \
 	$(top_builddir)/src/gtest/libgtest.la \
 	compiler/libintel_compiler.la \
 	common/libintel_common.la \
+	dev/libintel_dev.la \
 	$(top_builddir)/src/compiler/nir/libnir.la \
 	$(top_builddir)/src/util/libmesautil.la \
 	$(top_builddir)/src/intel/isl/libisl.la \
diff --git a/src/intel/compiler/meson.build b/src/intel/compiler/meson.build
index 602206c725f..72b7a6796cb 100644
--- a/src/intel/compiler/meson.build
+++ b/src/intel/compiler/meson.build
@@ -152,7 +152,7 @@ if with_tests
         'test_ at 0@.cpp'.format(t),
         include_directories : [inc_common, inc_intel],
         link_with : [
-          libintel_compiler, libintel_common, libmesa_util, libisl,
+          libintel_compiler, libintel_common, libintel_dev, libmesa_util, libisl,
         ],
         dependencies : [dep_thread, dep_dl, idep_gtest, idep_nir],
       )
diff --git a/src/intel/compiler/test_eu_validate.cpp b/src/intel/compiler/test_eu_validate.cpp
index d987311ef84..161db994b2b 100644
--- a/src/intel/compiler/test_eu_validate.cpp
+++ b/src/intel/compiler/test_eu_validate.cpp
@@ -25,38 +25,24 @@
 #include "brw_eu.h"
 #include "util/ralloc.h"
 
-enum subgen {
-   IS_G45 = 1,
-   IS_BYT,
-   IS_HSW,
-   IS_CHV,
-   IS_BXT,
-   IS_KBL,
-   IS_GLK,
-   IS_CFL,
-};
-
 static const struct gen_info {
    const char *name;
-   int gen;
-   enum subgen subgen;
 } gens[] = {
-   { "brw", 4 },
-   { "g45", 4, IS_G45 },
-   { "ilk", 5 },
-   { "snb", 6 },
-   { "ivb", 7 },
-   { "byt", 7, IS_BYT },
-   { "hsw", 7, IS_HSW },
-   { "bdw", 8 },
-   { "chv", 8, IS_CHV },
-   { "skl", 9 },
-   { "bxt", 9, IS_BXT },
-   { "kbl", 9, IS_KBL },
-   { "glk", 9, IS_GLK },
-   { "cfl", 9, IS_CFL },
-   { "cnl", 10 },
-   { "icl", 11 },
+   { "brw", },
+   { "g4x", },
+   { "ilk", },
+   { "snb", },
+   { "ivb", },
+   { "byt", },
+   { "hsw", },
+   { "bdw", },
+   { "chv", },
+   { "skl", },
+   { "bxt", },
+   { "kbl", },
+   { "glk", },
+   { "cfl", },
+   { "cnl", },
 };
 
 class validation_test: public ::testing::TestWithParam<struct gen_info> {
@@ -84,16 +70,9 @@ validation_test::~validation_test()
 void validation_test::SetUp()
 {
    struct gen_info info = GetParam();
+   int devid = gen_device_name_to_pci_device_id(info.name);
 
-   devinfo.gen           = info.gen;
-   devinfo.is_g4x        = info.subgen == IS_G45;
-   devinfo.is_baytrail   = info.subgen == IS_BYT;
-   devinfo.is_haswell    = info.subgen == IS_HSW;
-   devinfo.is_cherryview = info.subgen == IS_CHV;
-   devinfo.is_broxton    = info.subgen == IS_BXT;
-   devinfo.is_kabylake   = info.subgen == IS_KBL;
-   devinfo.is_geminilake = info.subgen == IS_GLK;
-   devinfo.is_coffeelake = info.subgen == IS_CFL;
+   gen_get_device_info(devid, &devinfo);
 
    brw_init_codegen(&devinfo, p, p);
 }
-- 
2.16.1



More information about the mesa-dev mailing list