From 8a6eb7041ecdf07893ef6f4286d0a3601958f957 Mon Sep 17 00:00:00 2001 From: Qiang Yu Date: Mon, 20 Jan 2025 15:48:45 +0800 Subject: [PATCH] gallium,clover: add compute caps used by clover only MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit To remove ir_type param when get_compute_param. These caps depend on IR type and used by clover only (only clover query with PIPE_SHADER_IR_NATIVE, others query with PIPE_SHADER_IR_NIR). Only r600 and radeonsi support PIPE_SHADER_IR_NATIVE. These caps can be removed when clover is deprecated. Reviewed-by: Alyssa Rosenzweig Acked-by: Marek Olšák Part-of: --- docs/gallium/screen.rst | 4 ++++ src/gallium/drivers/r600/r600_pipe_common.c | 2 ++ src/gallium/drivers/radeonsi/si_get.c | 2 ++ src/gallium/frontends/clover/core/device.cpp | 4 ++-- src/gallium/include/pipe/p_defines.h | 2 ++ 5 files changed, 12 insertions(+), 2 deletions(-) diff --git a/docs/gallium/screen.rst b/docs/gallium/screen.rst index c280596b4fb..93185752e92 100644 --- a/docs/gallium/screen.rst +++ b/docs/gallium/screen.rst @@ -761,11 +761,15 @@ pipe_screen::get_compute_param. units. Value type: ``uint64_t []``. Shader IR type dependent. * ``PIPE_COMPUTE_CAP_MAX_BLOCK_SIZE``: Maximum block size in thread units. Value type: ``uint64_t []``. Shader IR type dependent. +* ``PIPE_COMPUTE_CAP_MAX_BLOCK_SIZE_CLOVER``: Same as ``PIPE_COMPUTE_CAP_MAX_BLOCK_SIZE`` + but used by clover only. * ``PIPE_COMPUTE_CAP_MAX_THREADS_PER_BLOCK``: Maximum number of threads that a single block can contain. Value type: ``uint64_t``. Shader IR type dependent. This may be less than the product of the components of MAX_BLOCK_SIZE and is usually limited by the number of threads that can be resident simultaneously on a compute unit. +* ``PIPE_COMPUTE_CAP_MAX_THREADS_PER_BLOCK_CLOVER``: Same as + ``PIPE_COMPUTE_CAP_MAX_THREADS_PER_BLOCK`` but used by clover only. * ``PIPE_COMPUTE_CAP_MAX_GLOBAL_SIZE``: Maximum size of the GLOBAL resource. Value type: ``uint64_t``. Shader IR type dependent. * ``PIPE_COMPUTE_CAP_MAX_LOCAL_SIZE``: Maximum size of the LOCAL diff --git a/src/gallium/drivers/r600/r600_pipe_common.c b/src/gallium/drivers/r600/r600_pipe_common.c index 432e99b6755..2c8c89a3734 100644 --- a/src/gallium/drivers/r600/r600_pipe_common.c +++ b/src/gallium/drivers/r600/r600_pipe_common.c @@ -896,6 +896,7 @@ static int r600_get_compute_param(struct pipe_screen *screen, return 3 * sizeof(uint64_t) ; case PIPE_COMPUTE_CAP_MAX_BLOCK_SIZE: + case PIPE_COMPUTE_CAP_MAX_BLOCK_SIZE_CLOVER: if (ret) { uint64_t *block_size = ret; unsigned threads_per_block = get_max_threads_per_block(rscreen, ir_type); @@ -906,6 +907,7 @@ static int r600_get_compute_param(struct pipe_screen *screen, return 3 * sizeof(uint64_t); case PIPE_COMPUTE_CAP_MAX_THREADS_PER_BLOCK: + case PIPE_COMPUTE_CAP_MAX_THREADS_PER_BLOCK_CLOVER: if (ret) { uint64_t *max_threads_per_block = ret; *max_threads_per_block = get_max_threads_per_block(rscreen, ir_type); diff --git a/src/gallium/drivers/radeonsi/si_get.c b/src/gallium/drivers/radeonsi/si_get.c index 08ca0e022a1..3abd7829ade 100644 --- a/src/gallium/drivers/radeonsi/si_get.c +++ b/src/gallium/drivers/radeonsi/si_get.c @@ -857,6 +857,7 @@ static int si_get_compute_param(struct pipe_screen *screen, enum pipe_shader_ir return 3 * sizeof(uint64_t); case PIPE_COMPUTE_CAP_MAX_BLOCK_SIZE: + case PIPE_COMPUTE_CAP_MAX_BLOCK_SIZE_CLOVER: if (ret) { uint64_t *block_size = ret; unsigned threads_per_block = get_max_threads_per_block(sscreen, ir_type); @@ -867,6 +868,7 @@ static int si_get_compute_param(struct pipe_screen *screen, enum pipe_shader_ir return 3 * sizeof(uint64_t); case PIPE_COMPUTE_CAP_MAX_THREADS_PER_BLOCK: + case PIPE_COMPUTE_CAP_MAX_THREADS_PER_BLOCK_CLOVER: if (ret) { uint64_t *max_threads_per_block = ret; *max_threads_per_block = get_max_threads_per_block(sscreen, ir_type); diff --git a/src/gallium/frontends/clover/core/device.cpp b/src/gallium/frontends/clover/core/device.cpp index 380ec763182..9b05d5349f3 100644 --- a/src/gallium/frontends/clover/core/device.cpp +++ b/src/gallium/frontends/clover/core/device.cpp @@ -300,7 +300,7 @@ device::max_const_buffers() const { size_t device::max_threads_per_block() const { return get_compute_param( - pipe, ir_format(), PIPE_COMPUTE_CAP_MAX_THREADS_PER_BLOCK)[0]; + pipe, ir_format(), PIPE_COMPUTE_CAP_MAX_THREADS_PER_BLOCK_CLOVER)[0]; } cl_ulong @@ -415,7 +415,7 @@ device::allows_user_pointers() const { std::vector device::max_block_size() const { auto v = get_compute_param(pipe, ir_format(), - PIPE_COMPUTE_CAP_MAX_BLOCK_SIZE); + PIPE_COMPUTE_CAP_MAX_BLOCK_SIZE_CLOVER); return { v.begin(), v.end() }; } diff --git a/src/gallium/include/pipe/p_defines.h b/src/gallium/include/pipe/p_defines.h index b73751467d8..da5ff716127 100644 --- a/src/gallium/include/pipe/p_defines.h +++ b/src/gallium/include/pipe/p_defines.h @@ -801,7 +801,9 @@ enum pipe_compute_cap PIPE_COMPUTE_CAP_GRID_DIMENSION, PIPE_COMPUTE_CAP_MAX_GRID_SIZE, PIPE_COMPUTE_CAP_MAX_BLOCK_SIZE, + PIPE_COMPUTE_CAP_MAX_BLOCK_SIZE_CLOVER, PIPE_COMPUTE_CAP_MAX_THREADS_PER_BLOCK, + PIPE_COMPUTE_CAP_MAX_THREADS_PER_BLOCK_CLOVER, PIPE_COMPUTE_CAP_MAX_GLOBAL_SIZE, PIPE_COMPUTE_CAP_MAX_LOCAL_SIZE, PIPE_COMPUTE_CAP_MAX_PRIVATE_SIZE,