Browse Source

repair flags implementation

master
Constantin Fürst 11 months ago
parent
commit
972440d19f
  1. 7
      offloading-cacher/cache.hpp
  2. 2
      qdp_project/src/Benchmark.cpp

7
offloading-cacher/cache.hpp

@ -40,13 +40,13 @@ namespace dml {
namespace dsacache { namespace dsacache {
inline bool CheckFlag(const uint64_t value, const uint64_t flag) { 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) { 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) { 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; 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 // otherwise the cache will be set to valid now
if (result.status != dml::status_code::ok) { if (result.status != dml::status_code::ok) {
cache_->store(src_); cache_->store(src_);
numa_free(*incomplete_cache_, size_); numa_free(*incomplete_cache_, size_);
delete_ = false; delete_ = false;

2
qdp_project/src/Benchmark.cpp

@ -200,7 +200,7 @@ int main() {
// it will use the copy and caching policy from BenchmarkHelpers.cpp // it will use the copy and caching policy from BenchmarkHelpers.cpp
// which is configured for xeonmax with smart assignment // which is configured for xeonmax with smart assignment
uint64_t cache_flags = 0; uint64_t cache_flags = 0;
cache_flags += dsacache::FLAG_WAIT_WEAK;
cache_flags |= dsacache::FLAG_WAIT_WEAK;
CACHE_.SetFlags(cache_flags); CACHE_.SetFlags(cache_flags);
CACHE_.Init(CachePlacementPolicy, CopyMethodPolicy); CACHE_.Init(CachePlacementPolicy, CopyMethodPolicy);
} }

Loading…
Cancel
Save