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

Method capture_all

engine/src/core/verify.cpp:6659–6690  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

6657}
6658
6659bool Verifier::capture_all(std::string& err) {
6660 const OnDevice on_device(device_);
6661 if (g_ == nullptr) { err = "verify: capture_all before init"; return false; }
6662 if (remote_opt_ != nullptr) { err = "verify: pipelined windows do not serve --remote-expert-opt"; return false; }
6663 if (released_.load()) { err = "verify: an earlier window never finished on the GPU (#267); restart the engine"; return false; }
6664 struct NoEvict { // every size is wanted at once here: a capture must not free another size's graph
6665 bool& f;
6666 explicit NoEvict(bool& flag) : f(flag) { f = true; }
6667 ~NoEvict() { f = false; }
6668 } no_evict(no_window_eviction_);
6669 // STRATA_SELECT_LONG: both select variants (see select_long_at): pl_launch takes the one its window's context
6670 // needs, and nothing can be captured once pipelined windows are in flight. Without it only [0]
6671 for (int sl = 0; sl < (select_long_on() ? 2 : 1); ++sl) {
6672 sel_long_ = sl;
6673 for (int T = 1; T <= max_t_; ++T)
6674 if (!capture(T, err)) return false;
6675 }
6676 sel_long_ = 0;
6677 if (!capture_commit(err)) return false;
6678 if ((ev_done_ == nullptr && cudaEventCreateWithFlags(&ev_done_, cudaEventDisableTiming) != cudaSuccess) ||
6679 (ev_commit_ == nullptr && cudaEventCreateWithFlags(&ev_commit_, cudaEventDisableTiming) != cudaSuccess)) {
6680 err = "verify: event create failed";
6681 return false;
6682 }
6683 if (prof_on_ && prof_pin_ == nullptr &&
6684 cudaHostAlloc((void**) &prof_pin_, prof_h_.size() * 8, cudaHostAllocDefault) != cudaSuccess) {
6685 prof_pin_ = nullptr; // the pipelined windows go unprofiled
6686 cudaGetLastError();
6687 }
6688 pl_ple_rows_.assign((size_t) strata::kernels::kVerifyMaxT * strata::kernels::PLE_N_HEADS, 0u);
6689 return true;
6690}
6691
6692// The host staging of a pipelined window: run()'s (stage_inputs), and its PLE rows from `ple_prev` with their pages
6693// prefetched (they are gathered into the mapped rows when layer 0 is served, as run() does).

Callers

nothing calls this directly

Calls 8

select_long_onFunction · 0.85
assignMethod · 0.80
captureFunction · 0.50
cudaEventCreateWithFlagsFunction · 0.50
cudaHostAllocFunction · 0.50
cudaGetLastErrorFunction · 0.50
loadMethod · 0.45
sizeMethod · 0.45

Tested by

no test coverage detected