[libc-commits] [PATCH] D149398: [libc] Add support for global ctors / dtors for AMDGPU

Siva Chandra via Phabricator via libc-commits libc-commits at lists.llvm.org
Fri Apr 28 22:28:17 PDT 2023


sivachandra added inline comments.


================
Comment at: libc/startup/gpu/amdgpu/start.cpp:61
+    // callbacks.
+    atexit(&call_fini_array_callbacks);
+    call_init_array_callbacks(argc, argv, env);
----------------
Nit: Explicit namespace scoping to make it clear to the reader which `atexit` is being called: `__llvm_libc::atexit`.


================
Comment at: libc/startup/gpu/amdgpu/start.cpp:67
+  // initialization code. This will get very, very slow for high thread counts,
+  // but for testing purposes it is unlikely to matter.
+  while (count.load(cpp::MemoryOrder::RELAXED) != get_grid_size())
----------------
Can this be avoided at all? As in, if there are globals that have to be initialized on the GPU, then all threads have to wait until they can start using those globals?


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D149398/new/

https://reviews.llvm.org/D149398



More information about the libc-commits mailing list