[libc-commits] [libc] [libc] Add single threaded kernel attributes to AMDGPU startup utility (PR #104651)
via libc-commits
libc-commits at lists.llvm.org
Fri Aug 16 16:45:30 PDT 2024
llvmbot wrote:
<!--LLVM PR SUMMARY COMMENT-->
@llvm/pr-subscribers-backend-amdgpu
@llvm/pr-subscribers-libc
Author: Joseph Huber (jhuber6)
<details>
<summary>Changes</summary>
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.
---
Full diff: https://github.com/llvm/llvm-project/pull/104651.diff
1 Files Affected:
- (modified) libc/startup/gpu/amdgpu/start.cpp (+8-2)
``````````diff
diff --git a/libc/startup/gpu/amdgpu/start.cpp b/libc/startup/gpu/amdgpu/start.cpp
index 5aaa7e938d2792..f6f7ee39e32fab 100644
--- a/libc/startup/gpu/amdgpu/start.cpp
+++ b/libc/startup/gpu/amdgpu/start.cpp
@@ -41,7 +41,10 @@ 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),
+ clang::amdgpu_waves_per_eu(1, 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 +63,10 @@ _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),
+ clang::amdgpu_waves_per_eu(1, 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
``````````
</details>
https://github.com/llvm/llvm-project/pull/104651
More information about the libc-commits
mailing list