Browse Source

add missing inline specifier to functions as this is header-only code

master
Constantin Fürst 12 months ago
parent
commit
e5b96727cd
  1. 12
      offloading-cacher/cache-data.hpp
  2. 4
      offloading-cacher/cache.hpp

12
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; std::cout << "[-] New CacheData 0x" << std::hex << (uint64_t)data << std::dec << std::endl;
src_ = data; src_ = data;
@ -165,7 +165,7 @@ dsacache::CacheData::CacheData(uint8_t* data, const size_t size) {
handlers_ = std::make_unique<std::vector<dml_handler>>(); handlers_ = std::make_unique<std::vector<dml_handler>>();
} }
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; 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 // we copy the ptr to the global atomic reference counter
@ -190,7 +190,7 @@ dsacache::CacheData::CacheData(const dsacache::CacheData& other) {
handlers_ = nullptr; handlers_ = nullptr;
} }
dsacache::CacheData::~CacheData() {
inline dsacache::CacheData::~CacheData() {
std::cout << "[-] Destructor for CacheData 0x" << std::hex << (uint64_t)src_ << std::dec << std::endl; 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 // 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; std::cout << "[!] Deallocating for CacheData 0x" << std::hex << (uint64_t)src_ << std::dec << std::endl;
// although deallocate should only be called from // although deallocate should only be called from
@ -232,11 +232,11 @@ void dsacache::CacheData::Deallocate() {
if (cache_local != nullptr) numa_free(cache_local, size_); 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(); return cache_->load();
} }
bool dsacache::CacheData::Active() const {
inline bool dsacache::CacheData::Active() const {
// this entry is active if more than one // this entry is active if more than one
// reference exists to it, as the Cache // reference exists to it, as the Cache
// will always keep one internally until // will always keep one internally until

4
offloading-cacher/cache.hpp

@ -238,7 +238,7 @@ inline dml::handler<dml::mem_copy_operation, std::allocator<uint8_t>> dsacache::
return dml::submit<dml::automatic>(dml::mem_copy.block_on_fault(), srcv, dstv); return dml::submit<dml::automatic>(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 // obtain numa node of current thread to determine where the data is needed
const int current_cpu = sched_getcpu(); const int current_cpu = sched_getcpu();
@ -307,7 +307,7 @@ inline void dsacache::Cache::Flush(const int node) {
} }
} }
std::unique_ptr<dsacache::CacheData> dsacache::Cache::GetFromCache(uint8_t* src, const size_t size, const int dst_node) {
inline std::unique_ptr<dsacache::CacheData> dsacache::Cache::GetFromCache(uint8_t* src, const size_t size, const int dst_node) {
// the best situation is if this data is already cached // the best situation is if this data is already cached
// which we check in an unnamed block in which the cache // which we check in an unnamed block in which the cache
// is locked for reading to prevent another thread // is locked for reading to prevent another thread

Loading…
Cancel
Save