Skip to content

Commit 71f2ec2

Browse files
bertmaherfacebook-github-bot
authored andcommitted
Don't activate topos when executing a HabanaFunction (#2918)
Summary: Pull Request resolved: #2918 The device manager manages the active topo. As a bonus, we can kill the global synapseLock. Reviewed By: narayanan2004, rdzhabarov Differential Revision: D15346530 fbshipit-source-id: b6ae58e4ed95217c24f1a69c95969ca321a2785d
1 parent 5f6f679 commit 71f2ec2

File tree

1 file changed

+7
-19
lines changed

1 file changed

+7
-19
lines changed

lib/Backends/Habana/Habana.cpp

Lines changed: 7 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -39,9 +39,6 @@ using namespace glow;
3939
// fail gracefully.
4040
#define chk(X) GLOW_ASSERT((X) == synSuccess)
4141

42-
/// It isn't clear what's threadsafe in Synapse. Lock everything for now.
43-
static std::mutex synapseLock;
44-
4542
/// Get a path to a temporary file for the compiled recipe.
4643
static std::string getRecipeFile() {
4744
llvm::SmallString<64> path;
@@ -517,23 +514,14 @@ void HabanaFunction::execute(ExecutionContext *context) {
517514

518515
// Enqueue the run and wait for it to come back.
519516
synWaitHandle handle;
520-
{
521-
// Activate and enqueue need to be atomic.
522-
TRACE_EVENT_BEGIN(tc, "getSynapseLock");
523-
std::lock_guard<std::mutex> g(synapseLock);
524-
TRACE_EVENT_END(tc, "getSynapseLock");
525-
TRACE_EVENT_BEGIN(tc, "synActivateTopology");
526-
chk(synActivateTopology(deviceId, topologyId));
527-
if (VLOG_IS_ON(1)) {
528-
dumpTopologyInfo(deviceId, topologyId);
529-
}
530-
TRACE_EVENT_END(tc, "synActivateTopology");
531-
TRACE_EVENT_BEGIN(tc, "synEnqueue");
532-
chk(synEnqueueByName(
533-
deviceId, inputInfo.empty() ? &noInputEti : inputInfo.data(),
534-
inputInfo.size(), outputInfo.data(), outputInfo.size(), &handle));
535-
TRACE_EVENT_END(tc, "synEnqueue");
517+
if (VLOG_IS_ON(1)) {
518+
dumpTopologyInfo(deviceId, topologyId);
536519
}
520+
TRACE_EVENT_BEGIN(tc, "synEnqueue");
521+
chk(synEnqueueByName(
522+
deviceId, inputInfo.empty() ? &noInputEti : inputInfo.data(),
523+
inputInfo.size(), outputInfo.data(), outputInfo.size(), &handle));
524+
TRACE_EVENT_END(tc, "synEnqueue");
537525

538526
static_cast<HabanaBindings *>(context->getDeviceBindings())
539527
->setHandle(HabanaWaitHandle(deviceId, handle, std::move(inputInfo),

0 commit comments

Comments
 (0)