MCPcopy Create free account
hub / github.com/Oneflow-Inc/oneflow / AsyncPread

Method AsyncPread

oneflow/core/embedding/persistent_table.cpp:212–224  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

210 }
211
212 void AsyncPread(int fd, void* buf, size_t count, off_t offset) {
213 if (num_readings_ == kAioQueueDepth) { WaitUntilDone(); }
214 struct iocb* cb = &cbs_.at(num_readings_);
215 cb->aio_fildes = fd;
216 cb->aio_lio_opcode = IOCB_CMD_PREAD;
217 cb->aio_reqprio = 0;
218 cb->aio_buf = reinterpret_cast<uintptr_t>(buf);
219 cb->aio_nbytes = count;
220 cb->aio_offset = offset;
221 const long nr = 1;
222 PCHECK(syscall(__NR_io_submit, ctx_, nr, &cbs_ptr_.at(num_readings_)) >= 0);
223 num_readings_ += 1;
224 }
225
226 void WaitUntilDone() {
227 if (num_readings_ != 0) {

Callers 1

GetBlocksMethod · 0.80

Calls 1

atMethod · 0.45

Tested by

no test coverage detected