Skip to content

Preliminary read-only kernel image support

Jesse Natalie requested to merge jenatali/mesa:ms/kernel-images into msclc-d3d12

This changeset adds support for producing valid DXIL with reasonable metadata for read-only images which are only read from without a sampler.

The first two commits deal with the SPIR-V to NIR path for kernels. Part of this is taken from karolherbst/mesa@c062b2c0, though I have a slightly different approach for dealing with images as function arguments, keeping them as derefs. A couple things:

  • DXIL requires SRVs and UAVs to be typed. For reads/writes without samplers, the deref-based load/store intrinsics don't provide enough type information as-is, since they expect the resulting image variable to be typed. Since CL images are untyped, I added type information to these deref load/store intrinsics, so that I can lower the CL images to appropriately-typed variables later on.
  • The SPIR-V treats images as being in the uniform address space, even though they're passed to the kernel as function arguments. Due to the way that our CLC component deals with metadata, I want to keep the image variables in the list of inputs, which means that all references to images should be in the shader-input address space, to avoid any non-trivial deref-casts getting inserted during the conversion. I'm open to feedback on alternate approaches here.

The next commit does some minor cleanup to the CLC frontent. The next two address existing shortcomings with the DXIL backend. The final series adds a lowering pass to convert images from kernel format (inputs with no format) to uniforms that the DXIL backend will like (samplers with formats), and then computing metadata for how to bind them. Lastly, some basic tests which stress the full compilation chain, ensuring we have valid DXIL. I didn't update the test harness to support actually creating/binding images, since I expect us to be able to use the CTS for that soon.

While this isn't full image support, this already seems large and self-contained enough that it seems worth merging ahead of full support.

/cc @daniels @kusma @bbrezillon @karolherbst

Edited by Jesse Natalie

Merge request reports

Loading