Skip to content

spirv,nir: Respect variable alignments

Faith Ekstrand requested to merge gfxstrand/mesa:nir/cl-var-alignment into main

In OpenCL C, __attribute__((aligned(N))) turns into an Alignment decoration on the pointer returned by OpVariable. We need to plumb that through into nir_lower_vars_to_explicit_types() to ensure that variables get nicely aligned offsets. Otherwise, alignment decorations provided by the client elsewhere might not be valid if they assume that __attribute__((aligned(N))) is respected.

Unfortunately, the SPIR-V spec and the OpenCL environment spec for SPIR-V say absolutely nothing about what Alignment on an OpVariable actually means. 🤡

Edited by Faith Ekstrand

Merge request reports