Browse Source

select device via jobs node parameter so we can skip the numa affinity change, also properly delete jobs in destructor

master
Constantin Fürst 11 months ago
parent
commit
2f17a38ef0
  1. 18
      offloading-cacher/cache.hpp

18
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 size = task->GetSize() / task_count;
const size_t last_size = 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<dml_job_t*>(); auto handlers = new std::vector<dml_job_t*>();
for (uint32_t i = 0; i < task_count; i++) { 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); 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( inline dml_job_t* dsacache::Cache::ExecuteCopy(
const uint8_t* src, uint8_t* dst, const size_t size, const int node const uint8_t* src, uint8_t* dst, const size_t size, const int node
) const { ) const {
numa_run_on_node(node);
uint32_t job_size = 0; uint32_t job_size = 0;
dml_status_t status = dml_get_job_size(DML_PATH_HW, &job_size); 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->destination_first_ptr = dst;
job->source_length = size; job->source_length = size;
job->flags |= DML_FLAG_BLOCK_ON_FAULT | DML_FLAG_COPY_ONLY; job->flags |= DML_FLAG_BLOCK_ON_FAULT | DML_FLAG_COPY_ONLY;
job->numa_id = node;
status = dml_submit_job(job); status = dml_submit_job(job);
@ -642,9 +630,13 @@ inline dsacache::CacheData::~CacheData() {
Deallocate(); Deallocate();
std::vector<dml_job_t*>* handlers = handlers_->load();
if (handlers != nullptr && handlers != reinterpret_cast<std::vector<dml_job_t*>*>(maxptr)) {
for (dml_job_t* job : *handlers_->load()) { for (dml_job_t* job : *handlers_->load()) {
if (job != nullptr) delete job; if (job != nullptr) delete job;
} }
}
delete active_; delete active_;
delete cache_; delete cache_;

Loading…
Cancel
Save