From 4b3561b14d70eb09c0459967c66e585a9150a2b1 Mon Sep 17 00:00:00 2001 From: Faith Ekstrand Date: Thu, 25 Apr 2024 10:39:35 -0500 Subject: [PATCH] spirv: Move the printf enable out of capabilities MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Reviewed-by: Konstantin Seurer Reviewed-by: Alyssa Rosenzweig Reviewed-by: Iván Briano Acked-By: Mike Blumenkrantz Part-of: --- src/compiler/shader_info.h | 1 - src/compiler/spirv/nir_spirv.h | 3 +++ src/compiler/spirv/vtn_opencl.c | 2 +- src/gallium/frontends/clover/nir/invocation.cpp | 2 +- src/gallium/frontends/rusticl/mesa/compiler/clc/spirv.rs | 3 ++- src/microsoft/clc/clc_compiler.c | 2 +- 6 files changed, 8 insertions(+), 5 deletions(-) diff --git a/src/compiler/shader_info.h b/src/compiler/shader_info.h index a3117b5e663..7c1e0ab3ef3 100644 --- a/src/compiler/shader_info.h +++ b/src/compiler/shader_info.h @@ -91,7 +91,6 @@ struct spirv_supported_capabilities { bool per_view_attributes_nv; bool physical_storage_buffer_address; bool post_depth_coverage; - bool printf; bool quad_control; bool ray_cull_mask; bool ray_query; diff --git a/src/compiler/spirv/nir_spirv.h b/src/compiler/spirv/nir_spirv.h index 778b8e8a169..71a0d27f569 100644 --- a/src/compiler/spirv/nir_spirv.h +++ b/src/compiler/spirv/nir_spirv.h @@ -85,6 +85,9 @@ struct spirv_to_nir_options { bool amd_trinary_minmax; bool amd_shader_explicit_vertex_parameter; + /* Whether or not printf is supported */ + bool printf; + struct spirv_supported_capabilities caps; /* Address format for various kinds of pointers. */ diff --git a/src/compiler/spirv/vtn_opencl.c b/src/compiler/spirv/vtn_opencl.c index 5785057da1d..b4ace9caa58 100644 --- a/src/compiler/spirv/vtn_opencl.c +++ b/src/compiler/spirv/vtn_opencl.c @@ -788,7 +788,7 @@ static void handle_printf(struct vtn_builder *b, uint32_t opcode, const uint32_t *w_src, unsigned num_srcs, const uint32_t *w_dest) { - if (!b->options->caps.printf) { + if (!b->options->printf) { vtn_push_nir_ssa(b, w_dest[1], nir_imm_int(&b->nb, -1)); return; } diff --git a/src/gallium/frontends/clover/nir/invocation.cpp b/src/gallium/frontends/clover/nir/invocation.cpp index b5e18fbe21c..811cd1fbe65 100644 --- a/src/gallium/frontends/clover/nir/invocation.cpp +++ b/src/gallium/frontends/clover/nir/invocation.cpp @@ -225,7 +225,7 @@ create_spirv_options(const device &dev, std::string &r_log) spirv_options.caps.int64_atomics = dev.has_int64_atomics(); spirv_options.debug.func = &debug_function; spirv_options.debug.private_data = &r_log; - spirv_options.caps.printf = true; + spirv_options.printf = true; return spirv_options; } diff --git a/src/gallium/frontends/rusticl/mesa/compiler/clc/spirv.rs b/src/gallium/frontends/rusticl/mesa/compiler/clc/spirv.rs index 281bc7ed74b..759284597f8 100644 --- a/src/gallium/frontends/rusticl/mesa/compiler/clc/spirv.rs +++ b/src/gallium/frontends/rusticl/mesa/compiler/clc/spirv.rs @@ -328,6 +328,8 @@ impl SPIRVBin { float_controls_execution_mode: float_controls::FLOAT_CONTROLS_DENORM_FLUSH_TO_ZERO_FP32 as u32, + printf: true, + caps: spirv_supported_capabilities { address: true, float16: true, @@ -343,7 +345,6 @@ impl SPIRVBin { kernel_image_read_write: true, linkage: true, literal_sampler: true, - printf: true, ..Default::default() }, diff --git a/src/microsoft/clc/clc_compiler.c b/src/microsoft/clc/clc_compiler.c index de9541ac93f..23fa17db657 100644 --- a/src/microsoft/clc/clc_compiler.c +++ b/src/microsoft/clc/clc_compiler.c @@ -748,6 +748,7 @@ clc_spirv_to_dxil(struct clc_libclc *lib, .shared_addr_format = nir_address_format_32bit_offset_as_64bit, .temp_addr_format = nir_address_format_32bit_offset_as_64bit, .float_controls_execution_mode = FLOAT_CONTROLS_DENORM_FLUSH_TO_ZERO_FP32, + .printf = true, .caps = { .address = true, .float64 = true, @@ -758,7 +759,6 @@ clc_spirv_to_dxil(struct clc_libclc *lib, .kernel_image = true, .kernel_image_read_write = true, .literal_sampler = true, - .printf = true, // These aren't fully supported, but silence warnings about them from // code that doesn't really use them.