aboutsummaryrefslogtreecommitdiff
path: root/util/arena.cu
diff options
context:
space:
mode:
authorKunoiSayami <[email protected]>2022-04-07 01:32:17 +0800
committerKunoiSayami <[email protected]>2022-04-07 01:32:17 +0800
commit706cae9f460fe698857f47aaa42eb517ea2cb09f (patch)
tree2f3a775e280120d65191ce29760ae4aba06b57cf /util/arena.cu
parent32ce8b311269df205e192c2b61dc47faaa2c5971 (diff)
feat: Finish implement cuda memtable
Signed-off-by: KunoiSayami <[email protected]>
Diffstat (limited to 'util/arena.cu')
-rw-r--r--util/arena.cu10
1 files changed, 5 insertions, 5 deletions
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