Commit 306d284a authored by Amy Zhuang's avatar Amy Zhuang Committed by Scott Cyphers

Change compiler action to EmitLLVMOnly. (#3127)

Wait until performance counter data is set to release function for CODEGEN.
parent e51582a9
...@@ -343,7 +343,7 @@ std::unique_ptr<codegen::Module> ...@@ -343,7 +343,7 @@ std::unique_ptr<codegen::Module>
preprocessor_options.RemappedFileBuffers.push_back({m_source_name, buffer.get()}); preprocessor_options.RemappedFileBuffers.push_back({m_source_name, buffer.get()});
// Create and execute action // Create and execute action
m_compiler_action.reset(new EmitCodeGenOnlyAction()); m_compiler_action.reset(new EmitLLVMOnlyAction());
std::unique_ptr<llvm::Module> rc; std::unique_ptr<llvm::Module> rc;
bool reinitialize = false; bool reinitialize = false;
if (m_compiler->ExecuteAction(*m_compiler_action) == true) if (m_compiler->ExecuteAction(*m_compiler_action) == true)
......
...@@ -1639,23 +1639,12 @@ namespace ngraph ...@@ -1639,23 +1639,12 @@ namespace ngraph
auto type_name = embed->get_element_type().c_type_string(); auto type_name = embed->get_element_type().c_type_string();
auto element_count = shape_size(embed->get_argument(0)->get_shape()); auto element_count = shape_size(embed->get_argument(0)->get_shape());
// FIXME
// clang generates 16 bytes aligned store with unaligned address,
// which results in segmentation fault.
// Workaround for now: Use push_back to avoid generating such store.
auto arg1_shape = args[1].get_shape();
writer << "ngraph::Shape shape;\n";
for (auto i = 0; i < arg1_shape.size(); i++)
{
writer << "shape.push_back(" << std::to_string(arg1_shape[i]) << ");\n";
}
writer << "reference::embedding<" << type_name << "," << index_type_name << ">("; writer << "reference::embedding<" << type_name << "," << index_type_name << ">(";
writer << " " << args[0].get_name() << ",\n"; writer << " " << args[0].get_name() << ",\n";
writer << " " << args[1].get_name() << ",\n"; writer << " " << args[1].get_name() << ",\n";
writer << " " << out[0].get_name() << ",\n"; writer << " " << out[0].get_name() << ",\n";
writer << " " << element_count << ",\n"; writer << " " << element_count << ",\n";
writer << " shape);\n"; writer << " {" << join(args[1].get_shape()) << "});\n";
writer.block_end(); writer.block_end();
} }
......
...@@ -1138,7 +1138,7 @@ using namespace ngraph::runtime; ...@@ -1138,7 +1138,7 @@ using namespace ngraph::runtime;
} }
m_is_compiled = true; m_is_compiled = true;
if (m_release_function) if (m_release_function && !m_emit_timing)
{ {
release_function(); release_function();
} }
...@@ -2023,6 +2023,10 @@ const vector<runtime::PerformanceCounter>& runtime::cpu::CPU_ExternalFunction::g ...@@ -2023,6 +2023,10 @@ const vector<runtime::PerformanceCounter>& runtime::cpu::CPU_ExternalFunction::g
} }
} }
} }
if (m_release_function)
{
release_function();
}
} }
#endif #endif
return m_perf_counters; return m_perf_counters;
......
...@@ -55,17 +55,7 @@ ...@@ -55,17 +55,7 @@
#include "ngraph/runtime/cpu/op/sigmoid.hpp" #include "ngraph/runtime/cpu/op/sigmoid.hpp"
#include "ngraph/runtime/cpu/op/update_slice.hpp" #include "ngraph/runtime/cpu/op/update_slice.hpp"
#define WRITE_MKLDNN_DIMS(X) \ #define WRITE_MKLDNN_DIMS(X) writer << "mkldnn::memory::dims{" << join(X) << "}, \n";
writer << "mkldnn::memory::dims{"; \
if (X.size() > 1) \
{ \
for (auto i = 0; i < X.size() - 1; i++) \
{ \
writer << std::to_string(X[i]) << ", "; \
} \
} \
writer << std::to_string(X[X.size() - 1]); \
writer << "}, \n"
using namespace ngraph; using namespace ngraph;
using namespace ngraph::op; using namespace ngraph::op;
...@@ -780,21 +770,10 @@ namespace ngraph ...@@ -780,21 +770,10 @@ namespace ngraph
serialize_memory_descs(desc_file, descs, deps[0]); serialize_memory_descs(desc_file, descs, deps[0]);
writer << "\n// create memory primitive descriptors\n"; writer << "\n// create memory primitive descriptors\n";
// FIXME
// clang generates 16 bytes aligned store with unaligned address,
// which results in segmentation fault.
// Workaround for now: Use push_back to avoid generating such store.
writer << "mkldnn::memory::dims dims1;\n";
for (auto i = 0; i < result_shape.size(); i++)
{
writer << "dims1.push_back(" << std::to_string(result_shape[i]) << ");\n";
}
writer << "\nmkldnn::memory::dims dims2;\n"; writer << "mkldnn::memory::dims dims1{" << join(result_shape) << "};\n";
for (auto i = 0; i < lower_bounds.size(); i++) writer << "mkldnn::memory::dims dims2{" << join(lower_bounds) << "};\n";
{ ;
writer << "dims2.push_back(" << std::to_string(lower_bounds[i]) << ");\n";
}
writer << "mkldnn::memory::primitive_desc input_pd = " writer << "mkldnn::memory::primitive_desc input_pd = "
"mkldnn::memory::primitive_desc(*cg_ctx->mkldnn_descriptors[" "mkldnn::memory::primitive_desc(*cg_ctx->mkldnn_descriptors["
......
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