Skip to content

microsoft/clc: Several fixes for CL kernels with images/samplers

We had 3 bugs, likely regressions from when CL kernel args were switched to uniforms during our upstreaming discussions:

  1. nir_lower_vars_to_explicit_types for nir_var_uniform memory was overwriting our computed driver_location. In theory this should produce the same values that we pre-computed, except that the lowering pass took place after manipulating the variable list for image lowering, and messing up the app-provided argument order. Moving this pass for this memory type to before the image lowering resolves that.
  2. Similar to above, if the kernel had inline samplers, these would be uniform variables in the list before the app-provided kernel args, which would also throw off the offset computation. Move them to the end of the variable list to avoid that.
  3. Wrap types for inline samplers used on integer textures were not being assigned correctly.

The last patch somewhat negates the need for fixes for 1 and 2, by making the metadata provided to the CLOn12 runtime come from the variable driver_location after nir_lower_vars_to_explicit_types, however I'd still like to include them, so that the kernel arg layout matches the kernel function signature.

Merge request reports