diff options
author | Francisco Jerez <[email protected]> | 2012-05-12 19:24:09 +0200 |
---|---|---|
committer | Francisco Jerez <[email protected]> | 2012-05-12 19:43:01 +0200 |
commit | fcab4d4a34a28ec153612e41d5850884c5ccbfb9 (patch) | |
tree | 9de0511a1e9f95ae388b20c769396acd7e1ff1c6 /src | |
parent | 5c9bccc97e9fb0776f2ca5bb57e55116a7efb43b (diff) |
clover: Check the total work-group size provided to clEnqueueNDRangeKernel.
Diffstat (limited to 'src')
-rw-r--r-- | src/gallium/state_trackers/clover/api/kernel.cpp | 27 |
1 files changed, 17 insertions, 10 deletions
diff --git a/src/gallium/state_trackers/clover/api/kernel.cpp b/src/gallium/state_trackers/clover/api/kernel.cpp index 44eeb277127..ab4982d2951 100644 --- a/src/gallium/state_trackers/clover/api/kernel.cpp +++ b/src/gallium/state_trackers/clover/api/kernel.cpp @@ -223,16 +223,23 @@ namespace { if (!grid_size || any_of(is_zero<size_t>(), grid_size, grid_size + dims)) throw error(CL_INVALID_GLOBAL_WORK_SIZE); - if (block_size && any_of([](size_t b, size_t max) { - return b == 0 || b > max; - }, block_size, block_size + dims, - q->dev.max_block_size().begin())) - throw error(CL_INVALID_WORK_ITEM_SIZE); - - if (block_size && any_of([](size_t b, size_t g) { - return g % b; - }, block_size, block_size + dims, grid_size)) - throw error(CL_INVALID_WORK_GROUP_SIZE); + if (block_size) { + if (any_of([](size_t b, size_t max) { + return b == 0 || b > max; + }, block_size, block_size + dims, + q->dev.max_block_size().begin())) + throw error(CL_INVALID_WORK_ITEM_SIZE); + + if (any_of([](size_t b, size_t g) { + return g % b; + }, block_size, block_size + dims, grid_size)) + throw error(CL_INVALID_WORK_GROUP_SIZE); + + if (fold(std::multiplies<size_t>(), 1u, + block_size, block_size + dims) > + q->dev.max_threads_per_block()) + throw error(CL_INVALID_WORK_GROUP_SIZE); + } } /// |