| 1 |
//===----------------------------------------------------------------------===// |
| 2 |
// |
| 3 |
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. |
| 4 |
// See https://llvm.org/LICENSE.txt for license information. |
| 5 |
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception |
| 6 |
// |
| 7 |
//===----------------------------------------------------------------------===// |
| 8 |
|
| 9 |
#include <clc/opencl/workitem/get_global_size.h> |
| 10 |
#include <clc/opencl/workitem/get_local_size.h> |
| 11 |
#include <clc/opencl/workitem/get_num_groups.h> |
| 12 |
|
| 13 |
_CLC_DEF _CLC_OVERLOAD size_t get_num_groups(uint dim) { |
| 14 |
size_t global_size = get_global_size(dim); |
| 15 |
size_t local_size = get_local_size(dim); |
| 16 |
size_t num_groups = global_size / local_size; |
| 17 |
if (global_size % local_size != 0) { |
| 18 |
num_groups++; |
| 19 |
} |
| 20 |
return num_groups; |
| 21 |
} |