intel: add INTEL_JAY environment variable

Add a new environment variable controlling which shader stages use the
experimental compiler.

Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/40835>
This commit is contained in:
Kenneth Graunke 2025-12-16 13:34:07 -05:00 committed by Marge Bot
parent 4356ad1bf5
commit 2780a327fa
4 changed files with 40 additions and 0 deletions

View file

@ -271,6 +271,11 @@ brw_get_compiler_config_value(const struct brw_compiler *compiler)
u_foreach_bit64(bit, mask)
insert_u64_bit(&config, (intel_simd & (1ULL << bit)) != 0);
for (unsigned i = 0; i < MESA_VULKAN_SHADER_STAGES; i++) {
insert_u64_bit(&config, intel_use_jay(compiler->devinfo, i) != 0);
bits++;
}
mask = 3;
bits += util_bitcount64(mask);

View file

@ -34,6 +34,7 @@
#include <string.h>
#include "dev/intel_debug.h"
#include "dev/intel_device_info.h"
#include "util/macros.h"
#include "util/u_debug.h"
#include "util/u_math.h"
@ -302,6 +303,31 @@ process_intel_debug_variable_once(void)
BITSET_CLEAR(intel_debug, DEBUG_NO32);
}
static const struct debug_named_value use_jay_options[] = {
{ "vs", BITFIELD_BIT(MESA_SHADER_VERTEX), "Use jay for vertex shaders" },
{ "fs", BITFIELD_BIT(MESA_SHADER_FRAGMENT), "Use jay for fragment shaders" },
{ "cs", BITFIELD_BIT(MESA_SHADER_COMPUTE), "Use jay for compute shaders" },
DEBUG_NAMED_VALUE_END
};
DEBUG_GET_ONCE_FLAGS_OPTION(use_jay, "INTEL_JAY", use_jay_options, 0);
static int use_jay = 0;
bool
intel_use_jay(const struct intel_device_info *devinfo, mesa_shader_stage stage)
{
if (stage == MESA_SHADER_KERNEL)
stage = MESA_SHADER_COMPUTE;
return devinfo->ver == 20 && (use_jay & BITFIELD_BIT(stage));
}
bool
intel_use_jay_any_stage(const struct intel_device_info *devinfo)
{
return devinfo->ver == 20 && use_jay;
}
void
process_intel_debug_variable(void)
{
@ -309,4 +335,6 @@ process_intel_debug_variable(void)
call_once(&process_intel_debug_variable_flag,
process_intel_debug_variable_once);
use_jay = debug_get_option_use_jay();
}

View file

@ -195,6 +195,12 @@ extern uint32_t intel_shader_dump_filter;
extern uint64_t intel_debug_flag_for_shader_stage(mesa_shader_stage stage);
struct intel_device_info;
struct nir_shader;
extern bool intel_use_jay(const struct intel_device_info *devinfo,
mesa_shader_stage stage);
extern bool intel_use_jay_any_stage(const struct intel_device_info *devinfo);
extern void process_intel_debug_variable(void);
#ifdef __cplusplus

View file

@ -31,6 +31,7 @@
#include "util/bitset.h"
#include "util/macros.h"
#include "compiler/shader_enums.h"
#include "intel_debug.h"
#include "intel_kmd.h"
#include "intel/dev/intel_wa.h"