Commit 62055ab7 authored by Amy Zhuang's avatar Amy Zhuang Committed by Scott Cyphers

Do not set num_threads_per_pool to 1 in cpu executor. (#2648)

* Do not set num_threads_per_pool to 1 in cpu executor.
Ignore cacheability in memory assignment when not reusing memory.

* Fix debug output.
parent ba96aa0f
......@@ -68,13 +68,11 @@ namespace ngraph
for (int i = 0; i < num_thread_pools; i++)
{
int num_threads_per_pool;
#if defined(EIGEN_OPENMP)
// Eigen threadpool will still be used for reductions
// and other tensor operations that dont use a parallelFor
num_threads_per_pool = 1;
#else
num_threads_per_pool = GetNumCores();
#endif
// User override
char* eigen_tp_count = std::getenv("NGRAPH_CPU_EIGEN_THREAD_COUNT");
if (eigen_tp_count != nullptr)
......
......@@ -712,21 +712,16 @@ bool runtime::cpu::pass::CPUMemoryAssignment::run_on_function(shared_ptr<ngraph:
auto input_op = std::static_pointer_cast<op::Op>(input_node);
if (auto input_op_annotations = input_op->get_op_annotations())
{
// when input is cacheable, do not allow destructive oi
if (input_op_annotations->is_cacheable())
{
NGRAPH_DEBUG << "cpu_memory_assignment: cacheable input, no "
"destructive oi";
continue;
}
// when reusing memory, ops with different cacheabilities are using different memory manager
// and should not share the same buffer.
else if (!m_disable_memory_sharing &&
op_annotations->is_cacheable())
if (!m_disable_memory_sharing &&
input_op_annotations->is_cacheable() !=
op_annotations->is_cacheable())
{
NGRAPH_DEBUG << "cpu_memory_assignment: reusing memory with "
"non-cacheable input and cacheable output, no "
"destructive oi";
NGRAPH_DEBUG
<< "cpu_memory_assignment: reusing memory with "
"input and output have different cacheabilities, no "
"destructive oi";
continue;
}
}
......
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