[libc-commits] [PATCH] D151735: [libc] Implement basic `malloc` and `free` support on the GPU

Jan-Patrick Lehr via Phabricator via libc-commits libc-commits at lists.llvm.org
Tue May 30 12:35:52 PDT 2023


jplehr added inline comments.


================
Comment at: libc/src/__support/RPC/rpc.h:38
   EXIT = 2,
-  TEST_INCREMENT = 3,
-  TEST_INTERFACE = 4,
-  TEST_STREAM = 5,
+  MALLOC = 3,
+  FREE = 4,
----------------
Out of curiosity: Why not append these values to the existing ones instead?


================
Comment at: libc/test/src/stdlib/malloc_test.cpp:15
+  int *ptr = reinterpret_cast<int *>(__llvm_libc::malloc(sizeof(int)));
+  *ptr = 1;
+  EXPECT_EQ(*ptr, 1);
----------------
Should we first assert that this is not `nullptr`?


================
Comment at: libc/utils/gpu/loader/Server.h:25
+template <typename Alloc, typename Dealloc>
+void handle_server(Alloc alloctor, Dealloc deallocator) {
   using namespace __llvm_libc;
----------------
typo


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D151735



More information about the libc-commits mailing list