OpenCL nir/vtn: Support images/samplers from kernel SPIR-V to nir
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:
- 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 aSampledImage
and therefore converting the instruction to atex
op, rather than a read/write intrinsic. That means that backends will need to deal with tex ops pointing to images rather than samplers. - 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 asinput
, since it enables us to match variables to kernel argument metadata more easily. - It adds some new intrinsics to deal with CL-specific format queries. It also handles
ImageSizeLod
being generated for size queries against CL images. - Literal samplers (
OpConstantSampler
) need to be handled. This series generatesuniform
variables with the sampler properties stored in the variable's data.
It's based on !6396 (merged).
/cc @karolherbst @jekstrand