| 3165 | void Verifier::set_commit_async(bool on) { g_commit_async = on && std::getenv("STRATA_COMMIT_SYNC") == nullptr; } |
| 3166 | |
| 3167 | bool Verifier::commit(int n_keep, std::string &err) try { |
| 3168 | const OnDevice on_device(device_); |
| 3169 | if (n_keep < 1 || n_keep > last_t_) { err = "verify: commit count out of range"; return false; } |
| 3170 | const Clock::time_point t0 = Clock::now(); |
| 3171 | h_commit_[0] = n_keep; |
| 3172 | h_commit_[1] = n_keep - 1; |
| 3173 | for (int t = 0; t < max_t_; ++t) h_commit_[2 + t] = t < n_keep ? (int32_t) (last_pos0_ + t) : -1; |
| 3174 | if (last_t_ == 1 && one_token_self_commit() && !self_commit_off_) { |
| 3175 | // a one-token window has advanced the state itself (record_window): no commit graph |
| 3176 | } else { |
| 3177 | std::atomic_thread_fence(std::memory_order_seq_cst); |
| 3178 | const dpct::err0 le = |
| 3179 | DPCT_CHECK_ERROR((cs_)->ext_oneapi_graph(*commit_exec_)); |
| 3180 | /* |
| 3181 | DPCT1009: SYCL reports errors using exceptions and does not use error |
| 3182 | codes. Please replace the "get_error_string_dummy(...)" with a real |
| 3183 | error-handling function. |
| 3184 | */ |
| 3185 | /* |
| 3186 | DPCT1001: The statement could not be removed. |
| 3187 | */ |
| 3188 | /* |
| 3189 | DPCT1000: Error handling if-stmt was detected but could not be |
| 3190 | rewritten. |
| 3191 | */ |
| 3192 | if (le != 0) { |
| 3193 | err = std::string("verify: commit launch: ") + |
| 3194 | dpct::get_error_string_dummy(le); |
| 3195 | return false; |
| 3196 | } |
| 3197 | // set_commit_async: no wait here - the next window runs on the same stream after it, and the drafter (its own |
| 3198 | // stream) reads only this window's final rows and its own K/V. h_commit_ is next written after the next window's |
| 3199 | // results are read, i.e. after this graph has run. Everything else waits on commit_done_ (wait_commit). |
| 3200 | if (!g_commit_async || next_ != nullptr) { |
| 3201 | const dpct::err0 se = DPCT_CHECK_ERROR(cs_->wait()); |
| 3202 | /* |
| 3203 | DPCT1009: SYCL reports errors using exceptions and does not use |
| 3204 | error codes. Please replace the "get_error_string_dummy(...)" with a |
| 3205 | real error-handling function. |
| 3206 | */ |
| 3207 | /* |
| 3208 | DPCT1001: The statement could not be removed. |
| 3209 | */ |
| 3210 | /* |
| 3211 | DPCT1000: Error handling if-stmt was detected but could not be |
| 3212 | rewritten. |
| 3213 | */ |
| 3214 | if (se != 0) { |
| 3215 | err = std::string("verify: commit: ") + |
| 3216 | dpct::get_error_string_dummy(se); |
| 3217 | return false; |
| 3218 | } |
| 3219 | } else { |
| 3220 | /* |
| 3221 | DPCT1024: The original code returned the error code that was |
| 3222 | further consumed by the program logic. This original code was |
| 3223 | replaced with 0. You may need to rewrite the program logic consuming |
| 3224 | the error code. |
no test coverage detected