Unverified Commit 3d66cba4 authored by Robert Kimball's avatar Robert Kimball Committed by GitHub

GPU Common Function Elimination for compile speedup (#1065)

* remove comments within body of function

* change to emit each op exactly once

* update code per review comments
parent 6ccfbeb5
...@@ -68,16 +68,16 @@ public: ...@@ -68,16 +68,16 @@ public:
std::string generate_temporary_name(std::string prefix = "tempvar"); std::string generate_temporary_name(std::string prefix = "tempvar");
void block_begin(std::string block_prefix = "") void block_begin()
{ {
*this << "{" << block_prefix << "\n"; *this << "{\n";
indent++; indent++;
} }
void block_end(std::string block_suffix = "") void block_end()
{ {
indent--; indent--;
*this << "}" << block_suffix << "\n"; *this << "}\n";
} }
private: private:
......
...@@ -265,7 +265,6 @@ void codegen::StaticCompiler::add_header_search_path(const string& p) ...@@ -265,7 +265,6 @@ void codegen::StaticCompiler::add_header_search_path(const string& p)
vector<string> paths = split(p, ';'); vector<string> paths = split(p, ';');
for (const string& path : paths) for (const string& path : paths)
{ {
NGRAPH_INFO << path;
if (!contains(m_extra_search_path_list, path)) if (!contains(m_extra_search_path_list, path))
{ {
m_extra_search_path_list.push_back(path); m_extra_search_path_list.push_back(path);
......
This diff is collapsed.
...@@ -77,7 +77,7 @@ namespace ngraph ...@@ -77,7 +77,7 @@ namespace ngraph
auto& cuda_emitter = auto& cuda_emitter =
external_function->get_primitive_emitter()->get_cuda_emitter(); external_function->get_primitive_emitter()->get_cuda_emitter();
writer.block_begin(" // " + node->get_name()); writer.block_begin();
{ {
std::vector<std::string> dtypes; std::vector<std::string> dtypes;
for (auto& arg : args) for (auto& arg : args)
......
...@@ -83,6 +83,13 @@ namespace ngraph ...@@ -83,6 +83,13 @@ namespace ngraph
const Node&, const Node&,
const std::unordered_map<descriptor::TensorView*, std::vector<size_t>>&); const std::unordered_map<descriptor::TensorView*, std::vector<size_t>>&);
void release_function() { m_function = nullptr; } void release_function() { m_function = nullptr; }
std::string emit_op_as_function(const Node& node, const std::string& function_name);
std::string strip_comments(const std::string& s) const;
bool is_functionally_identical(
const Node& n1,
const Node& n2,
const std::unordered_map<const Node*, std::string>& node_cache) const;
std::unique_ptr<codegen::Compiler> m_compiler; std::unique_ptr<codegen::Compiler> m_compiler;
std::unique_ptr<codegen::ExecutionEngine> m_execution_engine; std::unique_ptr<codegen::ExecutionEngine> m_execution_engine;
bool m_emit_timing; bool m_emit_timing;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment