clover/nir: Use lower_vars_to_explicit for uniform and global Reviewed-by: Jesse Natalie <jenatali@microsoft.com> Reviewed-by: Karol Herbst <kherbst@redhat.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6472>
clover: Use args.size() to compute new var locations This is better than using num_uniforms as it guarantees what we want: a mapping from nir_variable to the args vector. Reviewed-by: Karol Herbst <kherbst@redhat.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6472>
clover: Call nir_lower_mem_constant_vars Fixes: 26a4c8f375e "clover/nir: Use nir_var_mem_constant for..." Reviewed-by: Karol Herbst <kherbst@redhat.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6472>
clover: Use 64-bit offsets for shader_in on 64-bit GPUs This really shouldn't matter as inputs should have logical pointers. However, nir_builder defaults to building derefs based on the pointer size in the shader_info. It's easier for now to just be consistent everywhere. Reviewed-by: Karol Herbst <kherbst@redhat.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6379>
clover/nir: Use nir_var_mem_constant for __constant memory Reviewed-by: Eric Anholt <eric@anholt.net> Reviewed-by: Jesse Natalie <jenatali@microsoft.com> Reviewed-by: Karol Herbst <kherbst@redhat.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6379>
clover/nir: use offset for temp memory Signed-off-by: Karol Herbst <kherbst@redhat.com> Reviewed-by: Jason Ekstrand <jason@jlekstrand.net> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6433>
clover/nir: Lower function_temp to scratch. Signed-off-by: Karol Herbst <kherbst@redhat.com> Reviewed-by: Jesse Natalie <jenatali@microsoft.com> Reviewed-by: Boris Brezillon <boris.brezillon@collabora.com> Reviewed-by: Jason Ekstrand <jason@jlekstrand.net> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6433>
nir: use enum operator helper for nir_variable_mode and nir_metadata those are used quite a bit Signed-off-by: Karol Herbst <kherbst@redhat.com> Reviewed-by: Jason Ekstrand <jason@jlekstrand.net> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6520>
clover/nir/spirv: Use uniform rather than shader_in for kernel inputs The semantics of inputs for CL are a closer match to the semantics of uniforms for graphics. Rather than cross-stage data, it's data that every thread sees uniformly. Reviewed-by: Jason Ekstrand <jason@jlekstrand.net> Reviewed-by: Karol Herbst <kherbst@redhat.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6497>
clover/nir: add support for global invocation id offsets v2: create variables only once Signed-off-by: Karol Herbst <kherbst@redhat.com> Acked-by: Jesse Natalie <jenatali@microsoft.com> Acked-by: Jason Ekstrand <jason@jlekstrand.net> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5891>
nir: Add options to nir_lower_compute_system_values to control compute ID base lowering If no options are provided, existing intrinsics are used. If the lowering pass indicates there should be offsets used for global invocation ID or work group ID, then those instructions are lowered to include the offset. Reviewed-by: Jason Ekstrand <jason@jlekstrand.net> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5891>
nir: Move compute system value lowering to a separate pass The actual variable -> intrinsic lowering stays where it is, but ops which convert one intrinsic to be implemented in terms of another have moved. Reviewed-by: Karol Herbst <kherbst@redhat.com> Reviewed-by: Jason Ekstrand <jason@jlekstrand.net> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5891>
clover/nir: Register callback for translation messages (v2) This allows us to add SPIR-V to NIR translation failure messages to the program’s compilation log, which can then be queried by the user. v2: Replace the if-statement in `debug_function()` with an assert. Signed-off-by: Pierre Moreau <dev@pmoreau.org> Reviewed-by: Serge Martin <edb@sigluy.net> Reviewed-by: Francisco Jerez <currojerez@riseup.net> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5038>
clover/nir: Use the correct address mode for shared Shared memory needs to have 64-bit pointers but we want 32-bit offsets most of the time. This is exactly what 32bit_offset_as_64bit is for. Reviewed-by: Karol Herbst <kherbst@redhat.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6367>
clover/nir: Stop computing the global address format twice Reviewed-by: Karol Herbst <kherbst@redhat.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6367>
clover/nir: Stop setting ubo_addr_format We unconditionally set constant_as_global = true so we should never get UBO access out of spirv_to_nir. Reviewed-by: Karol Herbst <kherbst@redhat.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6367>
clover/nir: support int64 atomics if the device supports it Signed-off-by: Karol Herbst <kherbst@redhat.com> Reviewed-by: Jesse Natalie <jenatali@microsoft.com> Reviewed-by: Boris Brezillon <boris.brezillon@collabora.com> Reviewed-by: Pierre Moreau <dev@pmoreau.org> Reviewed-by: Jason Ekstrand <jason@jlekstrand.net> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6367>
clover/nir: Call vars_to_explicit_types for shared memory This is required for shared memory buffers declared with an explicit size inside the kernel. Signed-off-by: Karol Herbst <kherbst@redhat.com> Reviewed-by: Jesse Natalie <jenatali@microsoft.com> Reviewed-by: Boris Brezillon <boris.brezillon@collabora.com> Reviewed-by: Jason Ekstrand <jason@jlekstrand.net> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6367>
nir/vtn: CL SPIR-V callers should specify address modes Instead of inferring the address mode from the environment, allows callers to override to suit their needs. Reviewed-by: Jason Ekstrand <jason@jlekstrand.net> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6330>
clover/nir: fix mem_shared by using address_format_32bit_offset Signed-off-by: Karol Herbst <kherbst@redhat.com> Reviewed-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6325>