[libc-commits] [PATCH] D155121: [libc] Add support for the 'fread' function on the GPU

Joseph Huber via Phabricator via libc-commits libc-commits at lists.llvm.org
Wed Jul 26 08:46:18 PDT 2023


jhuber6 added inline comments.


================
Comment at: libc/utils/gpu/server/rpc_server.cpp:117
+      });
+      port->send_n(data, sizes);
+      port->send([&](rpc::Buffer *buffer, uint32_t id) {
----------------
jdoerfert wrote:
> What is this about, I don't get it.
This is what streams the data read from the CPU buffer to the GPU.


================
Comment at: libc/utils/gpu/server/rpc_server.cpp:120
+        delete[] reinterpret_cast<uint8_t *>(data[id]);
+        buffer->data[0] = rets[id] >= 0 ? sizes[id] : rets[id];
+      });
----------------
jdoerfert wrote:
> I don't get this. We should always return rets[id], no?
I think this is a consequence of me not using the `size` argument instead of the `nmemb` argument. Since the return value is supposed to correspond to the size. I can fix it and test.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D155121



More information about the libc-commits mailing list