MCPcopy Create free account
hub / github.com/Niko1221/Strata / prefetch_rows

Method prefetch_rows

engine/src/kernels/ngram.cpp:558–582  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

556}
557
558void PleTable::prefetch_rows(const uint32_t* rows16) {
559 std::lock_guard<std::recursive_mutex> lk(impl_->mu);
560 if (impl_->mode == PleIo::Direct && impl_->reader.is_open()) {
561 for (size_t i = 0; i < impl_->n_prefetch; ++i)
562 if (std::memcmp(impl_->prefetch_keys[i], rows16, sizeof(uint32_t) * PLE_N_HEADS) == 0) return;
563 if (impl_->n_prefetch >= Impl::kMaxPrefetch) wait_prefetches();
564 const size_t slot = impl_->n_prefetch++;
565 std::memcpy(impl_->prefetch_keys[slot], rows16, sizeof(uint32_t) * PLE_N_HEADS);
566 impl_->prefetch_tickets[slot] = impl_->reader.issue(impl_->prefetch_keys[slot], PLE_N_HEADS, impl_->prefetch_raw[slot]);
567 return;
568 }
569#if defined(_WIN32)
570 if (impl_->data != nullptr && g_ple_prefetch) {
571 WIN32_MEMORY_RANGE_ENTRY ranges[PLE_N_HEADS];
572 ULONG_PTR n = 0;
573 for (int h = 0; h < PLE_N_HEADS; ++h) {
574 if (rows16[h] >= impl_->n_rows) continue;
575 ranges[n].VirtualAddress = (PVOID) (impl_->data + (size_t) rows16[h] * impl_->rb);
576 ranges[n].NumberOfBytes = impl_->rb;
577 ++n;
578 }
579 if (n > 0) (void) PrefetchVirtualMemory(GetCurrentProcess(), n, ranges, 0);
580 }
581#endif
582}
583
584void PleTable::close() {
585 wait_prefetches();

Callers 9

runMethod · 0.80
pl_stageMethod · 0.80
draftMethod · 0.80
runMethod · 0.80
pl_stageMethod · 0.80
draftMethod · 0.80
draft_slotsMethod · 0.80

Calls 3

memcpyFunction · 0.85
is_openMethod · 0.45
issueMethod · 0.45