Skip to content

OpenCL nir/vtn: Support images/samplers from kernel SPIR-V to nir

Jesse Natalie requested to merge jenatali/mesa:kernel-images-upstream into master

This series is several commits from our in-progress D3D12/DXIL backend. We've been able to use the resulting NIR to generate DXIL that can run real-world kernels that use images, including the full OpenCL 1.2 CTS.

High-level, the series deals with:

  1. OpenCL images are untyped (void return), while loads/stores are typed. This adds untyped images to the GLSL type system, and adds type information to the deref load/store intrinsics. Note that if the CL code called the read_image function and passed a sampler, this ends up constructing a SampledImage and therefore converting the instruction to a tex op, rather than a read/write intrinsic. That means that backends will need to deal with tex ops pointing to images rather than samplers.
  2. There's already some logic in vtn for dealing with passing images/samplers/sampled images through functions, but some minor tweaks were needed to deal with the fact that the kernel entrypoint wrapper wants to use input variables, and how it ends up passing parameters. My strong preference here is to keep the variables as input, since it enables us to match variables to kernel argument metadata more easily.
  3. It adds some new intrinsics to deal with CL-specific format queries. It also handles ImageSizeLod being generated for size queries against CL images.
  4. Literal samplers (OpConstantSampler) need to be handled. This series generates uniform variables with the sampler properties stored in the variable's data.

It's based on !6396 (merged).

/cc @karolherbst @jekstrand

Edited by Jesse Natalie

Merge request reports