Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
jim19930609 committed Mar 13, 2023
1 parent 1f75e47 commit 84521ae
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
4 changes: 2 additions & 2 deletions taichi/rhi/cuda/cuda_caching_allocator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ CudaCachingAllocator::CudaCachingAllocator(LlvmDevice *device)

uint64_t *CudaCachingAllocator::allocate(
const LlvmDevice::LlvmRuntimeAllocParams &params) {
auto &mem_blocks_ = UnifiedMemoryPool::get_instance().size_set_;
// auto &mem_blocks_ = UnifiedMemoryPool::get_instance().size_set_;

uint64_t *ret{nullptr};
auto size_aligned = taichi::iroundup(params.size, taichi_page_size);
Expand All @@ -34,7 +34,7 @@ uint64_t *CudaCachingAllocator::allocate(
}

void CudaCachingAllocator::release(size_t sz, uint64_t *ptr) {
auto &mem_blocks_ = UnifiedMemoryPool::get_instance().size_set_;
// auto &mem_blocks_ = UnifiedMemoryPool::get_instance().size_set_;
mem_blocks_.insert(std::make_pair(sz, reinterpret_cast<uint8_t *>(ptr)));
}

Expand Down
2 changes: 1 addition & 1 deletion taichi/rhi/cuda/cuda_caching_allocator.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ class CudaCachingAllocator {
void release(size_t sz, uint64_t *ptr);

private:
// std::set<std::pair<std::size_t, uint8_t*>> mem_blocks_;
std::set<std::pair<std::size_t, uint8_t *>> mem_blocks_;
LlvmDevice *device_{nullptr};
};

Expand Down
4 changes: 2 additions & 2 deletions taichi/runtime/llvm/snode_tree_buffer_manager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
namespace taichi::lang {

UnifiedMemoryPool &UnifiedMemoryPool::get_instance() {
static UnifiedMemoryPool *mem_pool = new UnifiedMemoryPool;
return *mem_pool;
static UnifiedMemoryPool mem_pool = UnifiedMemoryPool();
return mem_pool;
}

void UnifiedMemoryPool::merge_and_insert(Ptr ptr, std::size_t size) {
Expand Down

0 comments on commit 84521ae

Please sign in to comment.