[llvm] [Offload] Tests for global memory and constructors (PR #147537)

Ross Brunton via llvm-commits llvm-commits at lists.llvm.org
Wed Jul 9 04:06:41 PDT 2025


================
@@ -0,0 +1,16 @@
+#include <gpuintrin.h>
+#include <stdint.h>
+
+[[clang::loader_uninitialized]]
+uint32_t global[64];
+
+__attribute__((constructor)) void ctor() {
+  for (unsigned I = 0; I < 64; I++)
+    global[I] = 100;
+}
----------------
RossBrunton wrote:

I figured it'd be good to have the constructor to do something relatively non-trivial. This also verifies that the changes to the global are visible to all threads rather than just happening to run for one thread.

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


More information about the llvm-commits mailing list