From: Paulo Zanoni Date: Sat, 29 Feb 2020 00:03:02 +0000 (-0800) Subject: anv: multiply the scratch space by 4 on gen9-10 like iris and i965 X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=62f7197fb54d2fbb7bd5646115008d3c27a3dfb9;p=mesa.git anv: multiply the scratch space by 4 on gen9-10 like iris and i965 My understanding is that there's no reason for the scratch space allocation to be different between iris, i965 and anv. Let's make all the functions behave the same. I don't know if this fixes any specific gen9 bugs, it it might since it increases the scratch space. v2: Rebase. v3: Rebase. v4: Remove redundant gen 11 check (Jason). Reviewed-by: Jason Ekstrand Reviewed-by: Lionel Landwerlin Signed-off-by: Paulo Zanoni Tested-by: Marge Bot Part-of: --- diff --git a/src/intel/vulkan/anv_allocator.c b/src/intel/vulkan/anv_allocator.c index f698289155b..4ab5827623e 100644 --- a/src/intel/vulkan/anv_allocator.c +++ b/src/intel/vulkan/anv_allocator.c @@ -1397,12 +1397,26 @@ anv_scratch_pool_alloc(struct anv_device *device, struct anv_scratch_pool *pool, unsigned subslices = MAX2(device->physical->subslice_total, 1); - /* For, Gen11+, scratch space allocation is based on the number of threads - * in the base configuration. */ + /* 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 Gen11+. + * + * For, Gen11+, scratch space allocation is based on the number of threads + * in the base configuration. + */ if (devinfo->gen >= 12) subslices = devinfo->num_subslices[0]; else if (devinfo->gen == 11) subslices = 8; + else if (devinfo->gen >= 9) + subslices = 4 * devinfo->num_slices; unsigned scratch_ids_per_subslice; if (devinfo->gen >= 12) {