From 11f522db20e79b4ed4874c0c4301646e0f71a4a4 Mon Sep 17 00:00:00 2001 From: Philip Salzmann Date: Mon, 17 Apr 2023 17:07:48 +0200 Subject: [PATCH] fixup! Introduce new CGF diagnostics utility --- include/accessor.h | 4 ++-- include/cgf_diagnostics.h | 4 +++- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/include/accessor.h b/include/accessor.h index b92c4b0a2..5929e1439 100644 --- a/include/accessor.h +++ b/include/accessor.h @@ -342,7 +342,7 @@ class accessor : public detail::accessor_base #if !defined(__SYCL_DEVICE_ONLY__) if(detail::is_embedded_hydration_id(m_device_ptr)) { - if(detail::cgf_diagnostics::is_available()) { + if(detail::cgf_diagnostics::is_available() && detail::cgf_diagnostics::get_instance().is_checking()) { detail::cgf_diagnostics::get_instance().register_accessor(detail::extract_hydration_id(m_device_ptr), target::device); } @@ -624,7 +624,7 @@ class accessor : public detail::accessor_b m_virtual_buffer_range = other.m_virtual_buffer_range; if(detail::is_embedded_hydration_id(m_host_ptr)) { - if(detail::cgf_diagnostics::is_available()) { + if(detail::cgf_diagnostics::is_available() && detail::cgf_diagnostics::get_instance().is_checking()) { detail::cgf_diagnostics::get_instance().register_accessor(detail::extract_hydration_id(m_host_ptr), target::host_task); } diff --git a/include/cgf_diagnostics.h b/include/cgf_diagnostics.h index 2e9661d3f..a0431217c 100644 --- a/include/cgf_diagnostics.h +++ b/include/cgf_diagnostics.h @@ -40,8 +40,10 @@ class cgf_diagnostics { check(target::host_task, kernel, &buffer_accesses, non_void_side_effects_count); } + bool is_checking() const { return m_is_checking; } + void register_accessor(const hydration_id hid, const target tgt) { - if(!m_is_checking) return; + assert(m_is_checking); assert(hid - 1 < m_expected_buffer_accesses->get_num_accesses()); if(tgt != m_expected_target) { throw std::runtime_error(fmt::format("Accessor {} for buffer {} has wrong target ('{}' instead of '{}').", hid - 1,