27 lines · plain
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-exception6//7//===----------------------------------------------------------------------===//8 9#include <clc/opencl/workitem/get_num_groups.h>10 11uint __clc_r600_get_num_groups_x(void) __asm("llvm.r600.read.ngroups.x");12uint __clc_r600_get_num_groups_y(void) __asm("llvm.r600.read.ngroups.y");13uint __clc_r600_get_num_groups_z(void) __asm("llvm.r600.read.ngroups.z");14 15_CLC_DEF _CLC_OVERLOAD size_t get_num_groups(uint dim) {16 switch (dim) {17 case 0:18 return __clc_r600_get_num_groups_x();19 case 1:20 return __clc_r600_get_num_groups_y();21 case 2:22 return __clc_r600_get_num_groups_z();23 default:24 return 1;25 }26}27