diff --git a/.github/workflows/build-cachelib-centos-9.yml b/.github/workflows/build-cachelib-centos-9.yml index a47166f48..24973e012 100644 --- a/.github/workflows/build-cachelib-centos-9.yml +++ b/.github/workflows/build-cachelib-centos-9.yml @@ -78,6 +78,8 @@ jobs: run: ./contrib/build-package.sh -j -v -i sparsemap - name: "Install dependency: fmt" run: ./contrib/build-package.sh -j -v -i fmt + - name: "Install dependency: fastfloat" + run: ./contrib/build-package.sh -j -v -i fastfloat - name: "Install dependency: folly" run: ./contrib/build-package.sh -j -v -i folly - name: "Install dependency: fizz" diff --git a/.github/workflows/build-cachelib-rockylinux-9.yml b/.github/workflows/build-cachelib-rockylinux-9.yml index 1741c0240..3e6cec45c 100644 --- a/.github/workflows/build-cachelib-rockylinux-9.yml +++ b/.github/workflows/build-cachelib-rockylinux-9.yml @@ -76,6 +76,8 @@ jobs: run: ./contrib/build-package.sh -j -v -i sparsemap - name: "Install dependency: fmt" run: ./contrib/build-package.sh -j -v -i fmt + - name: "Install dependency: fastfloat" + run: ./contrib/build-package.sh -j -v -i fastfloat - name: "Install dependency: folly" run: | # see: https://aur.archlinux.org/packages/folly#comment-862543 diff --git a/.github/workflows/build-cachelib-ubuntu-22.yml b/.github/workflows/build-cachelib-ubuntu-22.yml index e39359c69..4de505f56 100644 --- a/.github/workflows/build-cachelib-ubuntu-22.yml +++ b/.github/workflows/build-cachelib-ubuntu-22.yml @@ -74,6 +74,8 @@ jobs: run: ./contrib/build-package.sh -j -v -i sparsemap - name: "Install dependency: fmt" run: ./contrib/build-package.sh -j -v -i fmt + - name: "Install dependency: fastfloat" + run: ./contrib/build-package.sh -j -v -i fastfloat - name: "Install dependency: folly" run: ./contrib/build-package.sh -j -v -i folly - name: "Install dependency: fizz" diff --git a/cachelib/allocator/CMakeLists.txt b/cachelib/allocator/CMakeLists.txt index 6103cdc82..483b41583 100644 --- a/cachelib/allocator/CMakeLists.txt +++ b/cachelib/allocator/CMakeLists.txt @@ -27,7 +27,16 @@ add_library (cachelib_allocator ${SERIALIZE_THRIFT_FILES} ${DATASTRUCT_SERIALIZE_THRIFT_FILES} ${MEMORY_SERIALIZE_THRIFT_FILES} - CacheAllocator.cpp + CacheAllocatorLru2QCache.cpp + CacheAllocatorLru5B2QCache.cpp + CacheAllocatorLru5BCache.cpp + CacheAllocatorLru5BCacheWithSpinBuckets.cpp + CacheAllocatorLruCache.cpp + CacheAllocatorLruCacheWithSpinBuckets.cpp + CacheAllocatorTinyLFU5BCache.cpp + CacheAllocatorTinyLFUCache.cpp + CacheAllocatorWTinyLFU5BCache.cpp + CacheAllocatorWTinyLFUCache.cpp Cache.cpp CacheDetails.cpp CacheStats.cpp diff --git a/cachelib/allocator/memory/CompressedPtr.h b/cachelib/allocator/memory/CompressedPtr.h index b56cbf2ee..b4be893e6 100644 --- a/cachelib/allocator/memory/CompressedPtr.h +++ b/cachelib/allocator/memory/CompressedPtr.h @@ -252,7 +252,7 @@ class CACHELIB_PACKED_ATTR CompressedPtr5B { : ptr_(compress(slabIdx, allocIdx, isMultiTiered, tid)), regionIdx_(getRegionIdx(slabIdx, isMultiTiered, tid)) {} - constexpr explicit CompressedPtr5B(PtrType ptr) noexcept + CompressedPtr5B(PtrType ptr) noexcept : ptr_(deserializePtr(ptr)), regionIdx_(deserializeRegion(ptr)) {} // number of bits for the Allocation offset in a slab. With slab size of 22 diff --git a/cachelib/allocator/memory/tests/TestBase.h b/cachelib/allocator/memory/tests/TestBase.h index 3534b1456..adb493965 100644 --- a/cachelib/allocator/memory/tests/TestBase.h +++ b/cachelib/allocator/memory/tests/TestBase.h @@ -77,7 +77,7 @@ class AllocTestBase : public testing::Test { } template - CompressedPtrType::PtrType compress(CompressedPtrType ptr, + typename CompressedPtrType::PtrType compress(CompressedPtrType ptr, uint32_t slabIdx, uint32_t allocIdx, bool isMultiTiered) { diff --git a/contrib/build-package.sh b/contrib/build-package.sh index 406031bd4..088ba3c3f 100755 --- a/contrib/build-package.sh +++ b/contrib/build-package.sh @@ -59,7 +59,7 @@ options: NAME: the dependency to build supported values are: zstd googlelog, googleflags, googletest, - fmt, sparsemap, + fmt, sparsemap, fastfloat, folly, fizz, wangle, mvfst, fbthrift, cachelib @@ -195,6 +195,14 @@ case "$1" in external_git_clone=yes ;; + fastfloat) + NAME=fastfloat + REPO=https://github.com/fastfloat/fast_float.git + REPODIR=cachelib/external/$NAME + SRCDIR=$REPODIR + external_git_clone=yes + ;; + folly) NAME=folly SRCDIR=cachelib/external/$NAME diff --git a/contrib/build.sh b/contrib/build.sh index b9de071bb..6cb9765a2 100755 --- a/contrib/build.sh +++ b/contrib/build.sh @@ -95,7 +95,7 @@ build_arch() build_dependencies() { - for pkg in zstd googleflags googlelog googletest sparsemap fmt folly fizz wangle mvfst fbthrift ; + for pkg in zstd googleflags googlelog googletest sparsemap fmt fastfloat folly fizz wangle mvfst fbthrift ; do # shellcheck disable=SC2086 ./contrib/build-package.sh $pass_params "$pkg" \ diff --git a/contrib/prerequisites-centos9.sh b/contrib/prerequisites-centos9.sh index b8b547810..8abddc3fc 100755 --- a/contrib/prerequisites-centos9.sh +++ b/contrib/prerequisites-centos9.sh @@ -35,6 +35,7 @@ sudo dnf install -y \ gtest-devel \ libsodium-static \ libdwarf-static \ + xxhash-devel \ numactl-devel diff --git a/contrib/prerequisites-rocky9.sh b/contrib/prerequisites-rocky9.sh index 06720aba2..82c55cbad 100755 --- a/contrib/prerequisites-rocky9.sh +++ b/contrib/prerequisites-rocky9.sh @@ -39,6 +39,7 @@ sudo dnf install -y \ libsodium-devel \ libaio-devel \ binutils-devel \ + xxhash-devel \ numactl-devel diff --git a/contrib/prerequisites-ubuntu18.sh b/contrib/prerequisites-ubuntu18.sh index f8296f893..5792a6b34 100755 --- a/contrib/prerequisites-ubuntu18.sh +++ b/contrib/prerequisites-ubuntu18.sh @@ -41,6 +41,7 @@ sudo apt-get install -y \ libdwarf-dev \ libsodium-dev \ libaio-dev \ + libxxhash-dev \ libnuma-dev # NOTE: