Skip to content

anv: Lower bufferImageGranularity to 1 from 64

Kenneth Graunke requested to merge kwg/mesa:image-granularity into main

The Vulkan 1.3 spec says:

"The implementation-dependent limit bufferImageGranularity specifies a page-like granularity at which linear and non-linear resources must be placed in adjacent memory locations to avoid aliasing. Two resources which do not satisfy this granularity requirement are said to alias. bufferImageGranularity is specified in bytes, and must be a power of two. Implementations which do not impose a granularity restriction may report a bufferImageGranularity value of one.

Note: Despite its name, bufferImageGranularity is really a
granularity between “linear” and “non-linear” resources."

We set this limit to 64 bytes (a cacheline) at the dawn of time, without any real rationale attached. There shouldn't be any restrictions here. Our tile sizes are typically 4K, and tiled resource addresses are aligned to the tile size, and the extent is also a multiple of the tile sized. So if a linear resource occurs before a tiled one, there will naturally be some space due to the alignment of the tiled resource's starting address. If a linear resource occurs after a tiled one, the tiled resource's ending address is already 4K aligned, which is already guaranteeing that they won't share a cacheline.

So I think it should be fine to reduce this to 1. The other Vulkan driver for our hardware seems to advertise 1 here as well.

+@llandwerlin

Merge request reports