[libclc] [libclc] Declare workitem built-ins in clc, move ptx-nvidiacl workitem built-ins into clc (PR #144333)

Matt Arsenault via cfe-commits cfe-commits at lists.llvm.org
Mon Jul 7 19:01:46 PDT 2025


================
@@ -0,0 +1,22 @@
+//===----------------------------------------------------------------------===//
+//
+// 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_size.h>
+
+_CLC_DEF _CLC_OVERLOAD size_t __clc_get_global_size(uint dim) {
+  switch (dim) {
+  case 0:
+    return __builtin_amdgcn_grid_size_x();
+  case 1:
+    return __builtin_amdgcn_grid_size_y();
+  case 2:
+    return __builtin_amdgcn_grid_size_z();
+  default:
+    return 1;
----------------
arsenm wrote:

Ok, that's the spec then and it should follow 

https://github.com/llvm/llvm-project/pull/144333


More information about the cfe-commits mailing list