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

Show operator name with unary and binary nodes in graphviz dot outputs #3630

Merged
merged 2 commits into from
Dec 21, 2024
Merged
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
6 changes: 6 additions & 0 deletions csrc/ir/internal_nodes.h
Original file line number Diff line number Diff line change
Expand Up @@ -320,6 +320,8 @@ class NVF_API UnaryOp : public Expr {
return "UnaryOp";
}

std::string getGraphvizLabel() const override;

std::vector<PolymorphicValue> evaluate(
const ExpressionEvaluator& ee,
const std::vector<PolymorphicValue>& inputs) const override;
Expand Down Expand Up @@ -358,6 +360,8 @@ class NVF_API BinaryOp : public Expr {
return "BinaryOp";
}

std::string getGraphvizLabel() const override;

std::vector<PolymorphicValue> evaluate(
const ExpressionEvaluator& ee,
const std::vector<PolymorphicValue>& inputs) const override;
Expand Down Expand Up @@ -405,6 +409,8 @@ class TernaryOp : public Expr {
return "TernaryOp";
}

std::string getGraphvizLabel() const override;

std::vector<PolymorphicValue> evaluate(
const ExpressionEvaluator& ee,
const std::vector<PolymorphicValue>& inputs) const override;
Expand Down
18 changes: 18 additions & 0 deletions csrc/ir/nodes.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -557,6 +557,12 @@ std::string UnaryOp::toInlineString(int indent_size) const {
return ss.str();
}

std::string UnaryOp::getGraphvizLabel() const {
std::stringstream ss;
ss << getOpString() << "(" << getUnaryOpType() << ")";
return ss.str();
}

NVFUSER_DEFINE_CLONE_AND_CREATE(UnaryOp)

BinaryOp::BinaryOp(
Expand Down Expand Up @@ -724,6 +730,12 @@ std::string BinaryOp::toInlineString(int indent_size) const {
return ss.str();
}

std::string BinaryOp::getGraphvizLabel() const {
std::stringstream ss;
ss << getOpString() << "(" << getBinaryOpType() << ")";
return ss.str();
}

NVFUSER_DEFINE_CLONE_AND_CREATE(BinaryOp)

TernaryOp::TernaryOp(
Expand Down Expand Up @@ -825,6 +837,12 @@ std::string TernaryOp::toInlineString(int indent_size) const {
return ss.str();
}

std::string TernaryOp::getGraphvizLabel() const {
std::stringstream ss;
ss << getOpString() << "(" << getTernaryOpType() << ")";
return ss.str();
}

NVFUSER_DEFINE_CLONE_AND_CREATE(TernaryOp)

ArrayConstruct::ArrayConstruct(
Expand Down
Loading