-
Notifications
You must be signed in to change notification settings - Fork 5.6k
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
add dfg graphviz pass #11211
add dfg graphviz pass #11211
Conversation
Superjomn
commented
Jun 6, 2018
•
edited
Loading
edited
- graphviz to draw a Data Flow Graph,
- helper to debug the graph structure.
SRCS dfg_graphviz_draw_pass_tester.cc | ||
DEPS analysis | ||
ARGS --inference_model_dir=${PYTHON_TESTS_DIR}/book/word2vec.inference.model) | ||
set_tests_properties(test_dfg_graphviz_draw_pass PROPERTIES DEPENDS test_word2vec) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
请问analysis目录下的单侧为什么要依赖test_word2vec的模型目录呢?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
test_word2vec 生成model
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- 需要word2vec model的programdesc来进行分析,加下注释。
- 需要加一个function,减少CMake这里的代码。
std::string Draw(DataFlowGraph* graph) { return graph->DotString(); } | ||
|
||
std::string dir_; | ||
std::string id_; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
请多加点注释。dir是目录名,id是文件名?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
下个pr再加吧
bool Finalize() override { return Pass::Finalize(); } | ||
|
||
Pass* CreatePrinterPass(std::ostream& os, | ||
const std::string& banner) const override { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
请问这个函数的功能是什么呢,参数banner是指?我看单侧里也没有用到这个函数。
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
pass.Run(&dfg); | ||
|
||
// test content | ||
std::ifstream file("./graph_test.dot"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
输入文件graph_test.dot是已经存在了?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
上面的 Run 会生成
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
请加注释说明下这个输入文件的来源。
while (std::getline(file, line)) { | ||
no++; | ||
} | ||
ASSERT_EQ(no, 82); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
验证有82行就可以了?82这个数字是从哪儿来的?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
对,验证内容没太大必要
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
请加注释说明下82行的来源,不过如果programdesc发生变化了,这里会不会就过不了了。
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM。一些问题在下一个PR中修改。
SRCS dfg_graphviz_draw_pass_tester.cc | ||
DEPS analysis | ||
ARGS --inference_model_dir=${PYTHON_TESTS_DIR}/book/word2vec.inference.model) | ||
set_tests_properties(test_dfg_graphviz_draw_pass PROPERTIES DEPENDS test_word2vec) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- 需要word2vec model的programdesc来进行分析,加下注释。
- 需要加一个function,减少CMake这里的代码。
pass.Run(&dfg); | ||
|
||
// test content | ||
std::ifstream file("./graph_test.dot"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
请加注释说明下这个输入文件的来源。
while (std::getline(file, line)) { | ||
no++; | ||
} | ||
ASSERT_EQ(no, 82); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
请加注释说明下82行的来源,不过如果programdesc发生变化了,这里会不会就过不了了。