clover: fix api zero sized enqueue

Reviewed-by: Karol Herbst <kherbst@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/12225>
This commit is contained in:
Dave Airlie
2020-10-13 14:17:00 +10:00
committed by Marge Bot
parent 7ae3881a4b
commit 3106a340a0
2 changed files with 7 additions and 3 deletions
@@ -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;
}
@@ -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);