intel/devinfo: Add devinfo->max_scratch_ids
This consolidates several duplicated pieces of code into devinfo. max_scratch_ids is an array that provides the max number of threads for the rendering and compute stages. This fixes some exceptions missed by crocus for scratch ids on haswell and cherryview. It also fills out devinfo->max_scratch_ids properly for stages VS through CS on Gfx12.5. But, functionally this should not make a difference as Gfx12.5 already uses COMPUTE for all stages. Signed-off-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/12799>
This commit is contained in:
@@ -2320,62 +2320,9 @@ iris_get_scratch_space(struct iris_context *ice,
|
||||
|
||||
struct iris_bo **bop = &ice->shaders.scratch_bos[encoded_size][stage];
|
||||
|
||||
/* The documentation for 3DSTATE_PS "Scratch Space Base Pointer" says:
|
||||
*
|
||||
* "Scratch Space per slice is computed based on 4 sub-slices. SW
|
||||
* must allocate scratch space enough so that each slice has 4
|
||||
* slices allowed."
|
||||
*
|
||||
* According to the other driver team, this applies to compute shaders
|
||||
* as well. This is not currently documented at all.
|
||||
*
|
||||
* This hack is no longer necessary on Gfx11+.
|
||||
*
|
||||
* For, Gfx11+, scratch space allocation is based on the number of threads
|
||||
* in the base configuration.
|
||||
*/
|
||||
unsigned subslice_total = devinfo->subslice_total;
|
||||
if (devinfo->verx10 == 125)
|
||||
subslice_total = 32;
|
||||
else if (devinfo->ver == 12)
|
||||
subslice_total = (devinfo->is_dg1 || devinfo->gt == 2 ? 6 : 2);
|
||||
else if (devinfo->ver == 11)
|
||||
subslice_total = 8;
|
||||
else if (devinfo->ver < 11)
|
||||
subslice_total = 4 * devinfo->num_slices;
|
||||
assert(subslice_total >= devinfo->subslice_total);
|
||||
|
||||
if (!*bop) {
|
||||
unsigned scratch_ids_per_subslice = devinfo->max_cs_threads;
|
||||
|
||||
if (devinfo->ver >= 12) {
|
||||
/* Same as ICL below, but with 16 EUs. */
|
||||
scratch_ids_per_subslice = 16 * 8;
|
||||
} else if (devinfo->ver == 11) {
|
||||
/* The MEDIA_VFE_STATE docs say:
|
||||
*
|
||||
* "Starting with this configuration, the Maximum Number of
|
||||
* Threads must be set to (#EU * 8) for GPGPU dispatches.
|
||||
*
|
||||
* Although there are only 7 threads per EU in the configuration,
|
||||
* the FFTID is calculated as if there are 8 threads per EU,
|
||||
* which in turn requires a larger amount of Scratch Space to be
|
||||
* allocated by the driver."
|
||||
*/
|
||||
scratch_ids_per_subslice = 8 * 8;
|
||||
}
|
||||
|
||||
uint32_t max_threads[] = {
|
||||
[MESA_SHADER_VERTEX] = devinfo->max_vs_threads,
|
||||
[MESA_SHADER_TESS_CTRL] = devinfo->max_tcs_threads,
|
||||
[MESA_SHADER_TESS_EVAL] = devinfo->max_tes_threads,
|
||||
[MESA_SHADER_GEOMETRY] = devinfo->max_gs_threads,
|
||||
[MESA_SHADER_FRAGMENT] = devinfo->max_wm_threads,
|
||||
[MESA_SHADER_COMPUTE] = scratch_ids_per_subslice * subslice_total,
|
||||
};
|
||||
|
||||
uint32_t size = per_thread_scratch * max_threads[stage];
|
||||
|
||||
assert(stage < ARRAY_SIZE(devinfo->max_scratch_ids));
|
||||
uint32_t size = per_thread_scratch * devinfo->max_scratch_ids[stage];
|
||||
*bop = iris_bo_alloc(bufmgr, "scratch", size, 1, IRIS_MEMZONE_SHADER, 0);
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user