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

Method catch_up

engine/src/core/dflash2.cpp:713–739  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

711}
712
713bool Dflash2Drafter::catch_up(int64_t upto, std::string& err) {
714 if (!has_deferred()) return true;
715 const Clock::time_point t0 = Clock::now();
716 const OnDevice on_device(device_);
717 const size_t row = taps_.size() * (size_t) N_;
718 int64_t from = std::max<int64_t>(dpend_lo_, upto - 2047);
719 upto = std::min<int64_t>(upto, dpend_hi_);
720 int64_t replayed = 0;
721 while (from < upto) {
722 const int m = (int) std::min<int64_t>(kRows, upto - from);
723 if (!context_wait(err)) return false;
724 for (int i = 0; i < m; ++i) // (the held run wraps at 2048 positions: row by row)
725 if (cudaMemcpyAsync(landing_ + (size_t) i * row, dpend_ + (size_t) ((from + i) % kRing2048) * row, row * 4, cudaMemcpyHostToDevice, cs_) != cudaSuccess) {
726 err = "dflash2: the deferred rows' upload";
727 return false;
728 }
729 if (!context(landing_, m, from, err)) return false; // (waits for the stream, so the next chunk may reuse the landing)
730 from += m;
731 replayed += m;
732 }
733 dpend_lo_ = std::max<int64_t>(upto, dpend_lo_);
734 if (dpend_lo_ >= dpend_hi_) dpend_lo_ = dpend_hi_ = 0;
735 ++n_catchups;
736 n_catchup_rows += replayed;
737 ms_catchup += ms_since(t0);
738 return true;
739}
740
741void Dflash2Drafter::set_max_drafts(int n) {
742 n = std::max(1, std::min(n, (int) kDrafts));

Callers

nothing calls this directly

Calls 4

ms_sinceFunction · 0.70
nowFunction · 0.50
cudaMemcpyAsyncFunction · 0.50
sizeMethod · 0.45

Tested by

no test coverage detected