This contains my bachelors thesis and associated tex files, code snippets and maybe more. Topic: Data Movement in Heterogeneous Memories with Intel Data Streaming Accelerator
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

720 lines
26 KiB

  1. #pragma once
  2. #include <iostream>
  3. #include <unordered_map>
  4. #include <shared_mutex>
  5. #include <mutex>
  6. #include <memory>
  7. #include <sched.h>
  8. #include <numa.h>
  9. #include <numaif.h>
  10. #include <dml/dml.hpp>
  11. namespace dml {
  12. inline const std::string StatusCodeToString(const dml::status_code code) {
  13. switch (code) {
  14. case dml::status_code::ok: return "ok";
  15. case dml::status_code::false_predicate: return "false predicate";
  16. case dml::status_code::partial_completion: return "partial completion";
  17. case dml::status_code::nullptr_error: return "nullptr error";
  18. case dml::status_code::bad_size: return "bad size";
  19. case dml::status_code::bad_length: return "bad length";
  20. case dml::status_code::inconsistent_size: return "inconsistent size";
  21. case dml::status_code::dualcast_bad_padding: return "dualcast bad padding";
  22. case dml::status_code::bad_alignment: return "bad alignment";
  23. case dml::status_code::buffers_overlapping: return "buffers overlapping";
  24. case dml::status_code::delta_delta_empty: return "delta delta empty";
  25. case dml::status_code::batch_overflow: return "batch overflow";
  26. case dml::status_code::execution_failed: return "execution failed";
  27. case dml::status_code::unsupported_operation: return "unsupported operation";
  28. case dml::status_code::queue_busy: return "queue busy";
  29. case dml::status_code::error: return "unknown error";
  30. case dml::status_code::config_error: return "config error";
  31. default: return "unhandled error";
  32. }
  33. }
  34. }
  35. namespace dsacache {
  36. constexpr bool WAIT_WEAK = true;
  37. class Cache;
  38. /*
  39. * Class Description:
  40. * Holds all required information on one cache entry and is used
  41. * both internally by the Cache and externally by the user.
  42. *
  43. * Important Usage Notes:
  44. * The pointer is only updated in WaitOnCompletion() which
  45. * therefore must be called by the user at some point in order
  46. * to use the cached data. Using this class as T for
  47. * std::shared_ptr<T> is not recommended as references are
  48. * already counted internally.
  49. *
  50. * Cache Lifetime:
  51. * As long as the instance is referenced, the pointer it stores
  52. * is guaranteed to be either nullptr or pointing to a valid copy.
  53. *
  54. * Implementation Detail:
  55. * Performs self-reference counting with a shared atomic integer.
  56. * Therefore on creating a copy the reference count is increased
  57. * and with the destructor it is deacresed. If the last copy is
  58. * destroyed the actual underlying data is freed and all shared
  59. * variables deleted.
  60. *
  61. * Notes on Thread Safety:
  62. * Class is thread safe in any possible state and performs
  63. * reference counting and deallocation itself entirely atomically.
  64. */
  65. class CacheData {
  66. public:
  67. using dml_handler = dml::handler<dml::mem_copy_operation, std::allocator<uint8_t>>;
  68. private:
  69. static constexpr uint64_t maxptr = 0xffff'ffff'ffff'ffff;
  70. // set to false if we do not own the cache pointer
  71. bool delete_ = false;
  72. // data source and size of the block
  73. uint8_t* src_;
  74. size_t size_;
  75. // global reference counting object
  76. std::atomic<int32_t>* active_;
  77. // global cache-location pointer
  78. std::atomic<uint8_t*>* cache_;
  79. // object-local incomplete cache location pointer
  80. // contract: only access when being in sole posession of handlers
  81. uint8_t** incomplete_cache_;
  82. // dml handler vector pointer which is used
  83. // to wait on caching task completion
  84. std::atomic<dml_handler*>* handler_;
  85. // deallocates the global cache-location
  86. // and invalidates it
  87. void Deallocate();
  88. size_t GetSize() const { return size_; }
  89. uint8_t* GetSource() const { return src_; }
  90. int32_t GetRefCount() const { return active_->load(); }
  91. void SetTaskHandlerAndCache(uint8_t* cache, dml_handler* handler);
  92. // initializes the class after which it is thread safe
  93. // but may only be destroyed safely after setting handlers
  94. void Init();
  95. friend Cache;
  96. public:
  97. CacheData(uint8_t* data, const size_t size);
  98. CacheData(const CacheData& other);
  99. ~CacheData();
  100. // waits on completion of caching operations
  101. // for this task and is safe to be called in
  102. // any state of the object
  103. void WaitOnCompletion(const bool weak = false);
  104. // returns the cache data location for this
  105. // instance which is valid as long as the
  106. // instance is alive - !!! this may also
  107. // yield a nullptr !!!
  108. uint8_t* GetDataLocation() const { return cache_->load(); }
  109. };
  110. /*
  111. * Class Description:
  112. * Class will handle access to data through internal copies.
  113. * These are obtained via work submission to the Intel DSA which takes
  114. * care of asynchronously duplicating the data. The user will define
  115. * where these copies lie and which system nodes will perform the copy.
  116. * This is done through policy functions set during initialization.
  117. *
  118. * Placement Policy:
  119. * The Placement Policy Function decides on which node a particular
  120. * entry is to be placed, given the current executing node and the
  121. * data source node and data size. This in turn means that for one
  122. * datum, multiple cached copies may exist at one time.
  123. *
  124. * Cache Lifetime:
  125. * When accessing the cache, a CacheData-object will be returned.
  126. * As long as this object lives, the pointer which it holds is
  127. * guaranteed to be either nullptr or a valid copy. When destroyed
  128. * the entry is marked for deletion which is only carried out
  129. * when system memory pressure drives an automated cache flush.
  130. *
  131. * Restrictions:
  132. * - Overlapping Pointers may lead to undefined behaviour during
  133. * manual cache invalidation which should not be used if you
  134. * intend to have these types of pointers
  135. * - Cache Invalidation may only be performed manually and gives
  136. * no ordering guarantees. Therefore, it is the users responsibility
  137. * to ensure that results after invalidation have been generated
  138. * using the latest state of data. The cache is best suited
  139. * to static data.
  140. *
  141. * Notes on Thread Safety:
  142. * - Cache is completely thread-safe after initialization
  143. * - CacheData-class will handle deallocation of data itself by
  144. * performing self-reference-counting atomically and only
  145. * deallocating if the last reference is destroyed
  146. * - The internal cache state has one lock which is either
  147. * acquired shared for reading the state (upon accessing an already
  148. * cached element) or unique (accessing a new element, flushing, invalidating)
  149. * - Waiting on copy completion is done over an atomic-wait in copies
  150. * of the original CacheData-instance
  151. * - Overall this class may experience performance issues due to the use
  152. * of locking (in any configuration), lock contention (worsens with higher
  153. * core count, node count and utilization) and atomics (worse in the same
  154. * situations as lock contention)
  155. *
  156. * Improving Performance:
  157. * When data is never shared between threads or memory size for the cache is
  158. * not an issue you may consider having one Cache-instance per thread and removing
  159. * the lock in Cache and modifying the reference counting and waiting mechanisms
  160. * of CacheData accordingly (although this is high effort and will yield little due
  161. * to the atomics not being shared among cores/nodes).
  162. * Otherwise, one Cache-instance per node could also be considered. This will allow
  163. * the placement policy function to be barebones and reduces the lock contention and
  164. * synchronization impact of the atomic variables.
  165. */
  166. class Cache {
  167. public:
  168. // cache policy is defined as a type here to allow flexible usage of the cacher
  169. // given a numa destination node (where the data will be needed), the numa source
  170. // node (current location of the data) and the data size, this function should
  171. // return optimal cache placement
  172. // dst node and returned value can differ if the system, for example, has HBM
  173. // attached accessible directly to node n under a different node id m
  174. typedef int (CachePolicy)(const int numa_dst_node, const int numa_src_node, const size_t data_size);
  175. // copy policy specifies the copy-executing nodes for a given task
  176. // which allows flexibility in assignment for optimizing raw throughput
  177. // or choosing a conservative usage policy
  178. typedef std::vector<int> (CopyPolicy)(const int numa_dst_node, const int numa_src_node, const size_t data_size);
  179. private:
  180. // mutex for accessing the cache state map
  181. // map from [dst-numa-node,map2]
  182. // map2 from [data-ptr,cache-structure]
  183. struct LockedNodeCacheState {
  184. std::shared_mutex cache_mutex_;
  185. std::unordered_map<uint8_t*, CacheData> node_cache_state_;
  186. };
  187. std::unordered_map<uint8_t, LockedNodeCacheState*> cache_state_;
  188. CachePolicy* cache_policy_function_ = nullptr;
  189. CopyPolicy* copy_policy_function_ = nullptr;
  190. // function used to submit a copy task on a specific node to the dml
  191. // engine on that node - will change the current threads node assignment
  192. // to achieve this so take care to restore this
  193. dml::handler<dml::mem_copy_operation, std::allocator<uint8_t>> ExecuteCopy(
  194. const uint8_t* src, uint8_t* dst, const size_t size, const int node
  195. ) const;
  196. // allocates the required memory on the destination node
  197. // and then submits task to the dml library for processing
  198. // and attaches the handlers to the cache data structure
  199. void SubmitTask(CacheData* task, const int dst_node, const int src_node);
  200. // querries the policy functions for the given data and size
  201. // to obtain destination cache node, also returns the datas
  202. // source node for further usage
  203. // output may depend on the calling threads node assignment
  204. // as this is set as the "optimal placement" node
  205. void GetCacheNode(uint8_t* src, const size_t size, int* OUT_DST_NODE, int* OUT_SRC_NODE) const;
  206. // allocates memory of size "size" on the numa node "node"
  207. // and returns nullptr if this is not possible, also may
  208. // try to flush the cache of the requested node to
  209. // alleviate encountered shortage
  210. uint8_t* AllocOnNode(const size_t size, const int node);
  211. // checks whether the cache contains an entry for
  212. // the given data in the given memory node and
  213. // returns it, otherwise returns nullptr
  214. std::unique_ptr<CacheData> GetFromCache(uint8_t* src, const size_t size, const int dst_node);
  215. public:
  216. ~Cache();
  217. Cache() = default;
  218. Cache(const Cache& other) = delete;
  219. // initializes the cache with the two policy functions
  220. // only after this is it safe to use in a threaded environment
  221. void Init(CachePolicy* cache_policy_function, CopyPolicy* copy_policy_function);
  222. // function to perform data access through the cache
  223. std::unique_ptr<CacheData> Access(uint8_t* data, const size_t size);
  224. // flushes the cache of inactive entries
  225. // if node is -1 then the whole cache is
  226. // checked and otherwise the specified
  227. // node - no checks on node validity
  228. void Flush(const int node = -1);
  229. // forces out all entries from the
  230. // cache and therefore will also "forget"
  231. // still-in-use entries, these will still
  232. // be properly deleted, but the cache
  233. // will be fresh - use for testing
  234. void Clear();
  235. void Invalidate(uint8_t* data);
  236. };
  237. }
  238. inline void dsacache::Cache::Clear() {
  239. for (auto& nc : cache_state_) {
  240. std::unique_lock<std::shared_mutex> lock(nc.second->cache_mutex_);
  241. nc.second->node_cache_state_.clear();
  242. }
  243. }
  244. inline void dsacache::Cache::Init(CachePolicy* cache_policy_function, CopyPolicy* copy_policy_function) {
  245. cache_policy_function_ = cache_policy_function;
  246. copy_policy_function_ = copy_policy_function;
  247. // initialize numa library
  248. numa_available();
  249. // obtain all available nodes
  250. // and those we may allocate
  251. // memory on
  252. const int nodes_max = numa_num_configured_nodes();
  253. const bitmask* valid_nodes = numa_get_mems_allowed();
  254. // prepare the cache state with entries
  255. // for all given nodes
  256. for (int node = 0; node < nodes_max; node++) {
  257. if (numa_bitmask_isbitset(valid_nodes, node)) {
  258. void* block = numa_alloc_onnode(sizeof(LockedNodeCacheState), node);
  259. auto* state = new(block)LockedNodeCacheState;
  260. cache_state_.insert({node,state});
  261. }
  262. }
  263. }
  264. inline std::unique_ptr<dsacache::CacheData> dsacache::Cache::Access(uint8_t* data, const size_t size) {
  265. // get destination numa node for the cache
  266. int dst_node = -1;
  267. int src_node = -1;
  268. GetCacheNode(data, size, &dst_node, &src_node);
  269. // TODO: at this point it could be beneficial to check whether
  270. // TODO: the given destination node is present as an entry
  271. // TODO: in the cache state to see if it is valid
  272. // check whether the data is already cached
  273. std::unique_ptr<CacheData> task = GetFromCache(data, size, dst_node);
  274. if (task != nullptr) {
  275. return std::move(task);
  276. }
  277. // at this point the requested data is not present in cache
  278. // and we create a caching task for it
  279. task = std::make_unique<CacheData>(data, size);
  280. {
  281. LockedNodeCacheState* local_cache_state = cache_state_[dst_node];
  282. std::unique_lock<std::shared_mutex> lock(local_cache_state->cache_mutex_);
  283. const auto state = local_cache_state->node_cache_state_.emplace(task->GetSource(), *task);
  284. // if state.second is false then no insertion took place
  285. // which means that concurrently whith this thread
  286. // some other thread must have accessed the same
  287. // resource in which case we return the other
  288. // threads data cache structure
  289. if (!state.second) {
  290. return std::move(std::make_unique<CacheData>(state.first->second));
  291. }
  292. // initialize the task now for thread safety
  293. // as we are now sure that we will submit work
  294. // to it and will not delete it beforehand
  295. task->Init();
  296. }
  297. SubmitTask(task.get(), dst_node, src_node);
  298. return std::move(task);
  299. }
  300. inline uint8_t* dsacache::Cache::AllocOnNode(const size_t size, const int node) {
  301. // allocate data on this node and flush the unused parts of the
  302. // cache if the operation fails and retry once
  303. // TODO: smarter flush strategy could keep some stuff cached
  304. // check currently free memory to see if the data fits
  305. long long int free_space = 0;
  306. numa_node_size64(node, &free_space);
  307. if (free_space < size) {
  308. // dst node lacks memory space so we flush the cache for this
  309. // node hoping to free enough currently unused entries to make
  310. // the second allocation attempt successful
  311. Flush(node);
  312. // re-test by getting the free space and checking again
  313. numa_node_size64(node, &free_space);
  314. if (free_space < size) {
  315. return nullptr;
  316. }
  317. }
  318. uint8_t* dst = reinterpret_cast<uint8_t*>(numa_alloc_onnode(size, node));
  319. if (dst == nullptr) {
  320. return nullptr;
  321. }
  322. return dst;
  323. }
  324. inline void dsacache::Cache::SubmitTask(CacheData* task, const int dst_node, const int src_node) {
  325. static thread_local int last_node_index = -1;
  326. // stores the last node used for the local thread so we can achieve some
  327. // load balancing which locally might look like round robin, but considering
  328. // that one source thread may see different results for "executing_nodes" with
  329. // different sizes, and that multiple threads will submit, in reality we
  330. // achieve a "wild-west-style" load balance here
  331. uint8_t* dst = AllocOnNode(task->GetSize(), dst_node);
  332. if (dst == nullptr) {
  333. return;
  334. }
  335. // querry copy policy function for the nodes available to use for the copy
  336. const std::vector<int> executing_nodes = copy_policy_function_(dst_node, src_node, task->GetSize());
  337. // use our load balancing method and determine node for this task
  338. last_node_index = ++last_node_index % executing_nodes.size();
  339. const int node = executing_nodes[last_node_index];
  340. // submit the copy and attach it to the task entry
  341. auto* handler = new CacheData::dml_handler();
  342. *handler = ExecuteCopy(task->GetSource(), dst, task->GetSize(), node);
  343. task->SetTaskHandlerAndCache(dst, handler);
  344. }
  345. inline dml::handler<dml::mem_copy_operation, std::allocator<uint8_t>> dsacache::Cache::ExecuteCopy(
  346. const uint8_t* src, uint8_t* dst, const size_t size, const int node
  347. ) const {
  348. dml::const_data_view srcv = dml::make_view(src, size);
  349. dml::data_view dstv = dml::make_view(dst, size);
  350. return dml::submit<dml::hardware>(
  351. dml::mem_copy.block_on_fault(), srcv, dstv,
  352. dml::execution_interface<dml::hardware,std::allocator<uint8_t>>(), node
  353. );
  354. }
  355. inline void dsacache::Cache::GetCacheNode(uint8_t* src, const size_t size, int* OUT_DST_NODE, int* OUT_SRC_NODE) const {
  356. // obtain numa node of current thread to determine where the data is needed
  357. const int current_cpu = sched_getcpu();
  358. const int current_node = numa_node_of_cpu(current_cpu);
  359. // obtain node that the given data pointer is allocated on
  360. *OUT_SRC_NODE = -1;
  361. get_mempolicy(OUT_SRC_NODE, NULL, 0, (void*)src, MPOL_F_NODE | MPOL_F_ADDR);
  362. // querry cache policy function for the destination numa node
  363. *OUT_DST_NODE = cache_policy_function_(current_node, *OUT_SRC_NODE, size);
  364. }
  365. inline void dsacache::Cache::Flush(const int node) {
  366. // this lambda is used because below we have two code paths that
  367. // flush nodes, either one single or all successively
  368. const auto FlushNode = [](std::unordered_map<uint8_t*,CacheData>& map) {
  369. // begin at the front of the map
  370. auto it = map.begin();
  371. // loop until we reach the end of the map
  372. while (it != map.end()) {
  373. // if the iterator points to an inactive element
  374. // then we may erase it
  375. if (it->second.GetRefCount() <= 1) {
  376. // erase the iterator from the map
  377. map.erase(it);
  378. // as the erasure invalidated out iterator
  379. // we must start at the beginning again
  380. it = map.begin();
  381. }
  382. else {
  383. // if element is active just move over to the next one
  384. it++;
  385. }
  386. }
  387. };
  388. // we require exclusive lock as we modify the cache state
  389. // node == -1 means that cache on all nodes should be flushed
  390. if (node == -1) {
  391. for (auto& nc : cache_state_) {
  392. std::unique_lock<std::shared_mutex> lock(nc.second->cache_mutex_);
  393. FlushNode(nc.second->node_cache_state_);
  394. }
  395. }
  396. else {
  397. std::unique_lock<std::shared_mutex> lock(cache_state_[node]->cache_mutex_);
  398. FlushNode(cache_state_[node]->node_cache_state_);
  399. }
  400. }
  401. inline std::unique_ptr<dsacache::CacheData> dsacache::Cache::GetFromCache(uint8_t* src, const size_t size, const int dst_node) {
  402. // the best situation is if this data is already cached
  403. // which we check in an unnamed block in which the cache
  404. // is locked for reading to prevent another thread
  405. // from marking the element we may find as unused and
  406. // clearing it
  407. LockedNodeCacheState* local_cache_state = cache_state_[dst_node];
  408. // lock the cache state in shared-mode because we read
  409. std::shared_lock<std::shared_mutex> lock(local_cache_state->cache_mutex_);
  410. // search for the data in our cache state structure at the given node
  411. const auto search = local_cache_state->node_cache_state_.find(src);
  412. // if the data is in our structure we continue
  413. if (search != local_cache_state->node_cache_state_.end()) {
  414. // now check whether the sizes match
  415. if (search->second.GetSize() >= size) {
  416. // return a unique copy of the entry which uses the object
  417. // lifetime and destructor to safely handle deallocation
  418. return std::move(std::make_unique<CacheData>(search->second));
  419. }
  420. else {
  421. // if the sizes missmatch then we clear the current entry from cache
  422. // which will cause its deletion only after the last possible outside
  423. // reference is also destroyed
  424. local_cache_state->node_cache_state_.erase(search);
  425. }
  426. }
  427. return nullptr;
  428. }
  429. void dsacache::Cache::Invalidate(uint8_t* data) {
  430. // as the cache is modified we must obtain a unique writers lock
  431. // loop through all per-node-caches available
  432. for (auto node : cache_state_) {
  433. std::unique_lock<std::shared_mutex> lock(node.second->cache_mutex_);
  434. // search for an entry for the given data pointer
  435. auto search = node.second->node_cache_state_.find(data);
  436. if (search != node.second->node_cache_state_.end()) {
  437. // if the data is represented in-cache
  438. // then it will be erased to re-trigger
  439. // caching on next access
  440. node.second->node_cache_state_.erase(search);
  441. }
  442. }
  443. }
  444. inline dsacache::Cache::~Cache() {
  445. for (auto node : cache_state_) {
  446. node.second->~LockedNodeCacheState();
  447. numa_free(reinterpret_cast<void*>(node.second), sizeof(LockedNodeCacheState));
  448. }
  449. }
  450. inline dsacache::CacheData::CacheData(uint8_t* data, const size_t size) {
  451. src_ = data;
  452. size_ = size;
  453. delete_ = false;
  454. active_ = new std::atomic<int32_t>(1);
  455. cache_ = new std::atomic<uint8_t*>(data);
  456. handler_ = new std::atomic<dml_handler*>(nullptr);
  457. incomplete_cache_ = new uint8_t*(nullptr);
  458. }
  459. inline dsacache::CacheData::CacheData(const dsacache::CacheData& other) {
  460. // we copy the ptr to the global atomic reference counter
  461. // and increase the amount of active references
  462. active_ = other.active_;
  463. const int current_active = active_->fetch_add(1);
  464. src_ = other.src_;
  465. size_ = other.size_;
  466. cache_ = other.cache_;
  467. incomplete_cache_ = other.incomplete_cache_;
  468. handler_ = other.handler_;
  469. }
  470. inline dsacache::CacheData::~CacheData() {
  471. // due to fetch_sub returning the preivously held value
  472. // we must subtract one locally to get the current value
  473. const int32_t v = active_->fetch_sub(1) - 1;
  474. // if the returned value is zero or lower
  475. // then we must execute proper deletion
  476. // as this was the last reference
  477. if (v == 0) {
  478. // on deletion we must ensure that all offloaded
  479. // operations have completed successfully
  480. WaitOnCompletion();
  481. // only then can we deallocate the memory
  482. Deallocate();
  483. delete active_;
  484. delete cache_;
  485. delete handler_;
  486. delete incomplete_cache_;
  487. }
  488. }
  489. inline void dsacache::CacheData::Deallocate() {
  490. // although deallocate should only be called from
  491. // a safe context to do so, it can not hurt to
  492. // defensively perform the operation atomically
  493. // and check for incomplete cache if no deallocation
  494. // takes place for the retrieved local cache
  495. uint8_t* cache_local = cache_->exchange(nullptr);
  496. if (cache_local != nullptr && delete_) numa_free(cache_local, size_);
  497. else if (*incomplete_cache_ != nullptr) numa_free(*incomplete_cache_, size_);
  498. else;
  499. }
  500. inline void dsacache::CacheData::WaitOnCompletion(const bool weak) {
  501. // first check if waiting is even neccessary as a valid
  502. // cache pointer signals that no waiting is to be performed
  503. if (cache_->load() != nullptr) {
  504. return;
  505. }
  506. // then check if the handlers are available
  507. handler_->wait(nullptr);
  508. // exchange the global handlers pointer with nullptr to have a local
  509. // copy - this signals that this thread is the sole owner and therefore
  510. // responsible for waiting for them. we can not set to nullptr here but
  511. // set to maximum of 64-bit in order to prevent deadlocks from the above
  512. // waiting construct
  513. dml_handler* local_handler = handler_->exchange(reinterpret_cast<dml_handler*>(maxptr));
  514. // ensure that no other thread snatched the handlers before us
  515. // and in case one did, wait again and then return
  516. if (local_handler == nullptr || local_handler == reinterpret_cast<dml_handler*>(maxptr)) {
  517. cache_->wait(nullptr);
  518. return;
  519. }
  520. // at this point we are responsible for waiting for the handlers
  521. // and handling any error that comes through them gracefully
  522. if (weak && !local_handler->is_finished()) {
  523. handler_->store(local_handler);
  524. return;
  525. }
  526. // perform the wait
  527. auto result = local_handler->get();
  528. // at this point handlers has been waited for
  529. // and therefore may be decomissioned
  530. delete local_handler;
  531. // if the copy tasks failed we abort the whole task
  532. // otherwise the cache will be set to valid now
  533. if (result.status != dml::status_code::ok) {
  534. cache_->store(src_);
  535. numa_free(*incomplete_cache_, size_);
  536. delete_ = false;
  537. *incomplete_cache_ = nullptr;
  538. }
  539. else {
  540. cache_->store(*incomplete_cache_);
  541. }
  542. // notify all waiting threads so they wake up quickly
  543. cache_->notify_all();
  544. handler_->notify_all();
  545. }
  546. void dsacache::CacheData::SetTaskHandlerAndCache(uint8_t* cache, dml_handler* handler) {
  547. *incomplete_cache_ = cache;
  548. handler_->store(handler);
  549. handler_->notify_one();
  550. }
  551. void dsacache::CacheData::Init() {
  552. cache_->store(nullptr);
  553. delete_ = true;
  554. }