Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

keep original data_deps while resolving graph #149

Open
wants to merge 6 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 4 additions & 11 deletions src/feeder/et_feeder.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -68,17 +68,10 @@ shared_ptr<ETFeederNode> ETFeeder::lookupNode(uint64_t node_id) {
void ETFeeder::freeChildrenNodes(uint64_t node_id) {
shared_ptr<ETFeederNode> 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());
JoongunPark marked this conversation as resolved.
Show resolved Hide resolved
dep_free_node_queue_.emplace(child);
}
}
Expand Down
11 changes: 11 additions & 0 deletions src/feeder/et_feeder_node.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,9 @@ ETFeederNode::ETFeederNode(std::shared_ptr<ChakraProtoMsg::Node> 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();

Expand Down Expand Up @@ -83,6 +86,14 @@ bool ETFeederNode::has_other_attr(const string& attr_name) const {
return item != this->other_attrs_.end();
}

const std::unordered_set<uint64_t>& ETFeederNode::unresolved_data_deps() const {
return this->unresolved_data_deps_;
}

std::unordered_set<uint64_t>& ETFeederNode::mutable_unresolved_data_deps() {
return this->unresolved_data_deps_;
}

uint64_t ETFeederNode::id() const {
return id_;
}
Expand Down
3 changes: 3 additions & 0 deletions src/feeder/et_feeder_node.h
Original file line number Diff line number Diff line change
Expand Up @@ -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<uint64_t>& unresolved_data_deps() const;
std::unordered_set<uint64_t>& mutable_unresolved_data_deps();

private:
std::shared_ptr<ChakraProtoMsg::Node> node_{nullptr};
Expand All @@ -46,6 +48,7 @@ class ETFeederNode {
std::vector<uint64_t> dep_unresolved_parent_ids_{};
std::unordered_map<std::string, const ChakraProtoMsg::AttributeProto&>
other_attrs_{};
std::unordered_set<uint64_t> unresolved_data_deps_{};

uint64_t id_;
std::string name_;
Expand Down