intel: Add and use max_constant_urb_size_kb

This knowledge was repeated in multiple places so move the values to
intel_device_info struct.

Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Acked-by: Jason Ekstrand <jason@jlekstrand.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13014>
This commit is contained in:
Caio Marcelo de Oliveira Filho 2021-09-23 22:59:40 -07:00 committed by Marge Bot
parent f349c8ab4b
commit 37f03e89f2
7 changed files with 17 additions and 18 deletions

View file

@ -1321,13 +1321,8 @@ emit_pipeline_select(struct crocus_batch *batch, uint32_t pipeline)
static void
crocus_alloc_push_constants(struct crocus_batch *batch)
{
#if GFX_VERx10 == 75
const unsigned push_constant_kb = batch->screen->devinfo.gt == 3 ? 32 : 16;
#elif GFX_VER == 8
const unsigned push_constant_kb = 32;
#else
const unsigned push_constant_kb = 16;
#endif
const unsigned push_constant_kb =
batch->screen->devinfo.max_constant_urb_size_kb;
unsigned size_per_stage = push_constant_kb / 5;
/* For now, we set a static partitioning of the push constant area,

View file

@ -87,8 +87,7 @@ intel_get_urb_config(const struct intel_device_info *devinfo,
if (devinfo->ver >= 12)
urb_size_kB -= 4 * devinfo->l3_banks;
const unsigned push_constant_kB =
(devinfo->ver >= 8 || (devinfo->is_haswell && devinfo->gt == 3)) ? 32 : 16;
const unsigned push_constant_kB = devinfo->max_constant_urb_size_kb;
const bool active[4] = { true, tess_present, tess_present, gs_present };

View file

@ -219,6 +219,7 @@ static const struct intel_device_info intel_device_info_snb_gt2 = {
.has_64bit_float = true, \
.has_surface_tile_offset = true, \
.timestamp_frequency = 12500000, \
.max_constant_urb_size_kb = 16, \
.cs_prefetch_size = 512
static const struct intel_device_info intel_device_info_ivb_gt1 = {
@ -394,6 +395,7 @@ static const struct intel_device_info intel_device_info_hsw_gt3 = {
[MESA_SHADER_GEOMETRY] = 640,
},
},
.max_constant_urb_size_kb = 32,
.simulator_id = 9,
};
@ -419,6 +421,7 @@ static const struct intel_device_info intel_device_info_hsw_gt3 = {
.max_gs_threads = 504, \
.max_wm_threads = 384, \
.timestamp_frequency = 12500000, \
.max_constant_urb_size_kb = 32, \
.cs_prefetch_size = 512
static const struct intel_device_info intel_device_info_bdw_gt1 = {

View file

@ -265,6 +265,12 @@ struct intel_device_info
unsigned max_entries[4];
} urb;
/* Maximum size in Kb that can be allocated to constants in the URB, this
* is usually divided among the stages for implementing push constants.
* See 3DSTATE_PUSH_CONSTANT_ALLOC_*.
*/
unsigned max_constant_urb_size_kb;
/**
* Size of the command streamer prefetch. This is important to know for
* self modifying batches.

View file

@ -28,6 +28,8 @@ main(int argc, char *argv[])
assert(devinfo.num_thread_per_eu != 0);
assert(devinfo.timestamp_frequency != 0);
assert(devinfo.cs_prefetch_size > 0);
assert(devinfo.ver < 7 || devinfo.max_constant_urb_size_kb > 0);
}
return 0;

View file

@ -2501,13 +2501,8 @@ cmd_buffer_alloc_push_constants(struct anv_cmd_buffer *cmd_buffer)
if (stages == cmd_buffer->state.gfx.push_constant_stages)
return;
#if GFX_VER >= 8
const unsigned push_constant_kb = 32;
#elif GFX_VERx10 == 75
const unsigned push_constant_kb = cmd_buffer->device->info.gt == 3 ? 32 : 16;
#else
const unsigned push_constant_kb = 16;
#endif
const unsigned push_constant_kb =
cmd_buffer->device->info.max_constant_urb_size_kb;
const unsigned num_stages =
util_bitcount(stages & VK_SHADER_STAGE_ALL_GRAPHICS);

View file

@ -71,8 +71,7 @@ gfx7_allocate_push_constants(struct brw_context *brw)
bool tess_present = brw->programs[MESA_SHADER_TESS_EVAL];
unsigned avail_size = 16;
unsigned multiplier =
(devinfo->ver >= 8 || (devinfo->is_haswell && devinfo->gt == 3)) ? 2 : 1;
unsigned multiplier = devinfo->max_constant_urb_size_kb / 16;
int stages = 2 + gs_present + 2 * tess_present;