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

Johannes Doerfert via Phabricator via libc-commits libc-commits at lists.llvm.org
Wed Jul 26 08:39:56 PDT 2023


jdoerfert added inline comments.


================
Comment at: libc/utils/gpu/server/rpc_server.cpp:115
+                         : stdin;
+        rets[id] = fread(data[id], sizes[id], 1, file);
+      });
----------------
To allow for partial fread. Technically, you should put in exactly what the user put in on the other side. It makes a difference after all.


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


================
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];
+      });
----------------
I don't get this. We should always return rets[id], no?


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