[libclc] b740343 - libclc: Move get_global_id into clc (#185180)
via cfe-commits
cfe-commits at lists.llvm.org
Sat Mar 7 23:43:21 PST 2026
Author: Matt Arsenault
Date: 2026-03-08T08:43:17+01:00
New Revision: b7403433f8dbd53f7e97afbd6587432dbe00cc18
URL: https://github.com/llvm/llvm-project/commit/b7403433f8dbd53f7e97afbd6587432dbe00cc18
DIFF: https://github.com/llvm/llvm-project/commit/b7403433f8dbd53f7e97afbd6587432dbe00cc18.diff
LOG: libclc: Move get_global_id into clc (#185180)
Added:
libclc/clc/lib/generic/workitem/clc_get_global_id.cl
Modified:
libclc/clc/lib/generic/SOURCES
libclc/opencl/lib/generic/workitem/get_global_id.cl
Removed:
################################################################################
diff --git a/libclc/clc/lib/generic/SOURCES b/libclc/clc/lib/generic/SOURCES
index b352382fbe6d9..926efe9c6f188 100644
--- a/libclc/clc/lib/generic/SOURCES
+++ b/libclc/clc/lib/generic/SOURCES
@@ -176,6 +176,7 @@ shared/clc_min.cl
shared/clc_qualifier.cl
shared/clc_vload.cl
shared/clc_vstore.cl
+workitem/clc_get_global_id.cl
workitem/clc_get_global_linear_id.cl
workitem/clc_get_local_linear_id.cl
workitem/clc_get_num_sub_groups.cl
diff --git a/libclc/clc/lib/generic/workitem/clc_get_global_id.cl b/libclc/clc/lib/generic/workitem/clc_get_global_id.cl
new file mode 100644
index 0000000000000..515ef7a173f25
--- /dev/null
+++ b/libclc/clc/lib/generic/workitem/clc_get_global_id.cl
@@ -0,0 +1,17 @@
+//===----------------------------------------------------------------------===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#include <clc/workitem/clc_get_global_offset.h>
+#include <clc/workitem/clc_get_group_id.h>
+#include <clc/workitem/clc_get_local_id.h>
+#include <clc/workitem/clc_get_local_size.h>
+
+_CLC_OVERLOAD _CLC_DEF size_t __clc_get_global_id(uint dim) {
+ return __clc_get_group_id(dim) * __clc_get_local_size(dim) +
+ __clc_get_local_id(dim) + __clc_get_global_offset(dim);
+}
diff --git a/libclc/opencl/lib/generic/workitem/get_global_id.cl b/libclc/opencl/lib/generic/workitem/get_global_id.cl
index f56981975acd3..d134dfc3f8d72 100644
--- a/libclc/opencl/lib/generic/workitem/get_global_id.cl
+++ b/libclc/opencl/lib/generic/workitem/get_global_id.cl
@@ -6,9 +6,8 @@
//
//===----------------------------------------------------------------------===//
-#include <clc/opencl/opencl-base.h>
+#include <clc/workitem/clc_get_global_id.h>
_CLC_DEF _CLC_OVERLOAD size_t get_global_id(uint dim) {
- return get_group_id(dim) * get_local_size(dim) + get_local_id(dim) +
- get_global_offset(dim);
+ return __clc_get_global_id(dim);
}
More information about the cfe-commits
mailing list