summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarek Olšák <marek.olsak@amd.com>2016-07-31 00:46:09 +0200
committerMarek Olšák <marek.olsak@amd.com>2016-08-06 16:11:35 +0200
commitad8af99c86faca56451fd6f11259c69907feca0b (patch)
tree66d624dd3dfc7ec97c3a3e5e3c611705818eddbf
parentd0646cc7455df1678a129fa29d142f20f5252759 (diff)
radeonsi: add environment variable SI_FORCE_FAMILY
This will be used by: amdgcn_glslc -mcpu=[family] It can also be used for shader-db if you want stats for a different family. Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
-rw-r--r--src/gallium/drivers/radeonsi/si_pipe.c32
1 files changed, 32 insertions, 0 deletions
diff --git a/src/gallium/drivers/radeonsi/si_pipe.c b/src/gallium/drivers/radeonsi/si_pipe.c
index c540cfdfab..e33823dced 100644
--- a/src/gallium/drivers/radeonsi/si_pipe.c
+++ b/src/gallium/drivers/radeonsi/si_pipe.c
@@ -715,6 +715,36 @@ static bool si_init_gs_info(struct si_screen *sscreen)
}
}
+static void si_handle_env_var_force_family(struct si_screen *sscreen)
+{
+ const char *family = debug_get_option("SI_FORCE_FAMILY", NULL);
+ unsigned i;
+
+ if (!family)
+ return;
+
+ for (i = CHIP_TAHITI; i < CHIP_LAST; i++) {
+ if (!strcmp(family, r600_get_llvm_processor_name(i))) {
+ /* Override family and chip_class. */
+ sscreen->b.family = sscreen->b.info.family = i;
+
+ if (i >= CHIP_TONGA)
+ sscreen->b.chip_class = sscreen->b.info.chip_class = VI;
+ else if (i >= CHIP_BONAIRE)
+ sscreen->b.chip_class = sscreen->b.info.chip_class = CIK;
+ else
+ sscreen->b.chip_class = sscreen->b.info.chip_class = SI;
+
+ /* Don't submit any IBs. */
+ setenv("RADEON_NOOP", "1", 1);
+ return;
+ }
+ }
+
+ fprintf(stderr, "radeonsi: Unknown family: %s\n", family);
+ exit(1);
+}
+
struct pipe_screen *radeonsi_screen_create(struct radeon_winsys *ws)
{
struct si_screen *sscreen = CALLOC_STRUCT(si_screen);
@@ -740,6 +770,8 @@ struct pipe_screen *radeonsi_screen_create(struct radeon_winsys *ws)
return NULL;
}
+ si_handle_env_var_force_family(sscreen);
+
if (!debug_get_bool_option("RADEON_DISABLE_PERFCOUNTERS", false))
si_init_perfcounters(sscreen);