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

Method pl_commit_async

engine/sycl/src/core/verify.cpp:4496–4589  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

4494}
4495
4496bool Verifier::pl_commit_async(int n_keep, std::string &err) try {
4497 const OnDevice on_device(device_);
4498 if (n_keep < 1 || n_keep > last_t_) { err = "verify: commit count out of range"; return false; }
4499 // Debug: with a state dump requested, print what this commit is launched with, so a wrong count names
4500 // itself next to the verdict log (STRATA_PIPELINE_LOG).
4501 static const bool cdbg = std::getenv("STRATA_PIPELINE_DUMP") != nullptr;
4502 if (cdbg)
4503 std::fprintf(stderr, "strata commit: n_keep=%d T=%d pos0=%lld self_skip=%d\n", n_keep, (int) last_t_,
4504 (long long) last_pos0_, (last_t_ == 1 && one_token_self_commit()) ? 1 : 0);
4505 if (commit_exec_ == nullptr || ev_commit_ == nullptr) { err = "verify: pipelined commit not prepared"; return false; }
4506 const Clock::time_point t0 = Clock::now();
4507 if (commit_live_) { // its graph reads the words below when it starts: the previous one has (a window ago)
4508 dpct::err0 q;
4509 while ((q = dpct::sycl_event_query(ev_commit_)) == 1) _mm_pause();
4510 /*
4511 DPCT1009: SYCL reports errors using exceptions and does not use
4512 error codes. Please replace the "get_error_string_dummy(...)" with a
4513 real error-handling function.
4514 */
4515 /*
4516 DPCT1001: The statement could not be removed.
4517 */
4518 /*
4519 DPCT1000: Error handling if-stmt was detected but could not be
4520 rewritten.
4521 */
4522 if (q != 0) {
4523 err =
4524 std::string("verify: commit: ") + dpct::get_error_string_dummy(q);
4525 return false;
4526 }
4527 }
4528 // A one-token window advanced the GDN state itself (record_window), so the serial path's commit() skips the
4529 // commit graph for it. The pipelined path ran the graph anyway and advanced the state twice per
4530 // single-token window; the first decode window is always one token, so the two paths' GDN states were
4531 // equal after the prompt and different after that window (STRATA_PIPELINE_DUMP), and the tokens diverged
4532 // at the fourth. With this skip the pipelined windows are token-identical to the serial path.
4533 if (last_t_ == 1 && one_token_self_commit() && !self_commit_off_) {
4534 h_commit_[0] = n_keep;
4535 h_commit_[1] = n_keep - 1;
4536 for (int t = 0; t < max_t_; ++t) h_commit_[2 + t] = t < n_keep ? (int32_t) (last_pos0_ + t) : -1;
4537 if (ple_stage())
4538 for (int t = 0; t < n_keep; ++t) {
4539 ss_->ple_prev[0] = ss_->ple_prev[1];
4540 ss_->ple_prev[1] = last_tokens_[t];
4541 }
4542 ms_commit += ms_since(t0);
4543 return true;
4544 }
4545 h_commit_[0] = n_keep;
4546 h_commit_[1] = n_keep - 1;
4547 for (int t = 0; t < max_t_; ++t) h_commit_[2 + t] = t < n_keep ? (int32_t) (last_pos0_ + t) : -1;
4548 std::atomic_thread_fence(std::memory_order_seq_cst);
4549 const dpct::err0 le =
4550 DPCT_CHECK_ERROR((cs_)->ext_oneapi_graph(*commit_exec_));
4551 /*
4552 DPCT1009: SYCL reports errors using exceptions and does not use error
4553 codes. Please replace the "get_error_string_dummy(...)" with a real

Callers 1

mainFunction · 0.45

Calls 9

sycl_event_queryFunction · 0.85
_mm_pauseFunction · 0.85
get_error_string_dummyFunction · 0.85
sync_barrierFunction · 0.85
one_token_self_commitFunction · 0.70
ms_sinceFunction · 0.70
nowFunction · 0.50
stringFunction · 0.50

Tested by

no test coverage detected