Mesa (main): clover: fix api zero sized enqueue
GitLab Mirror
gitlab-mirror at kemper.freedesktop.org
Mon Aug 9 19:24:02 UTC 2021
Module: Mesa
Branch: main
Commit: 3106a340a01cf4a760d828e38d560ed6044e100a
URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=3106a340a01cf4a760d828e38d560ed6044e100a
Author: Dave Airlie <airlied at redhat.com>
Date: Tue Oct 13 14:17:00 2020 +1000
clover: fix api zero sized enqueue
Reviewed-by: Karol Herbst <kherbst at redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/12225>
---
src/gallium/frontends/clover/api/kernel.cpp | 3 ---
src/gallium/frontends/clover/core/kernel.cpp | 7 +++++++
2 files changed, 7 insertions(+), 3 deletions(-)
diff --git a/src/gallium/frontends/clover/api/kernel.cpp b/src/gallium/frontends/clover/api/kernel.cpp
index d172750481e..c937642fccf 100644
--- a/src/gallium/frontends/clover/api/kernel.cpp
+++ b/src/gallium/frontends/clover/api/kernel.cpp
@@ -271,9 +271,6 @@ namespace {
if (dims < 1 || dims > q.device().max_block_size().size())
throw error(CL_INVALID_WORK_DIMENSION);
- if (!d_grid_size || any_of(is_zero(), grid_size))
- throw error(CL_INVALID_GLOBAL_WORK_SIZE);
-
return grid_size;
}
diff --git a/src/gallium/frontends/clover/core/kernel.cpp b/src/gallium/frontends/clover/core/kernel.cpp
index 5d8b0452563..894b3bfffe2 100644
--- a/src/gallium/frontends/clover/core/kernel.cpp
+++ b/src/gallium/frontends/clover/core/kernel.cpp
@@ -67,6 +67,10 @@ kernel::launch(command_queue &q,
const auto m = program().build(q.device()).binary;
const auto reduced_grid_size =
map(divides(), grid_size, block_size);
+
+ if (any_of(is_zero(), grid_size))
+ return;
+
void *st = exec.bind(&q, grid_offset);
struct pipe_grid_info info = {};
@@ -137,6 +141,9 @@ kernel::name() const {
std::vector<size_t>
kernel::optimal_block_size(const command_queue &q,
const std::vector<size_t> &grid_size) const {
+ if (any_of(is_zero(), grid_size))
+ return grid_size;
+
return factor::find_grid_optimal_factor<size_t>(
q.device().max_threads_per_block(), q.device().max_block_size(),
grid_size);
More information about the mesa-commit
mailing list