Module: Mesa
Branch: main
Commit: ced9d5d63575235c3a2171dd71876fcccb390065
URL:    
http://cgit.freedesktop.org/mesa/mesa/commit/?id=ced9d5d63575235c3a2171dd71876fcccb390065

Author: Karol Herbst <[email protected]>
Date:   Thu Feb 16 15:46:30 2023 +0100

rusticl/device: limit CL_DEVICE_MAX_CONSTANT_ARGS

At the moment we implement constant memory as normal global memory, but
we still should limit to the actual constant buffer cap once we properly
use UBOs for that.

Signed-off-by: Karol Herbst <[email protected]>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/20161>

---

 src/gallium/frontends/rusticl/api/device.rs  | 2 +-
 src/gallium/frontends/rusticl/core/device.rs | 4 ++++
 2 files changed, 5 insertions(+), 1 deletion(-)

diff --git a/src/gallium/frontends/rusticl/api/device.rs 
b/src/gallium/frontends/rusticl/api/device.rs
index ae094dd49b1..3cc72a9278d 100644
--- a/src/gallium/frontends/rusticl/api/device.rs
+++ b/src/gallium/frontends/rusticl/api/device.rs
@@ -97,7 +97,7 @@ impl CLInfo<cl_device_info> for cl_device_id {
             CL_DEVICE_MAX_CLOCK_FREQUENCY => 
cl_prop::<cl_uint>(dev.max_clock_freq()),
             CL_DEVICE_MAX_COMPUTE_UNITS => 
cl_prop::<cl_uint>(dev.max_compute_units()),
             // TODO atm implemented as mem_const
-            CL_DEVICE_MAX_CONSTANT_ARGS => cl_prop::<cl_uint>(1024),
+            CL_DEVICE_MAX_CONSTANT_ARGS => 
cl_prop::<cl_uint>(dev.const_max_count()),
             CL_DEVICE_MAX_CONSTANT_BUFFER_SIZE => 
cl_prop::<cl_ulong>(dev.const_max_size()),
             CL_DEVICE_MAX_GLOBAL_VARIABLE_SIZE => cl_prop::<usize>(0),
             CL_DEVICE_MAX_MEM_ALLOC_SIZE => 
cl_prop::<cl_ulong>(dev.max_mem_alloc()),
diff --git a/src/gallium/frontends/rusticl/core/device.rs 
b/src/gallium/frontends/rusticl/core/device.rs
index efcb6535625..dfd6fc22a4b 100644
--- a/src/gallium/frontends/rusticl/core/device.rs
+++ b/src/gallium/frontends/rusticl/core/device.rs
@@ -542,6 +542,10 @@ impl Device {
         )
     }
 
+    pub fn const_max_count(&self) -> cl_uint {
+        self.shader_param(pipe_shader_cap::PIPE_SHADER_CAP_MAX_CONST_BUFFERS) 
as cl_uint
+    }
+
     pub fn device_type(&self, internal: bool) -> cl_device_type {
         if let Some(env) = Self::parse_env_device_type() {
             return env;

Reply via email to