[Openmp-commits] [llvm] [openmp] [OpenMP][DeviceRTL] Fix the chunked static distribution dropping iterations (PR #216117)

Johannes Doerfert via Openmp-commits openmp-commits at lists.llvm.org
Fri Aug 14 09:50:23 PDT 2026


================
@@ -0,0 +1,75 @@
+// Chunked static distribution: thread T owns iterations [T*chunk, T*chunk+chunk)
+// within each block chunk. The index used to start each thread has to account
+// for the chunk, and the block chunk has to cover one chunk per thread.
+//
+// The entry is called directly because no C/C++ construct reaches it: clang
+// emits __kmpc_for_static_init_4, only flang emits this one.
+//
+// RUN: %libomptarget-compile-run-and-check-generic
+// REQUIRES: gpu
+
+#include <omp.h>
+#include <stdio.h>
+
+#define N 32
+#define NT 8
+#define CHUNK 4
+
+struct Args {
+  int *Tid;
+};
----------------
jdoerfert wrote:

Why 2 levels of indirection? Can't we just return an array with omp_get_thread_num values without having an Args type and a pointer indirection in there?

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


More information about the Openmp-commits mailing list