From 972440d19fefe0f4c392614a37f6872be03d6283 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Constantin=20F=C3=BCrst?= Date: Thu, 25 Jan 2024 18:22:56 +0100 Subject: [PATCH] repair flags implementation --- offloading-cacher/cache.hpp | 7 +++---- qdp_project/src/Benchmark.cpp | 2 +- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/offloading-cacher/cache.hpp b/offloading-cacher/cache.hpp index 01e4f49..c96c468 100644 --- a/offloading-cacher/cache.hpp +++ b/offloading-cacher/cache.hpp @@ -40,13 +40,13 @@ namespace dml { namespace dsacache { inline bool CheckFlag(const uint64_t value, const uint64_t flag) { - return (value & ~flag) != 0ULL; + return (value & flag) != 0; } inline uint64_t UnsetFlag(const uint64_t value, const uint64_t flag) { - return value & ~flag; + return value & (~flag); } inline uint64_t SetFlag(const uint64_t value, const uint64_t flag) { - return value + flag; + return value | flag; } constexpr uint64_t FLAG_WAIT_WEAK = 0b1ULL << 63; @@ -723,7 +723,6 @@ inline void dsacache::CacheData::WaitOnCompletion() { // otherwise the cache will be set to valid now if (result.status != dml::status_code::ok) { - cache_->store(src_); numa_free(*incomplete_cache_, size_); delete_ = false; diff --git a/qdp_project/src/Benchmark.cpp b/qdp_project/src/Benchmark.cpp index 12d829c..d7dc302 100644 --- a/qdp_project/src/Benchmark.cpp +++ b/qdp_project/src/Benchmark.cpp @@ -200,7 +200,7 @@ int main() { // it will use the copy and caching policy from BenchmarkHelpers.cpp // which is configured for xeonmax with smart assignment uint64_t cache_flags = 0; - cache_flags += dsacache::FLAG_WAIT_WEAK; + cache_flags |= dsacache::FLAG_WAIT_WEAK; CACHE_.SetFlags(cache_flags); CACHE_.Init(CachePlacementPolicy, CopyMethodPolicy); }