From e5b96727cd65e30358a5fa58c38ccd32cd576d7b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Constantin=20F=C3=BCrst?= Date: Wed, 10 Jan 2024 14:24:10 +0100 Subject: [PATCH] add missing inline specifier to functions as this is header-only code --- offloading-cacher/cache-data.hpp | 12 ++++++------ offloading-cacher/cache.hpp | 4 ++-- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/offloading-cacher/cache-data.hpp b/offloading-cacher/cache-data.hpp index 95865ca..1958519 100644 --- a/offloading-cacher/cache-data.hpp +++ b/offloading-cacher/cache-data.hpp @@ -154,7 +154,7 @@ inline void dsacache::CacheData::WaitOnCompletion() { } } -dsacache::CacheData::CacheData(uint8_t* data, const size_t size) { +inline dsacache::CacheData::CacheData(uint8_t* data, const size_t size) { std::cout << "[-] New CacheData 0x" << std::hex << (uint64_t)data << std::dec << std::endl; src_ = data; @@ -165,7 +165,7 @@ dsacache::CacheData::CacheData(uint8_t* data, const size_t size) { handlers_ = std::make_unique>(); } -dsacache::CacheData::CacheData(const dsacache::CacheData& other) { +inline dsacache::CacheData::CacheData(const dsacache::CacheData& other) { std::cout << "[-] Copy Created for CacheData 0x" << std::hex << (uint64_t)other.src_ << std::dec << std::endl; // we copy the ptr to the global atomic reference counter @@ -190,7 +190,7 @@ dsacache::CacheData::CacheData(const dsacache::CacheData& other) { handlers_ = nullptr; } -dsacache::CacheData::~CacheData() { +inline dsacache::CacheData::~CacheData() { std::cout << "[-] Destructor for CacheData 0x" << std::hex << (uint64_t)src_ << std::dec << std::endl; // if this is the first instance of this cache structure @@ -221,7 +221,7 @@ dsacache::CacheData::~CacheData() { } } -void dsacache::CacheData::Deallocate() { +inline void dsacache::CacheData::Deallocate() { std::cout << "[!] Deallocating for CacheData 0x" << std::hex << (uint64_t)src_ << std::dec << std::endl; // although deallocate should only be called from @@ -232,11 +232,11 @@ void dsacache::CacheData::Deallocate() { if (cache_local != nullptr) numa_free(cache_local, size_); } -uint8_t* dsacache::CacheData::GetDataLocation() const { +inline uint8_t* dsacache::CacheData::GetDataLocation() const { return cache_->load(); } -bool dsacache::CacheData::Active() const { +inline bool dsacache::CacheData::Active() const { // this entry is active if more than one // reference exists to it, as the Cache // will always keep one internally until diff --git a/offloading-cacher/cache.hpp b/offloading-cacher/cache.hpp index 952dd47..22b23f8 100644 --- a/offloading-cacher/cache.hpp +++ b/offloading-cacher/cache.hpp @@ -238,7 +238,7 @@ inline dml::handler> dsacache:: return dml::submit(dml::mem_copy.block_on_fault(), srcv, dstv); } -void dsacache::Cache::GetCacheNode(uint8_t* src, const size_t size, int* OUT_DST_NODE, int* OUT_SRC_NODE) const { +inline void dsacache::Cache::GetCacheNode(uint8_t* src, const size_t size, int* OUT_DST_NODE, int* OUT_SRC_NODE) const { // obtain numa node of current thread to determine where the data is needed const int current_cpu = sched_getcpu(); @@ -307,7 +307,7 @@ inline void dsacache::Cache::Flush(const int node) { } } -std::unique_ptr dsacache::Cache::GetFromCache(uint8_t* src, const size_t size, const int dst_node) { +inline std::unique_ptr dsacache::Cache::GetFromCache(uint8_t* src, const size_t size, const int dst_node) { // the best situation is if this data is already cached // which we check in an unnamed block in which the cache // is locked for reading to prevent another thread