diff --git a/sycl/include/strata/core/verify.hpp b/sycl/include/strata/core/verify.hpp index 0db24e2..255e3ea 100644 --- a/sycl/include/strata/core/verify.hpp +++ b/sycl/include/strata/core/verify.hpp @@ -192,6 +192,7 @@ private: Verifier* next_ = nullptr; void* next_user_ = nullptr; bool ple_stage() const { return lb_ <= 1 && 1 < le_; } ///< holds layer 1, where the PLE block runs + bool record_commit(std::string& err); bool capture_commit(std::string& err); int pending_commit_ = 0; ///< n_keep of a launched, unfinished commit (0: none) std::chrono::steady_clock::time_point pending_commit_t0_{}; diff --git a/sycl/src/core/verify.cpp b/sycl/src/core/verify.cpp index 038f4d4..c822711 100644 --- a/sycl/src/core/verify.cpp +++ b/sycl/src/core/verify.cpp @@ -1200,8 +1200,7 @@ catch (sycl::exception const &exc) { std::exit(1); } -bool Verifier::capture_commit(std::string &err) try { - if (commit_exec_ != nullptr) return true; +bool Verifier::record_commit(std::string &err) { using namespace strata::kernels; const ModelGeometry& g = *g_; SessionState& ss = *ss_; @@ -1211,10 +1210,6 @@ bool Verifier::capture_commit(std::string &err) try { (uint64_t) g.ssm_conv_channels * (g.ssm_d_conv - 1); const int64_t TS = (s.idx_block - 1) * ID; const int64_t HS = (int64_t) NG_HIST * NG_HC_DIM; - if (DPCT_CHECK_ERROR(dpct::experimental::begin_recording(cs_)) != 0) { - err = "verify: begin commit capture failed"; - return false; - } bool ok = true; try { copy_i32_from_mapped(commit_, m_commit_, 2 + MT, cs_); @@ -1251,6 +1246,17 @@ bool Verifier::capture_commit(std::string &err) try { err = std::string("verify commit: ") + e.what(); ok = false; } + return ok; +} + +bool Verifier::capture_commit(std::string &err) try { + if (std::getenv("STRATA_VERIFY_EAGER") != nullptr) return true; + if (commit_exec_ != nullptr) return true; + if (DPCT_CHECK_ERROR(dpct::experimental::begin_recording(cs_)) != 0) { + err = "verify: begin commit capture failed"; + return false; + } + const bool ok = record_commit(err); dpct::experimental::command_graph_ptr graph = nullptr; const dpct::err0 ce = DPCT_CHECK_ERROR(dpct::experimental::end_recording(cs_, &graph)); @@ -1754,8 +1760,9 @@ bool Verifier::commit(int n_keep, std::string &err, bool wait) try { h_commit_[1] = n_keep - 1; for (int t = 0; t < max_t_; ++t) h_commit_[2 + t] = t < n_keep ? (int32_t) (last_pos0_ + t) : -1; std::atomic_thread_fence(std::memory_order_seq_cst); - const dpct::err0 le = - DPCT_CHECK_ERROR((cs_)->ext_oneapi_graph(*commit_exec_)); + const dpct::err0 le = (std::getenv("STRATA_VERIFY_EAGER") != nullptr) + ? (record_commit(err) ? 0 : 1) + : DPCT_CHECK_ERROR((cs_)->ext_oneapi_graph(*commit_exec_)); /* DPCT1009: SYCL reports errors using exceptions and does not use error codes. Please replace the "get_error_string_dummy(...)" with a real