Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Shrestha/rewrite mutex #538

Open
wants to merge 5 commits into
base: master
Choose a base branch
from
Open
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
4 changes: 4 additions & 0 deletions ngraph_bridge/ngraph_rewrite_pass.cc
Original file line number Diff line number Diff line change
Expand Up @@ -57,10 +57,12 @@ class NGraphRewritePass : public GraphOptimizationPass {

static int s_serial_counter GUARDED_BY(s_serial_counter_mutex);
static mutex s_serial_counter_mutex;
static mutex s_rewrite_mutex;
};

int NGraphRewritePass::s_serial_counter = 0;
mutex NGraphRewritePass::s_serial_counter_mutex;
mutex NGraphRewritePass::s_rewrite_mutex;

//
// Pass that rewrites the graph for nGraph operation.
Expand All @@ -86,6 +88,8 @@ mutex NGraphRewritePass::s_serial_counter_mutex;
class NGraphEncapsulationPass : public NGraphRewritePass {
public:
Status Run(const GraphOptimizationPassOptions& options) override {
mutex_lock l(s_rewrite_mutex);

// If we don't get a main graph, log that fact and bail.
if (options.graph == nullptr) {
NGRAPH_VLOG(0) << "NGraphEncapsulationPass: options.graph == nullptr";
Expand Down