intel/brw: Add a maximum scratch size restriction

Gfx 12.5 moved scratch to a surface and SURFTYPE_SCRATCH has this pitch
restriction:

RENDER_SURFACE_STATE::Surface Pitch
   For surfaces of type SURFTYPE_SCRATCH, valid range of pitch is:
   [63,262143] -> [64B, 256KB]

The pitch of the surface is the scratch size per thread and the surface
should be large enough to accommodate every physical thread.

So here adding a new field to intel_device_info, setting it in
intel_device_info_init_common() so even offline tools can have it set.
And finally adding a check to fail shader compilation if needed
scratch is larger than supported.

This issue can be reproduced in debug builds when running
dEQP-VK.protected_memory.stack.stacksize_1024 on Gfx 12.5 or newer
platforms.

Ref: BSpec 43862 (r52666)
Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Signed-off-by: José Roberto de Souza <jose.souza@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/30271>
This commit is contained in:
José Roberto de Souza
2024-07-19 10:55:59 -07:00
committed by Marge Bot
parent c65a76db85
commit de5d767f9a
3 changed files with 29 additions and 9 deletions
+14
View File
@@ -1615,6 +1615,20 @@ intel_device_info_init_common(int pci_id, bool building,
devinfo->max_constant_urb_size_kb / 2;
}
/*
* Gfx 12.5 moved scratch to a surface and SURFTYPE_SCRATCH has this pitch
* restriction:
*
* BSpec 43862 (r52666)
* RENDER_SURFACE_STATE::Surface Pitch
* For surfaces of type SURFTYPE_SCRATCH, valid range of pitch is:
* [63,262143] -> [64B, 256KB]
*
* The pitch of the surface is the scratch size per thread and the surface
* should be large enough to accommodate every physical thread.
*/
devinfo->max_scratch_size_per_thread = devinfo->verx10 >= 125 ?
(256 * 1024) : (2 * 1024 * 1024);
intel_device_info_update_cs_workgroup_threads(devinfo);
return true;
+2
View File
@@ -467,6 +467,8 @@ Struct("intel_device_info",
implementation details, the range of scratch ids may be larger than the
number of subslices.""")),
Member("uint32_t", "max_scratch_size_per_thread", compiler_field=True),
Member("intel_device_info_urb_desc", "urb"),
Member("unsigned", "max_constant_urb_size_kb"),
Member("unsigned", "mesh_max_constant_urb_size_kb"),