diff --git a/src/acc/sycl/sycl_memory_pool.cpp b/src/acc/sycl/sycl_memory_pool.cpp index 092d24961..b748ec0c7 100644 --- a/src/acc/sycl/sycl_memory_pool.cpp +++ b/src/acc/sycl/sycl_memory_pool.cpp @@ -39,36 +39,6 @@ syclMemoryBlock::~syclMemoryBlock() if (_mem) { sycl::free(_mem, *_Q); -#ifdef DEBUG_SYCL_MEMORY_POOL - if (_alloc_list.size() != 0) - std::cerr << (_mem_type == alloc_kind::device ? "DEVICE" : "HOST") << " [!! ERROR/destructor !!] There is _alloc_list(" << _alloc_bytes << " bytes/ " << _alloc_list.size() << ") remained\n" << std::flush; - if (_free_list.size() == 0) - std::cerr << (_mem_type == alloc_kind::device ? "DEVICE" : "HOST") << " [!! BUG/destructor !!] There is no _free_list\n" << std::flush; - if (_free_list.size() > 1) - { - size_t size = 0; - for (const auto& f : _free_list) - { - size += f.second - f.first; - std::cerr << (_mem_type == alloc_kind::device ? "DEVICE" : "HOST") << " [!! BUG/_free_list !!] " << f.first << " ~ " << f.second << " \n" << std::flush; - } - if (size != _free_bytes) - std::cerr << (_mem_type == alloc_kind::device ? "DEVICE" : "HOST") << " [!! BUG/destructor !!] There is mismatch in _free_list size: " << _free_bytes << " vs " << size << "\n" << std::flush; - std::cerr << (_mem_type == alloc_kind::device ? "DEVICE" : "HOST") << " [!! BUG/destructor !!] There is not-merged _free_list(" << _free_bytes << " bytes/ " << _free_list.size() << ")\n" << std::flush; - } - if (_rfree_list.size() == 0) - std::cerr << (_mem_type == alloc_kind::device ? "DEVICE" : "HOST") << " [!! BUG/destructor !!] There is no _rfree_list\n" << std::flush; - if (_rfree_list.size() > 1) - { - size_t size = 0; - for (const auto& r : _rfree_list) - { - size += r.first - r.second; - std::cerr << (_mem_type == alloc_kind::device ? "DEVICE" : "HOST") << " [!! BUG/_rfree_list !!] " << r.second << " ~ " << r.first << " \n" << std::flush; - } - std::cerr << (_mem_type == alloc_kind::device ? "DEVICE" : "HOST") << " [!! BUG/destructor !!] There is not-merged _rfree_list(" << size << " bytes/ " << _rfree_list.size() << ")\n" << std::flush; - } -#endif #ifdef DIAG_SYCL_MEMORY_POOL printStats(); #endif @@ -80,36 +50,6 @@ void syclMemoryBlock::clean() if (_mem) { std::lock_guard locker(_container_lock[_blockID].mutex); -#ifdef DEBUG_SYCL_MEMORY_POOL - if (_alloc_list.size() != 0) - std::cerr << (_mem_type == alloc_kind::device ? "DEVICE" : "HOST") << " [!! ERROR/clean !!] There is _alloc_list(" << _alloc_bytes << " bytes/ " << _alloc_list.size() << ") remained\n" << std::flush; - if (_free_list.size() == 0) - std::cerr << (_mem_type == alloc_kind::device ? "DEVICE" : "HOST") << " [!! BUG/clean !!] There is no _free_list\n" << std::flush; - if (_free_list.size() > 1) - { - size_t size = 0; - for (const auto& f : _free_list) - { - size += f.second - f.first; - std::cerr << (_mem_type == alloc_kind::device ? "DEVICE" : "HOST") << " [!! BUG/_free_list !!] " << f.first << " ~ " << f.second << " \n" << std::flush; - } - if (size != _free_bytes) - std::cerr << (_mem_type == alloc_kind::device ? "DEVICE" : "HOST") << " [!! BUG/clean !!] There is mismatch in _free_list size: " << _free_bytes << " vs " << size << "\n" << std::flush; - std::cerr << (_mem_type == alloc_kind::device ? "DEVICE" : "HOST") << " [!! BUG/clean !!] There is not-merged _free_list(" << _free_bytes << " bytes/ " << _free_list.size() << ")\n" << std::flush; - } - if (_rfree_list.size() == 0) - std::cerr << (_mem_type == alloc_kind::device ? "DEVICE" : "HOST") << " [!! BUG/clean !!] There is no _rfree_list\n" << std::flush; - if (_rfree_list.size() > 1) - { - size_t size = 0; - for (const auto& r : _rfree_list) - { - size += r.first - r.second; - std::cerr << (_mem_type == alloc_kind::device ? "DEVICE" : "HOST") << " [!! BUG/_rfree_list !!] " << r.second << " ~ " << r.first << " \n" << std::flush; - } - std::cerr << (_mem_type == alloc_kind::device ? "DEVICE" : "HOST") << " [!! BUG/clean !!] There is not-merged _rfree_list(" << size << " bytes/ " << _rfree_list.size() << ")\n" << std::flush; - } -#endif #ifdef DIAG_SYCL_MEMORY_POOL printStats(); #endif @@ -294,7 +234,7 @@ void syclMemoryPool::shrink(const size_t num) while (it != _memory_block_list.end()) { if (it->empty()) - it = _memory_block_list.erase(it); + it = _memory_block_list.erase(it); else if (count >= num && it->isUnused()) it = _memory_block_list.erase(it); else diff --git a/src/acc/sycl/sycl_memory_pool.h b/src/acc/sycl/sycl_memory_pool.h index 9eb915fb8..ed32889c8 100644 --- a/src/acc/sycl/sycl_memory_pool.h +++ b/src/acc/sycl/sycl_memory_pool.h @@ -6,13 +6,11 @@ #include #include #include -#include #include using memoryStorage = std::byte*; using memoryAllocMap = std::map; using memoryFreeMap = std::map; -//using memoryFreeMap = std::unordered_map; using memoryFreeSizeMap = std::multimap>; using alloc_kind = sycl::usm::alloc; @@ -97,21 +95,3 @@ class syclMemoryPool std::list _memory_block_list; inline static std::mutex _mem_lock; }; - -// TO-DO -template -class syclMemoryPoolAllocator // std::allocator -{ - using size_type = size_t; - using difference_type = ptrdiff_t; - using pointer = T*; - using const_pointer = const T*; - using reference = T&; - using const_reference = const T&; - using value_type = T; -}; - -template -class syclMemoryPoolPolyAllocator // std::pmr::polymorphic_allocator -{ -};