From 7dbc95404e2c9f619822fc3ce762d9fec3f03f23 Mon Sep 17 00:00:00 2001 From: Changhai Man Date: Mon, 19 Aug 2024 16:40:06 -0400 Subject: [PATCH 1/5] explicitly specify const for ETFeederNode attrbutes functions modified: src/feeder/et_feeder_node.cpp modified: src/feeder/et_feeder_node.h --- src/feeder/et_feeder_node.cpp | 28 ++++++++++++++-------------- src/feeder/et_feeder_node.h | 28 ++++++++++++++-------------- 2 files changed, 28 insertions(+), 28 deletions(-) diff --git a/src/feeder/et_feeder_node.cpp b/src/feeder/et_feeder_node.cpp index 3cb2ced0..a1302582 100644 --- a/src/feeder/et_feeder_node.cpp +++ b/src/feeder/et_feeder_node.cpp @@ -83,58 +83,58 @@ bool ETFeederNode::has_other_attr(const string& attr_name) const { return item != this->other_attrs_.end(); } -uint64_t ETFeederNode::id() { +uint64_t ETFeederNode::id() const { return id_; } -string ETFeederNode::name() { +string ETFeederNode::name() const { return name_; } -bool ETFeederNode::is_cpu_op() { +bool ETFeederNode::is_cpu_op() const { return is_cpu_op_; } -ChakraProtoMsg::NodeType ETFeederNode::type() { +ChakraProtoMsg::NodeType ETFeederNode::type() const { return node_->type(); } -uint64_t ETFeederNode::runtime() { +uint64_t ETFeederNode::runtime() const { return runtime_; } -uint64_t ETFeederNode::num_ops() { +uint64_t ETFeederNode::num_ops() const { return num_ops_; } -uint32_t ETFeederNode::tensor_loc() { +uint32_t ETFeederNode::tensor_loc() const { return tensor_loc_; } -uint64_t ETFeederNode::tensor_size() { +uint64_t ETFeederNode::tensor_size() const { return tensor_size_; } -ChakraProtoMsg::CollectiveCommType ETFeederNode::comm_type() { +ChakraProtoMsg::CollectiveCommType ETFeederNode::comm_type() const { return comm_type_; } -uint32_t ETFeederNode::comm_priority() { +uint32_t ETFeederNode::comm_priority() const { return comm_priority_; } -uint64_t ETFeederNode::comm_size() { +uint64_t ETFeederNode::comm_size() const { return comm_size_; } -uint32_t ETFeederNode::comm_src() { +uint32_t ETFeederNode::comm_src() const { return comm_src_; } -uint32_t ETFeederNode::comm_dst() { +uint32_t ETFeederNode::comm_dst() const { return comm_dst_; } -uint32_t ETFeederNode::comm_tag() { +uint32_t ETFeederNode::comm_tag() const { return comm_tag_; } diff --git a/src/feeder/et_feeder_node.h b/src/feeder/et_feeder_node.h index 68fa5c8c..b44661d0 100644 --- a/src/feeder/et_feeder_node.h +++ b/src/feeder/et_feeder_node.h @@ -24,20 +24,20 @@ class ETFeederNode { const std::string& attr_name) const; bool has_other_attr(const std::string& attr_name) const; - uint64_t id(); - std::string name(); - bool is_cpu_op(); - ChakraProtoMsg::NodeType type(); - uint64_t runtime(); - uint64_t num_ops(); - uint32_t tensor_loc(); - uint64_t tensor_size(); - ChakraProtoMsg::CollectiveCommType comm_type(); - uint32_t comm_priority(); - uint64_t comm_size(); - uint32_t comm_src(); - uint32_t comm_dst(); - uint32_t comm_tag(); + uint64_t id() const; + std::string name() const; + bool is_cpu_op() const; + ChakraProtoMsg::NodeType type() const; + uint64_t runtime() const; + uint64_t num_ops() const; + uint32_t tensor_loc() const; + uint64_t tensor_size() const; + ChakraProtoMsg::CollectiveCommType comm_type() const; + uint32_t comm_priority() const; + uint64_t comm_size() const; + uint32_t comm_src() const; + uint32_t comm_dst() const; + uint32_t comm_tag() const; private: void assign_attr_val( From 57856f5a46048e10d49890ed393eebf05a95c39b Mon Sep 17 00:00:00 2001 From: Changhai Man Date: Mon, 19 Aug 2024 16:44:44 -0400 Subject: [PATCH 2/5] remove declaration of undefined function: ETFeederNode::assign_attr_val --- src/feeder/et_feeder_node.h | 5 ----- 1 file changed, 5 deletions(-) diff --git a/src/feeder/et_feeder_node.h b/src/feeder/et_feeder_node.h index b44661d0..51996144 100644 --- a/src/feeder/et_feeder_node.h +++ b/src/feeder/et_feeder_node.h @@ -40,11 +40,6 @@ class ETFeederNode { uint32_t comm_tag() const; private: - void assign_attr_val( - std::shared_ptr node, - int i, - void* member); - std::shared_ptr node_{nullptr}; std::unordered_set> children_set_{}; std::vector> children_vec_{}; From e4c4d8bb23a9b3e6dd6065f4ab7407929a1319e5 Mon Sep 17 00:00:00 2001 From: Changhai Man Date: Tue, 20 Aug 2024 12:07:11 -0400 Subject: [PATCH 3/5] add unresolved_data_deps --- src/feeder/et_feeder.cpp | 15 ++++----------- src/feeder/et_feeder_node.cpp | 11 +++++++++++ src/feeder/et_feeder_node.h | 3 +++ 3 files changed, 18 insertions(+), 11 deletions(-) diff --git a/src/feeder/et_feeder.cpp b/src/feeder/et_feeder.cpp index 0cc0810a..76373e5e 100644 --- a/src/feeder/et_feeder.cpp +++ b/src/feeder/et_feeder.cpp @@ -68,17 +68,10 @@ shared_ptr ETFeeder::lookupNode(uint64_t node_id) { void ETFeeder::freeChildrenNodes(uint64_t node_id) { shared_ptr node = dep_graph_[node_id]; for (auto child : node->getChildren()) { - auto child_chakra = child->getChakraNode(); - for (auto it = child_chakra->mutable_data_deps()->begin(); - it != child_chakra->mutable_data_deps()->end(); - ++it) { - if (*it == node_id) { - child_chakra->mutable_data_deps()->erase(it); - break; - } - } - if (child_chakra->data_deps().size() == 0) { - dep_free_node_id_set_.emplace(child_chakra->id()); + auto& unresolved_data_deps = child->mutable_unresolved_data_deps(); + unresolved_data_deps.erase(node_id); + if (unresolved_data_deps.size() == 0) { + dep_free_node_id_set_.emplace(child->id()); dep_free_node_queue_.emplace(child); } } diff --git a/src/feeder/et_feeder_node.cpp b/src/feeder/et_feeder_node.cpp index a1302582..07c6f17d 100644 --- a/src/feeder/et_feeder_node.cpp +++ b/src/feeder/et_feeder_node.cpp @@ -10,6 +10,9 @@ ETFeederNode::ETFeederNode(std::shared_ptr node) { this->runtime_ = node->duration_micros(); this->is_cpu_op_ = 1; + for (uint64_t unresolved_data_dep : node->data_deps()) + this->unresolved_data_deps.insert(unresolved_data_dep); + for (const auto& attr : node->attr()) { const string& attr_name = attr.name(); @@ -83,6 +86,14 @@ bool ETFeederNode::has_other_attr(const string& attr_name) const { return item != this->other_attrs_.end(); } +const std::unordered_set& ETFeederNode::unresolved_data_deps() const { + return this->unresolved_data_deps_; +} + +std::unordered_set& ETFeederNode::mutable_unresolved_data_deps() { + return this->unresolved_data_deps_; +} + uint64_t ETFeederNode::id() const { return id_; } diff --git a/src/feeder/et_feeder_node.h b/src/feeder/et_feeder_node.h index 51996144..4c7c4bd7 100644 --- a/src/feeder/et_feeder_node.h +++ b/src/feeder/et_feeder_node.h @@ -38,6 +38,8 @@ class ETFeederNode { uint32_t comm_src() const; uint32_t comm_dst() const; uint32_t comm_tag() const; + const std::unordered_set& unresolved_data_deps() const; + std::unordered_set& mutable_unresolved_data_deps(); private: std::shared_ptr node_{nullptr}; @@ -46,6 +48,7 @@ class ETFeederNode { std::vector dep_unresolved_parent_ids_{}; std::unordered_map other_attrs_{}; + std::unordered_set unresolved_data_deps_{}; uint64_t id_; std::string name_; From 7d9c5222ee0f2a4353b525c955fe80266834c416 Mon Sep 17 00:00:00 2001 From: Changhai Man Date: Tue, 20 Aug 2024 12:14:04 -0400 Subject: [PATCH 4/5] typo fix modified: src/feeder/et_feeder_node.cpp --- src/feeder/et_feeder_node.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/feeder/et_feeder_node.cpp b/src/feeder/et_feeder_node.cpp index 07c6f17d..302d0a0a 100644 --- a/src/feeder/et_feeder_node.cpp +++ b/src/feeder/et_feeder_node.cpp @@ -11,7 +11,7 @@ ETFeederNode::ETFeederNode(std::shared_ptr node) { this->is_cpu_op_ = 1; for (uint64_t unresolved_data_dep : node->data_deps()) - this->unresolved_data_deps.insert(unresolved_data_dep); + this->unresolved_data_deps_.insert(unresolved_data_dep); for (const auto& attr : node->attr()) { const string& attr_name = attr.name(); From 0ffb41165be8c40c8bd34b34fbfecd626d361f04 Mon Sep 17 00:00:00 2001 From: Changhai Man Date: Mon, 9 Sep 2024 17:11:50 -0400 Subject: [PATCH 5/5] fix merge error: missing pg_name --- src/feeder/et_feeder_node.cpp | 2 +- src/feeder/et_feeder_node.h | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/src/feeder/et_feeder_node.cpp b/src/feeder/et_feeder_node.cpp index 40cdb631..cf724dea 100644 --- a/src/feeder/et_feeder_node.cpp +++ b/src/feeder/et_feeder_node.cpp @@ -152,6 +152,6 @@ uint32_t ETFeederNode::comm_tag() const { return comm_tag_; } -string ETFeederNode::pg_name() { +string ETFeederNode::pg_name() const { return pg_name_; } diff --git a/src/feeder/et_feeder_node.h b/src/feeder/et_feeder_node.h index 5869ca12..636b013b 100644 --- a/src/feeder/et_feeder_node.h +++ b/src/feeder/et_feeder_node.h @@ -38,6 +38,7 @@ class ETFeederNode { uint32_t comm_src() const; uint32_t comm_dst() const; uint32_t comm_tag() const; + std::string pg_name() const; const std::unordered_set& unresolved_data_deps() const; std::unordered_set& mutable_unresolved_data_deps();