Mesa (master): intel/compiler: Use gen_get_device_info() in test_eu_validate

Matt Turner mattst88 at kemper.freedesktop.org
Fri Mar 16 20:20:34 UTC 2018


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

Author: Matt Turner <mattst88 at gmail.com>
Date:   Fri Mar 16 10:52:55 2018 -0700

intel/compiler: Use gen_get_device_info() in test_eu_validate

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.")
Reviewed-by: Rafael Antognolli <rafael.antognolli at intel.com>

---

 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 45e7a6ccce..af30a58a1d 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 602206c725..72b7a6796c 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 d987311ef8..161db994b2 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);
 }




More information about the mesa-commit mailing list