Skip to content

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

Faith Ekstrand requested to merge gfxstrand/mesa:review/fs-ubo-data-cache into master

This is something we've talked about experimenting with for quite some time now but never gotten around to doing it. UBO pulls work different ways on different platforms today:

  • Gen4-5: Indirect UBO pulls are unsupported. All UBO pulls go through DATAPORT_READ
  • Gen6: First platform to support UBO pulls. All UBO pulls in vertex shaders go through the sampler cache. UBO pulls in fragment shaders go through the constant cache for constant offsets and sampler cache (via texelFetch for indirect UBO pulls
  • Gen7+ All constant offset UBO pulls go through the constant cache and all indirect UBO pulls go through the sampler cache via texelFetch.

On Gen6+, when we started supporting UBOs, we got a constant cache and started using that whenever possible. However, we had to use the texture cache for indirect UBO loads in fragment shaders because the dual block load messages we were using with the constant cache don't really work for arbitrary byte offsets. On Gen7+, we got a data cache and a new set of messages. However, the messages we have there are still very limited and, in particular, there's no way to pull a whole vec4 of data at an indirect offset through the constant cache; we'd have to split it into scalars. We could use the untyped surface read messages but those require the data cache (not constant cache) and the data cache on Gen7 is incredibly slow. On Gen8+, the data cache is actually fairly competent so using untyped surface read messages is finally practical.

Hopefully, this will reduce the cache trashing cross-over between the sampler and UBO pulls and maybe we can get better UBO performance. At the very least, it means that we have consistent buffer surface types (FORMAT_RAW) between UBOs and SSBOs which is kind-of nice.

I don't have any perf numbers for this yet (I just got it passing CI) but I hope to soon.

Edited by Faith Ekstrand

Merge request reports