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@lists.freedesktop.org
Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/merge_requests/3454>
(cherry picked from commit 99f3178a24)
This commit is contained in:
Jason Ekstrand 2020-01-17 11:37:31 -06:00 committed by Dylan Baker
parent 8585ae7c03
commit 5d9a1303ba
4 changed files with 22 additions and 15 deletions

View file

@ -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
},

View file

@ -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,

View file

@ -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.

View file

@ -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);