Skip to content

Commit 28aa5a6

Browse files
authored
[libclc] Declare workitem built-ins in clc, move ptx-nvidiacl workitem built-ins into clc (#144333)
Changes in this PR: * Declare most of workitem functions in clc and opencl folders. * Call clc workitem function in corresponding OpenCL workitem function. * Move ptx-nvidiacl workitem built-in implementations into clc. * Move a few amdgcn workitem built-in implementations into clc. * Include only needed headers in OpenCL workitem functions. * Implement get_local_linear_id, get_max_sub_group_size, get_num_sub_groups, get_sub_group_id, get_sub_group_local_id, get_sub_group_size for ptx-nvidiacl. llvm-diff shows this PR adds a few new symbols to nvptx64--nvidiacl.bc. llvm-diff shows no change to amdgcn--amdhsa.bc, nvptx--.bc and nvptx64--.bc.
1 parent 03b0ae8 commit 28aa5a6

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

56 files changed

+781
-103
lines changed
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
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+
#ifndef __CLC_WORKITEM_CLC_GET_GLOBAL_ID_H__
10+
#define __CLC_WORKITEM_CLC_GET_GLOBAL_ID_H__
11+
12+
#include <clc/internal/clc.h>
13+
14+
_CLC_OVERLOAD _CLC_DECL size_t __clc_get_global_id(uint dim);
15+
16+
#endif // __CLC_WORKITEM_CLC_GET_GLOBAL_ID_H__
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
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+
#ifndef __CLC_WORKITEM_CLC_GET_GLOBAL_OFFSET_H__
10+
#define __CLC_WORKITEM_CLC_GET_GLOBAL_OFFSET_H__
11+
12+
#include <clc/internal/clc.h>
13+
14+
_CLC_OVERLOAD _CLC_DECL size_t __clc_get_global_offset(uint dim);
15+
16+
#endif // __CLC_WORKITEM_CLC_GET_GLOBAL_OFFSET_H__
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
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+
#ifndef __CLC_WORKITEM_CLC_GET_GLOBAL_SIZE_H__
10+
#define __CLC_WORKITEM_CLC_GET_GLOBAL_SIZE_H__
11+
12+
#include <clc/internal/clc.h>
13+
14+
_CLC_OVERLOAD _CLC_DECL size_t __clc_get_global_size(uint dim);
15+
16+
#endif // __CLC_WORKITEM_CLC_GET_GLOBAL_SIZE_H__
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
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+
#ifndef __CLC_WORKITEM_CLC_GET_GROUP_ID_H__
10+
#define __CLC_WORKITEM_CLC_GET_GROUP_ID_H__
11+
12+
#include <clc/internal/clc.h>
13+
14+
_CLC_OVERLOAD _CLC_DECL size_t __clc_get_group_id(uint dim);
15+
16+
#endif // __CLC_WORKITEM_CLC_GET_GROUP_ID_H__
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
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+
#ifndef __CLC_WORKITEM_CLC_GET_LOCAL_ID_H__
10+
#define __CLC_WORKITEM_CLC_GET_LOCAL_ID_H__
11+
12+
#include <clc/internal/clc.h>
13+
14+
_CLC_OVERLOAD _CLC_DECL size_t __clc_get_local_id(uint dim);
15+
16+
#endif // __CLC_WORKITEM_CLC_GET_LOCAL_ID_H__
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
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+
#ifndef __CLC_WORKITEM_CLC_GET_LOCAL_LINEAR_ID_H__
10+
#define __CLC_WORKITEM_CLC_GET_LOCAL_LINEAR_ID_H__
11+
12+
#include <clc/internal/clc.h>
13+
14+
_CLC_OVERLOAD _CLC_DECL size_t __clc_get_local_linear_id();
15+
16+
#endif // __CLC_WORKITEM_CLC_GET_LOCAL_LINEAR_ID_H__
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
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+
#ifndef __CLC_WORKITEM_CLC_GET_LOCAL_SIZE_H__
10+
#define __CLC_WORKITEM_CLC_GET_LOCAL_SIZE_H__
11+
12+
#include <clc/internal/clc.h>
13+
14+
_CLC_OVERLOAD _CLC_DECL size_t __clc_get_local_size(uint dim);
15+
16+
#endif // __CLC_WORKITEM_CLC_GET_LOCAL_SIZE_H__
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
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+
#ifndef __CLC_WORKITEM_CLC_GET_MAX_SUB_GROUP_SIZE_H__
10+
#define __CLC_WORKITEM_CLC_GET_MAX_SUB_GROUP_SIZE_H__
11+
12+
#include <clc/internal/clc.h>
13+
14+
_CLC_DEF _CLC_OVERLOAD uint __clc_get_max_sub_group_size();
15+
16+
#endif // __CLC_WORKITEM_CLC_GET_MAX_SUB_GROUP_SIZE_H__
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
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+
#ifndef __CLC_WORKITEM_CLC_GET_NUM_GROUPS_H__
10+
#define __CLC_WORKITEM_CLC_GET_NUM_GROUPS_H__
11+
12+
#include <clc/internal/clc.h>
13+
14+
_CLC_OVERLOAD _CLC_DECL size_t __clc_get_num_groups(uint dim);
15+
16+
#endif // __CLC_WORKITEM_CLC_GET_NUM_GROUPS_H__
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
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+
#ifndef __CLC_WORKITEM_CLC_GET_NUM_SUB_GROUPS_H__
10+
#define __CLC_WORKITEM_CLC_GET_NUM_SUB_GROUPS_H__
11+
12+
#include <clc/internal/clc.h>
13+
14+
_CLC_DEF _CLC_OVERLOAD uint __clc_get_num_sub_groups();
15+
16+
#endif // __CLC_WORKITEM_CLC_GET_NUM_SUB_GROUPS_H__

0 commit comments

Comments
 (0)