Commit ec9854a2 authored by gcwenger's avatar gcwenger Committed by Scott Cyphers

Tweak to GPUPrimitiveEmitter::lookup (#1814)

parent edbb81a1
...@@ -64,11 +64,12 @@ size_t GPUPrimitiveEmitter::insert(const gpu::memory_primitive& f) ...@@ -64,11 +64,12 @@ size_t GPUPrimitiveEmitter::insert(const gpu::memory_primitive& f)
m_gpu_mem_primitives.push_back(f); m_gpu_mem_primitives.push_back(f);
return m_gpu_mem_primitives.size() - 1; return m_gpu_mem_primitives.size() - 1;
} }
size_t GPUPrimitiveEmitter::lookup(std::string hash) size_t GPUPrimitiveEmitter::lookup(const std::string& hash)
{ {
if (m_primitive_map.count(hash) > 0) auto it = m_primitive_map.find(hash);
if (it != m_primitive_map.end())
{ {
return m_primitive_map[hash]; return it->second;
} }
return std::numeric_limits<size_t>::max(); return std::numeric_limits<size_t>::max();
} }
......
...@@ -44,7 +44,7 @@ namespace ngraph ...@@ -44,7 +44,7 @@ namespace ngraph
} }
size_t insert(std::unique_ptr<gpu::primitive>&& f); size_t insert(std::unique_ptr<gpu::primitive>&& f);
size_t insert(const gpu::memory_primitive& f); size_t insert(const gpu::memory_primitive& f);
size_t lookup(std::string hash); size_t lookup(const std::string& hash);
void cache(const std::string& hash, const size_t& index); void cache(const std::string& hash, const size_t& index);
GPUAllocator get_memory_allocator() { return m_memory_manager.build_allocator(); } GPUAllocator get_memory_allocator() { return m_memory_manager.build_allocator(); }
void allocate_primitive_memory() { m_memory_manager.allocate(); } void allocate_primitive_memory() { m_memory_manager.allocate(); }
......
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