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 kernel::optimal_block_size(const command_queue &q, const std::vector &grid_size) const { + if (any_of(is_zero(), grid_size)) + return grid_size; + return factor::find_grid_optimal_factor( q.device().max_threads_per_block(), q.device().max_block_size(), grid_size);