From 22d80669c1f690542f702974a5cad2dd104a4761 Mon Sep 17 00:00:00 2001 From: Hochan Lee Date: Sun, 14 Jan 2024 16:13:50 -0600 Subject: [PATCH] addcomments --- src/c/backend/include/runtime.hpp | 9 ++++++++- src/c/backend/phases.cpp | 22 ++++++++++------------ 2 files changed, 18 insertions(+), 13 deletions(-) diff --git a/src/c/backend/include/runtime.hpp b/src/c/backend/include/runtime.hpp index 88e06018..d4ab7214 100644 --- a/src/c/backend/include/runtime.hpp +++ b/src/c/backend/include/runtime.hpp @@ -277,7 +277,7 @@ class InnerTask { /* Task Assigned Device Set*/ std::vector assigned_devices; - /*Resource Requirements for each assigned device*/ + /* Resource Requirements for each assigned device*/ std::unordered_map device_constraints; /* Task is data movement task */ @@ -293,6 +293,13 @@ class InnerTask { std::vector>> parray_list; + /* A list of dependency tasks of a parray for this task's dependent tasks. + To be specific, a task sets dependencies of a parray for dependent tasks. + If this task's access permission to a parray includes write, it sets + itself as the dependency of the parray. + If this task's access permission to the parray is read-only, it pulls + this list of the dependencies to this map. + */ std::unordered_map> parray_dependencies_map; InnerTask(); diff --git a/src/c/backend/phases.cpp b/src/c/backend/phases.cpp index 2713e21f..ac48bca8 100644 --- a/src/c/backend/phases.cpp +++ b/src/c/backend/phases.cpp @@ -239,7 +239,8 @@ void MemoryReserver::create_datamove_tasks(InnerTask *task) { - +// TODO(hc): need to think about better naming before it is merged. +// first, need peer-review on this. void MemoryReserver::create_datamove_tasks2(InnerTask *task) { // Get a list of the parrays the current task holds. const std::vector>> @@ -258,28 +259,25 @@ void MemoryReserver::create_datamove_tasks2(InnerTask *task) { task_base_name + ".dm." + std::to_string(i), 0, parray, access_mode, i); uint64_t parray_parent_id = parray->get_parent_parray()->id; - // Find dependency intersection between compute and data movement tasks. - - // TODO(hc): This is not the complete implementation. - // We will use a concurrent map for parray's - // task list as an optimization. - + // Get dependencies std::vector compute_task_dependencies = task->get_dependencies(); std::vector data_task_dependencies; for (size_t k = 0; k < compute_task_dependencies.size(); ++k) { InnerTask *parray_dependency = static_cast(compute_task_dependencies[k]); + // Get dependencies of a parray having `parray_parent_id` that have + // registered to the traversed dependency task std::vector& dep_parray_dependencies = parray_dependency->get_parray_dependencies(parray_parent_id); - std::cout << parray_dependency->name << " is being traversed\n"; + //std::cout << parray_dependency->name << " is being traversed\n"; for (size_t t = 0; t < dep_parray_dependencies.size(); ++t) { data_task_dependencies.push_back(parray_dependency); // If the current processing parray's access mode is READ ONLY, // add this dependency as a dependency for this parray. - std::cout << "access mode:" << int(access_mode) << "\n"; + //std::cout << "access mode:" << int(access_mode) << "\n"; if (access_mode == AccessMode::IN) { - std::cout << "IN parray is added:" << parray_parent_id << "\n"; + //std::cout << "IN parray is added:" << parray_parent_id << "\n"; task->get_parray_dependencies(parray_parent_id).push_back(parray_dependency); } } @@ -287,9 +285,9 @@ void MemoryReserver::create_datamove_tasks2(InnerTask *task) { // If the current processing parray's access mode is not READ ONLY, // add itself as a dependency for this parray. - std::cout << task->name << " is being traversed access id :" << int(access_mode) << "\n"; + //std::cout << task->name << " is being traversed access id :" << int(access_mode) << "\n"; if (access_mode != AccessMode::IN) { - std::cout << "IN/OUT OUT parray is added:" << parray_parent_id << "\n"; + //std::cout << "IN/OUT OUT parray is added:" << parray_parent_id << "\n"; task->get_parray_dependencies(parray_parent_id).push_back(task); }