[libc-commits] [PATCH] D153304: [libc] Remove flexible array and replace with a template

Jon Chesterfield via Phabricator via libc-commits libc-commits at lists.llvm.org
Mon Jun 19 17:50:45 PDT 2023


JonChesterfield added a comment.

The allocation size looks like a bug. Agreed that the syntax is noisy, but on the GPU side at least it looks like a simplification to me.



================
Comment at: libc/utils/gpu/server/Server.cpp:230
+    state->devices[device_id] = std::make_unique<Device>(lane_size);
+  uint64_t buffer_size =
+      __llvm_libc::rpc::Server<32>::allocation_size(num_ports);
----------------
The <32> here looks suspect, should allocation size be taking a runtime value for lane size?


================
Comment at: libc/utils/gpu/server/Server.cpp:292
 
 void rpc_recv_and_send(rpc_port_t ref, rpc_port_callback_ty callback,
                        void *data) {
----------------
This would be much clearer if recv_and_send took lane size as a template parameter. Would delete all the copy/paste currently in the method.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D153304



More information about the libc-commits mailing list