anv: switch from INTEL_DEBUG to ANV_DEBUG for shader-print

Only used by Anv

Signed-off-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/41047>
This commit is contained in:
Lionel Landwerlin 2026-04-06 22:22:29 +03:00
parent 88b4eed4f6
commit 9ab20cc4e4
11 changed files with 20 additions and 13 deletions

View file

@ -998,7 +998,7 @@ VkResult anv_CreateDevice(
if (!device->info->has_64bit_float)
anv_load_fp64_shader(device);
if (INTEL_DEBUG(DEBUG_SHADER_PRINT)) {
if (anv_needs_printf_buffer()) {
result = anv_device_print_init(device);
if (result != VK_SUCCESS)
goto fail_internal_cache;
@ -1140,7 +1140,7 @@ VkResult anv_CreateDevice(
device->companion_rcs_cmd_pool, NULL);
}
fail_print:
if (INTEL_DEBUG(DEBUG_SHADER_PRINT))
if (anv_needs_printf_buffer())
anv_device_print_fini(device);
fail_internal_cache:
vk_pipeline_cache_destroy(device->internal_cache, NULL);
@ -1277,7 +1277,7 @@ void anv_DestroyDevice(
anv_device_finish_descriptors_view(device);
if (INTEL_DEBUG(DEBUG_SHADER_PRINT))
if (anv_needs_printf_buffer())
anv_device_print_fini(device);
vk_pipeline_cache_destroy(device->internal_cache, NULL);

View file

@ -102,6 +102,7 @@ static const struct debug_control debug_control[] = {
{ "shader-hash", ANV_DEBUG_SHADER_HASH},
{ "no-slab", ANV_DEBUG_NO_SLAB},
{ "desc-dirty", ANV_DEBUG_DESCRIPTOR_DIRTY},
{ "shader-print", ANV_DEBUG_SHADER_PRINT},
{ NULL, 0 }
};

View file

@ -173,7 +173,7 @@ compile_shader(struct anv_device *device,
prog_data.base.push_sizes[0] = align(prog_data.base.push_sizes[0], REG_SIZE);
program = brw_compile_fs(compiler, &params);
if (!INTEL_DEBUG(DEBUG_SHADER_PRINT)) {
if (!ANV_DEBUG(SHADER_PRINT)) {
unsigned stat_idx = 0;
if (prog_data.fs.dispatch_8) {
check_sends(&stats[stat_idx++], sends_count_expectation);
@ -204,7 +204,7 @@ compile_shader(struct anv_device *device,
};
program = brw_compile_cs(compiler, &params);
if (!INTEL_DEBUG(DEBUG_SHADER_PRINT)) {
if (!ANV_DEBUG(SHADER_PRINT)) {
check_sends(&stats, sends_count_expectation);
}
}

View file

@ -116,7 +116,7 @@ anv_shader_internal_create(struct anv_device *device,
shader->code = code;
memcpy(shader->code, kernel_data, kernel_size);
if (INTEL_DEBUG(DEBUG_SHADER_PRINT)) {
if (anv_needs_printf_buffer()) {
struct intel_shader_reloc_value reloc_values[3];
uint32_t rv_count = 0;

View file

@ -1799,12 +1799,18 @@ enum anv_debug {
ANV_DEBUG_SHADER_HASH = BITFIELD_BIT(7),
ANV_DEBUG_NO_SLAB = BITFIELD_BIT(8),
ANV_DEBUG_DESCRIPTOR_DIRTY = BITFIELD_BIT(9),
ANV_DEBUG_SHADER_PRINT = BITFIELD_BIT(10),
};
extern enum anv_debug anv_debug;
#define ANV_DEBUG(name) unlikely(anv_debug & ANV_DEBUG_##name)
static inline bool anv_needs_printf_buffer(void)
{
return ANV_DEBUG(SHADER_PRINT);
}
struct anv_instance {
struct vk_instance vk;

View file

@ -95,7 +95,7 @@ anv_queue_init(struct anv_device *device, struct anv_queue *queue,
* submission feature, shader-print feature, or BVH dump.
*/
if (INTEL_DEBUG(DEBUG_SYNC) ||
INTEL_DEBUG(DEBUG_SHADER_PRINT) ||
ANV_DEBUG(SHADER_PRINT) ||
INTEL_DEBUG_BVH_ANY) {
result = vk_sync_create(&device->vk,
&device->physical->sync_syncobj_type,

View file

@ -520,7 +520,7 @@ anv_shader_set_relocs(struct anv_device *device,
};
}
if (INTEL_DEBUG(DEBUG_SHADER_PRINT)) {
if (anv_needs_printf_buffer()) {
struct anv_bo *bo = device->printf.bo;
assert(bo != NULL);

View file

@ -219,7 +219,7 @@ anv_shader_get_spirv_options(struct vk_physical_device *device,
.phys_ssbo_addr_format = nir_address_format_64bit_global,
.push_const_addr_format = nir_address_format_logical,
.printf = INTEL_DEBUG(DEBUG_SHADER_PRINT),
.printf = ANV_DEBUG(SHADER_PRINT),
/* TODO: Consider changing this to an address format that has the NULL
* pointer equals to 0. That might be a better format to play nice
@ -270,7 +270,7 @@ anv_shader_preprocess_nir(struct vk_physical_device *device,
NIR_PASS(_, nir, nir_opt_barrier_modes);
NIR_PASS(_, nir, nir_opt_acquire_release_barriers, SCOPE_QUEUE_FAMILY);
if (INTEL_DEBUG(DEBUG_SHADER_PRINT)) {
if (ANV_DEBUG(SHADER_PRINT)) {
const nir_lower_printf_options printf_opts = {
.ptr_bit_size = 64,
.hash_format_strings = true,

View file

@ -379,7 +379,7 @@ anv_i915_device_check_status(struct vk_device *vk_device)
}
done:
if (INTEL_DEBUG(DEBUG_SHADER_PRINT)) {
if (anv_needs_printf_buffer()) {
VkResult print_result =
vk_check_printf_status(vk_device, &device->printf);
/* Report the device error if there is one, only report the printf error

View file

@ -146,7 +146,7 @@ xe_exec_ioctl_impl(struct anv_queue *queue, struct drm_xe_exec *exec,
int ret = xe_gem_exec_ioctl(device->fd, device->info, exec);
if (ret) {
if (INTEL_DEBUG(DEBUG_SHADER_PRINT))
if (anv_needs_printf_buffer())
vk_check_printf_status(&device->vk, &device->printf);
return vk_queue_set_lost(&queue->vk, "%s(%d) failed: %m", func, line);
}

View file

@ -209,7 +209,7 @@ anv_xe_device_check_status(struct vk_device *vk_device)
}
done:
if (INTEL_DEBUG(DEBUG_SHADER_PRINT)) {
if (anv_needs_printf_buffer()) {
VkResult print_result =
vk_check_printf_status(vk_device, &device->printf);
/* Report the device error if there is one, only report the printf error