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 4 commits
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
39 changes: 25 additions & 14 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,58 +86,66 @@ bool ETFeederNode::has_other_attr(const string& attr_name) const {
return item != this->other_attrs_.end();
}

uint64_t ETFeederNode::id() {
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_;
}

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_;
}
36 changes: 17 additions & 19 deletions src/feeder/et_feeder_node.h
Original file line number Diff line number Diff line change
Expand Up @@ -24,33 +24,31 @@ 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;
const std::unordered_set<uint64_t>& unresolved_data_deps() const;
std::unordered_set<uint64_t>& mutable_unresolved_data_deps();

private:
void assign_attr_val(
std::shared_ptr<ChakraProtoMsg::Node> node,
int i,
void* member);

JoongunPark marked this conversation as resolved.
Show resolved Hide resolved
std::shared_ptr<ChakraProtoMsg::Node> node_{nullptr};
std::unordered_set<std::shared_ptr<ETFeederNode>> children_set_{};
std::vector<std::shared_ptr<ETFeederNode>> children_vec_{};
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
Loading