From 706cae9f460fe698857f47aaa42eb517ea2cb09f Mon Sep 17 00:00:00 2001 From: KunoiSayami Date: Thu, 7 Apr 2022 01:32:17 +0800 Subject: feat: Finish implement cuda memtable Signed-off-by: KunoiSayami --- util/arena.cu | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'util/arena.cu') diff --git a/util/arena.cu b/util/arena.cu index e6c8c04..e91d652 100644 --- a/util/arena.cu +++ b/util/arena.cu @@ -8,11 +8,11 @@ namespace leveldb { static const int kBlockSize = 4096; -__device__ __host__ Arena::Arena() +__device__ __host__ ArenaCuda::ArenaCuda() : alloc_ptr_(nullptr), alloc_bytes_remaining_(0), memory_usage_(0), head_(nullptr), blocks_(nullptr) {} -__host__ __device__ Arena::~Arena() { +__host__ __device__ ArenaCuda::~ArenaCuda() { ArenaNode * current = this->head_; while (current != nullptr) { ArenaNode * next = current->next; @@ -22,7 +22,7 @@ __host__ __device__ Arena::~Arena() { } } -__device__ char* Arena::AllocateFallback(size_t bytes) { +__device__ char* ArenaCuda::AllocateFallback(size_t bytes) { if (bytes > kBlockSize / 4) { // Object is more than a quarter of our block size. Allocate it separately // to avoid wasting too much space in leftover bytes. @@ -40,7 +40,7 @@ __device__ char* Arena::AllocateFallback(size_t bytes) { return result; } -__device__ char* Arena::AllocateAligned(size_t bytes) { +__device__ char* ArenaCuda::AllocateAligned(size_t bytes) { const int align = (sizeof(void*) > 8) ? sizeof(void*) : 8; static_assert((align & (align - 1)) == 0, "Pointer size should be a power of 2"); @@ -60,7 +60,7 @@ __device__ char* Arena::AllocateAligned(size_t bytes) { return result; } -__device__ char* Arena::AllocateNewBlock(size_t block_bytes) { +__device__ char* ArenaCuda::AllocateNewBlock(size_t block_bytes) { // Allocate new target char* result = nullptr; // Allocate storage target -- cgit v1.3.1