Mesa (staging/20.0): iris: Store the L3$ configs in the screen

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Fri Jan 31 17:47:40 UTC 2020


Module: Mesa
Branch: staging/20.0
Commit: 5d9a1303bafaf6cdef8c9fca62eceed9ccc5522f
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=5d9a1303bafaf6cdef8c9fca62eceed9ccc5522f

Author: Jason Ekstrand <jason at jlekstrand.net>
Date:   Fri Jan 17 11:37:31 2020 -0600

iris: Store the L3$ configs in the screen

We only calculate them based on device info and never change them so
this seems like a reasonable place to put them.  We could also put them
in the context, but that's not accessible from iris_init_*_context.

Cc: "20.0" mesa-stable at lists.freedesktop.org
Reviewed-by: Jordan Justen <jordan.l.justen at intel.com>
Reviewed-by: Kenneth Graunke <kenneth at whitecape.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/merge_requests/3454>
(cherry picked from commit 99f3178a249525d333c5b27d755a0f99a81b3c17)

---

 .pick_status.json                      |  2 +-
 src/gallium/drivers/iris/iris_screen.c | 15 +++++++++++++++
 src/gallium/drivers/iris/iris_screen.h |  4 ++++
 src/gallium/drivers/iris/iris_state.c  | 16 ++--------------
 4 files changed, 22 insertions(+), 15 deletions(-)

diff --git a/.pick_status.json b/.pick_status.json
index 27d60822e05..c609a3ce0b9 100644
--- a/.pick_status.json
+++ b/.pick_status.json
@@ -211,7 +211,7 @@
         "description": "iris: Store the L3$ configs in the screen",
         "nominated": true,
         "nomination_type": 0,
-        "resolution": 0,
+        "resolution": 1,
         "master_sha": null,
         "because_sha": null
     },
diff --git a/src/gallium/drivers/iris/iris_screen.c b/src/gallium/drivers/iris/iris_screen.c
index 736d849feb8..fd7f5f70165 100644
--- a/src/gallium/drivers/iris/iris_screen.c
+++ b/src/gallium/drivers/iris/iris_screen.c
@@ -53,6 +53,7 @@
 #include "iris_screen.h"
 #include "intel/compiler/brw_compiler.h"
 #include "intel/common/gen_gem.h"
+#include "intel/common/gen_l3_config.h"
 #include "iris_monitor.h"
 
 static void
@@ -575,6 +576,17 @@ iris_getparam_integer(struct iris_screen *screen, int param)
    return -1;
 }
 
+static const struct gen_l3_config *
+iris_get_default_l3_config(const struct gen_device_info *devinfo,
+                           bool compute)
+{
+   bool wants_dc_cache = true;
+   bool has_slm = compute;
+   const struct gen_l3_weights w =
+      gen_get_default_l3_weights(devinfo, wants_dc_cache, has_slm);
+   return gen_get_l3_config(devinfo, w);
+}
+
 static void
 iris_shader_debug_log(void *data, const char *fmt, ...)
 {
@@ -673,6 +685,9 @@ iris_screen_create(int fd, const struct pipe_screen_config *config)
    screen->compiler->supports_shader_constants = true;
    screen->compiler->compact_params = false;
 
+   screen->l3_config_3d = iris_get_default_l3_config(&screen->devinfo, false);
+   screen->l3_config_cs = iris_get_default_l3_config(&screen->devinfo, true);
+
    iris_disk_cache_init(screen);
 
    slab_create_parent(&screen->transfer_pool,
diff --git a/src/gallium/drivers/iris/iris_screen.h b/src/gallium/drivers/iris/iris_screen.h
index 60ff15904a7..34f6fd1c16b 100644
--- a/src/gallium/drivers/iris/iris_screen.h
+++ b/src/gallium/drivers/iris/iris_screen.h
@@ -34,6 +34,7 @@
 
 struct iris_bo;
 struct iris_monitor_config;
+struct gen_l3_config;
 
 #define READ_ONCE(x) (*(volatile __typeof__(x) *)&(x))
 #define WRITE_ONCE(x, v) *(volatile __typeof__(x) *)&(x) = (v)
@@ -80,6 +81,9 @@ struct iris_screen {
    struct brw_compiler *compiler;
    struct iris_monitor_config *monitor_cfg;
 
+   const struct gen_l3_config *l3_config_3d;
+   const struct gen_l3_config *l3_config_cs;
+
    /**
     * A buffer containing nothing useful, for hardware workarounds that
     * require scratch writes or reads from some unimportant memory.
diff --git a/src/gallium/drivers/iris/iris_state.c b/src/gallium/drivers/iris/iris_state.c
index cde76bb9fb8..d6413faa8b1 100644
--- a/src/gallium/drivers/iris/iris_state.c
+++ b/src/gallium/drivers/iris/iris_state.c
@@ -766,18 +766,6 @@ iris_emit_l3_config(struct iris_batch *batch,
    _iris_emit_lri(batch, L3_ALLOCATION_REG_num, reg_val);
 }
 
-static void
-iris_emit_default_l3_config(struct iris_batch *batch, bool compute)
-{
-   const struct gen_device_info *devinfo = &batch->screen->devinfo;
-   bool wants_dc_cache = true;
-   bool has_slm = compute;
-   const struct gen_l3_weights w =
-      gen_get_default_l3_weights(devinfo, wants_dc_cache, has_slm);
-   const struct gen_l3_config *cfg = gen_get_l3_config(devinfo, w);
-   iris_emit_l3_config(batch, cfg);
-}
-
 #if GEN_GEN == 9
 static void
 iris_enable_obj_preemption(struct iris_batch *batch, bool enable)
@@ -912,7 +900,7 @@ iris_init_render_context(struct iris_batch *batch)
 
    emit_pipeline_select(batch, _3D);
 
-   iris_emit_default_l3_config(batch, false);
+   iris_emit_l3_config(batch, batch->screen->l3_config_3d);
 
    init_state_base_address(batch);
 
@@ -1031,7 +1019,7 @@ iris_init_compute_context(struct iris_batch *batch)
    emit_pipeline_select(batch, GPGPU);
 #endif
 
-   iris_emit_default_l3_config(batch, true);
+   iris_emit_l3_config(batch, batch->screen->l3_config_cs);
 
    init_state_base_address(batch);
 



More information about the mesa-commit mailing list