mesa/src/intel/vulkan/anv_nir_lower_unaligned_dispatch.c
Sagar Ghuge cac3b4f404
Some checks are pending
macOS-CI / macOS-CI (dri) (push) Waiting to run
macOS-CI / macOS-CI (xlib) (push) Waiting to run
anv: Mask off excessive invocations
For unaligned invocations, don't launch two COMPUTE_WALKER, instead we
can mask off excessive invocations in the shader itself at nir level and
launch one additional workgroup.

Signed-off-by: Sagar Ghuge <sagar.ghuge@intel.com>
Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/36245>
2025-08-12 23:17:02 +00:00

28 lines
802 B
C

/*
* Copyright 2025 Intel Corporation
* SPDX-License-Identifier: MIT
*/
#include "anv_nir.h"
#include "nir_builder.h"
#include "compiler/brw_nir.h"
bool
anv_nir_lower_unaligned_dispatch(nir_shader *shader)
{
nir_function_impl *impl = nir_shader_get_entrypoint(shader);
nir_builder b = nir_builder_at(nir_before_impl(impl));
nir_def *global_idx = nir_channel(&b, nir_load_global_invocation_id(&b, 32), 0);
nir_def *max_unaligned_invocations_x =
nir_load_inline_data_intel(&b, 1, 32,
.base = ANV_INLINE_PARAM_UNALIGNED_INVOCATIONS_X_OFFSET);
nir_push_if(&b, nir_uge(&b, global_idx, max_unaligned_invocations_x));
{
nir_jump(&b, nir_jump_return);
}
nir_pop_if(&b, NULL);
return nir_progress(true, impl, nir_metadata_none);
}