Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions ngraph_bridge/ngraph_freshness_tracker.cc
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ namespace ngraph_bridge {

void NGraphFreshnessTracker::MarkFresh(
const void* base_pointer,
std::shared_ptr<ngraph::runtime::Executable> user) {
const std::shared_ptr<ngraph::runtime::Executable>& user) {
mutex_lock l(mu_);
auto it = freshness_map_.find(base_pointer);
if (it != freshness_map_.end()) {
Expand All @@ -36,7 +36,7 @@ void NGraphFreshnessTracker::MarkFresh(

bool NGraphFreshnessTracker::IsFresh(
const void* base_pointer,
std::shared_ptr<ngraph::runtime::Executable> user) {
const std::shared_ptr<ngraph::runtime::Executable>& user) {
mutex_lock l(mu_);
auto it = freshness_map_.find(base_pointer);
if (it == freshness_map_.end()) {
Expand Down Expand Up @@ -69,9 +69,9 @@ void NGraphFreshnessTracker::RemoveTensor(const void* base_pointer) {
}

void NGraphFreshnessTracker::RemoveUser(
std::shared_ptr<ngraph::runtime::Executable> user) {
const std::shared_ptr<ngraph::runtime::Executable>& user) {
mutex_lock l(mu_);
for (auto kv : freshness_map_) {
for (auto& kv : freshness_map_) {
kv.second.erase(user);
}
}
Expand Down
6 changes: 3 additions & 3 deletions ngraph_bridge/ngraph_freshness_tracker.h
Original file line number Diff line number Diff line change
Expand Up @@ -95,12 +95,12 @@ class NGraphFreshnessTracker : public ResourceBase {
// If freshness_map_ has the base_pointer, then inserts the user function into
// its set of user functions
void MarkFresh(const void* base_pointer,
std::shared_ptr<ngraph::runtime::Executable> user);
const std::shared_ptr<ngraph::runtime::Executable>& user);

// Checks if the freshness_map_ has the user function for base_pointer, else
// returns false
bool IsFresh(const void* base_pointer,
std::shared_ptr<ngraph::runtime::Executable> user);
const std::shared_ptr<ngraph::runtime::Executable>& user);

// Removes all the functions for the base_pointer in the freshness_map_, i.e.
// sets the set<ng::Function> for base_pointer to empty
Expand All @@ -114,7 +114,7 @@ class NGraphFreshnessTracker : public ResourceBase {
void RemoveTensor(const void* base_pointer);

// Removes the user function from the freshness_map_
void RemoveUser(std::shared_ptr<ngraph::runtime::Executable> user);
void RemoveUser(const std::shared_ptr<ngraph::runtime::Executable>& user);

private:
// mutex protecting the freshness_map_
Expand Down