From 2f17a38ef085da9a00101b76f61d1a9ed960c45e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Constantin=20F=C3=BCrst?= Date: Wed, 24 Jan 2024 05:14:54 +0100 Subject: [PATCH] select device via jobs node parameter so we can skip the numa affinity change, also properly delete jobs in destructor --- offloading-cacher/cache.hpp | 22 +++++++--------------- 1 file changed, 7 insertions(+), 15 deletions(-) diff --git a/offloading-cacher/cache.hpp b/offloading-cacher/cache.hpp index d392167..07253cc 100644 --- a/offloading-cacher/cache.hpp +++ b/offloading-cacher/cache.hpp @@ -400,12 +400,6 @@ inline void dsacache::Cache::SubmitTask(CacheData* task, const int dst_node, con const size_t size = task->GetSize() / task_count; const size_t last_size = size + task->GetSize() % task_count; - // save the current numa node mask to restore later - // as executing the copy task will place this thread - // on a different node - - bitmask* nodemask = numa_get_run_node_mask(); - auto handlers = new std::vector(); for (uint32_t i = 0; i < task_count; i++) { @@ -418,18 +412,11 @@ inline void dsacache::Cache::SubmitTask(CacheData* task, const int dst_node, con } task->SetTaskHandlersAndCache(dst, handlers); - - // restore the previous nodemask - - numa_run_on_node_mask(nodemask); - numa_free_nodemask(nodemask); } inline dml_job_t* dsacache::Cache::ExecuteCopy( const uint8_t* src, uint8_t* dst, const size_t size, const int node ) const { - numa_run_on_node(node); - uint32_t job_size = 0; dml_status_t status = dml_get_job_size(DML_PATH_HW, &job_size); @@ -452,6 +439,7 @@ inline dml_job_t* dsacache::Cache::ExecuteCopy( job->destination_first_ptr = dst; job->source_length = size; job->flags |= DML_FLAG_BLOCK_ON_FAULT | DML_FLAG_COPY_ONLY; + job->numa_id = node; status = dml_submit_job(job); @@ -642,8 +630,12 @@ inline dsacache::CacheData::~CacheData() { Deallocate(); - for (dml_job_t* job : *handlers_->load()) { - if (job != nullptr) delete job; + std::vector* handlers = handlers_->load(); + + if (handlers != nullptr && handlers != reinterpret_cast*>(maxptr)) { + for (dml_job_t* job : *handlers_->load()) { + if (job != nullptr) delete job; + } } delete active_;