anv: Use the data cache for indirect UBO pulls on Gen8+

On Gen7, the data cache is pretty terrible so we'd rather avoid it
there.  On Gen8+, it should be fine and is less likely to conflict with
texturing so we should get less cache thrashing there.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/3932>
This commit is contained in:
Jason Ekstrand 2020-02-21 11:45:37 -06:00
parent 89f3d116a8
commit b54d37a867
3 changed files with 7 additions and 2 deletions

View file

@ -981,7 +981,8 @@ anv_isl_format_for_descriptor_type(const struct anv_device *device,
switch (type) {
case VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER:
case VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER_DYNAMIC:
return ISL_FORMAT_R32G32B32A32_FLOAT;
return device->physical->compiler->indirect_ubos_use_sampler ?
ISL_FORMAT_R32G32B32A32_FLOAT : ISL_FORMAT_RAW;
case VK_DESCRIPTOR_TYPE_STORAGE_BUFFER:
case VK_DESCRIPTOR_TYPE_STORAGE_BUFFER_DYNAMIC:

View file

@ -509,6 +509,7 @@ anv_physical_device_try_create(struct anv_instance *instance,
device->info.gen < 8 || !device->has_context_isolation;
device->compiler->supports_shader_constants = true;
device->compiler->compact_params = false;
device->compiler->indirect_ubos_use_sampler = device->info.gen <= 7;
/* Broadwell PRM says:
*

View file

@ -2607,7 +2607,10 @@ anv_pipe_invalidate_bits_for_access_flags(struct anv_device *device,
* port) to avoid stale data.
*/
pipe_bits |= ANV_PIPE_CONSTANT_CACHE_INVALIDATE_BIT;
pipe_bits |= ANV_PIPE_TEXTURE_CACHE_INVALIDATE_BIT;
if (device->physical->compiler->indirect_ubos_use_sampler)
pipe_bits |= ANV_PIPE_TEXTURE_CACHE_INVALIDATE_BIT;
else
pipe_bits |= ANV_PIPE_DATA_CACHE_FLUSH_BIT;
break;
case VK_ACCESS_SHADER_READ_BIT:
case VK_ACCESS_INPUT_ATTACHMENT_READ_BIT: