diff --git a/src/runtime_src/core/common/api/xrt_kernel.cpp b/src/runtime_src/core/common/api/xrt_kernel.cpp index 2ea41e7bd97..5b5d14c7a6d 100644 --- a/src/runtime_src/core/common/api/xrt_kernel.cpp +++ b/src/runtime_src/core/common/api/xrt_kernel.cpp @@ -2920,16 +2920,27 @@ class runlist_impl std::vector m_runlist; std::vector m_bos; + static const std::string& + state_to_string(state st) + { + static std::map st2str{ + { state::idle, "idle" }, + { state::closed, "closed" }, + { state::running,"running" }, + { state::error, "error" } + }; + return st2str.at(st); + } + public: // Internal accessor during command list submission const std::vector& get_exec_bos() const { // Allow exec bo access only as part of submission - // The command list must have been submitted for - // execut - if (m_state != state::running) - throw std::runtime_error("internal error: wrong state"); + // The runlist must have been closed. + if (m_state != state::closed) + throw std::runtime_error("internal error: wrong state: " + state_to_string(m_state)); return m_bos; } @@ -2963,7 +2974,7 @@ class runlist_impl add(xrt::run run) { if (m_state != state::idle) - throw xrt_core::error("runlist must be idle before adding run objects"); + throw xrt_core::error("runlist must be idle before adding run objects, current state: " + state_to_string(m_state)); // Get the potentially throwing action out of the way first @@ -2991,7 +3002,7 @@ class runlist_impl execute(const xrt::runlist& rl) { if (m_state != state::idle) - throw xrt_core::error("runlist must be idle before submitting for execution"); + throw xrt_core::error("runlist must be idle before submitting for execution, current state: " + state_to_string(m_state)); if (m_runlist.empty()) return;