[libc-commits] [libc] [libc] Perform bitfield zero initialization wave-parallel (PR #143607)

Matt Arsenault via libc-commits libc-commits at lists.llvm.org
Wed Jun 11 15:49:22 PDT 2025


================
@@ -157,10 +157,19 @@ struct Slab {
     Header *header = reinterpret_cast<Header *>(memory);
     header->chunk_size = chunk_size;
     header->global_index = global_index;
+  }
 
-    // This memset is expensive and likely not necessary for the current 'kfd'
-    // driver. Until zeroed pages are exposed by the API we must be careful.
-    __builtin_memset(get_bitfield(), 0, bitfield_bytes(chunk_size));
+  // Set the necessary bitfield bytes to zero in parallel using many lanes. This
+  // must be called before the bitfield can be accessed safely, memory is not
+  // guaranteed to be zero initialized in the current implementation.
+  void initialize(uint64_t uniform) {
----------------
arsenm wrote:

Can you rephrase this into uniform_memset or group_memset or something?

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


More information about the libc-commits mailing list