[libc-commits] [libc] 5c13f9a - [libc] Add single threaded kernel attributes to AMDGPU startup utility (#104651)

via libc-commits libc-commits at lists.llvm.org
Sun Aug 18 10:50:19 PDT 2024


Author: Joseph Huber
Date: 2024-08-18T12:50:15-05:00
New Revision: 5c13f9aea280f1d499be7eca45b85371b0240c48

URL: https://github.com/llvm/llvm-project/commit/5c13f9aea280f1d499be7eca45b85371b0240c48
DIFF: https://github.com/llvm/llvm-project/commit/5c13f9aea280f1d499be7eca45b85371b0240c48.diff

LOG: [libc] Add single threaded kernel attributes to AMDGPU startup utility (#104651)

Summary:
I fixed the errors here recently so I can actually use these. This
shouldn't impact much, just should hopefully make the code generated
slightly better.

Added: 
    

Modified: 
    libc/startup/gpu/amdgpu/start.cpp

Removed: 
    


################################################################################
diff  --git a/libc/startup/gpu/amdgpu/start.cpp b/libc/startup/gpu/amdgpu/start.cpp
index 5aaa7e938d2792..f09541b0d55808 100644
--- a/libc/startup/gpu/amdgpu/start.cpp
+++ b/libc/startup/gpu/amdgpu/start.cpp
@@ -41,7 +41,9 @@ static void call_fini_array_callbacks() {
 
 } // namespace LIBC_NAMESPACE_DECL
 
-extern "C" [[gnu::visibility("protected"), clang::amdgpu_kernel]] void
+extern "C" [[gnu::visibility("protected"), clang::amdgpu_kernel,
+             clang::amdgpu_flat_work_group_size(1, 1),
+             clang::amdgpu_max_num_work_groups(1)]] void
 _begin(int argc, char **argv, char **env) {
   __atomic_store_n(&LIBC_NAMESPACE::app.env_ptr,
                    reinterpret_cast<uintptr_t *>(env), __ATOMIC_RELAXED);
@@ -60,7 +62,9 @@ _start(int argc, char **argv, char **envp, int *ret) {
   __atomic_fetch_or(ret, main(argc, argv, envp), __ATOMIC_RELAXED);
 }
 
-extern "C" [[gnu::visibility("protected"), clang::amdgpu_kernel]] void
+extern "C" [[gnu::visibility("protected"), clang::amdgpu_kernel,
+             clang::amdgpu_flat_work_group_size(1, 1),
+             clang::amdgpu_max_num_work_groups(1)]] void
 _end(int retval) {
   // Only a single thread should call `exit` here, the rest should gracefully
   // return from the kernel. This is so only one thread calls the destructors


        


More information about the libc-commits mailing list