Skip to content

Commit

Permalink
Add copyOutputs trace event to HabanaDeviceManager (pytorch#2906)
Browse files Browse the repository at this point in the history
Summary:
*Description*:
Add an additional trace event to capture time spent copying outputs from device buffers.

*Testing*:
CI
![Screen Shot 2019-05-10 at 12 56 09 PM](https://user-images.githubusercontent.com/1740091/57732140-3ed3b080-7651-11e9-875e-e502d5f64e8e.png)

*Documentation*:
n/a
Pull Request resolved: pytorch#2906

Differential Revision: D15342778

Pulled By: jackm321

fbshipit-source-id: 193f760e956e06b1cc4f5a4f61ff80d753f01185
  • Loading branch information
jackm321 authored and facebook-github-bot committed May 14, 2019
1 parent 96db0f1 commit ff44209
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions lib/Backends/Habana/HabanaDeviceManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -336,6 +336,7 @@ void HabanaDeviceManager::runFunctionImpl(RunIdentifierTy runId,
} else {
// Copy the execution outputs from the designated IO buffer back to the
// PlaceholderBindings inside ctx.
TRACE_EVENT_BEGIN(ctx->getTraceContext(), "copyOutputs");
auto bindings = ctx->getPlaceholderBindings();
for (const auto &ph : function->getOutputs()) {
auto *tensor = bindings->get(ph);
Expand All @@ -345,6 +346,7 @@ void HabanaDeviceManager::runFunctionImpl(RunIdentifierTy runId,
memcpy(tensor->getUnsafePtr(), ioBuffer->get(ph),
ph->getType()->getSizeInBytes());
}
TRACE_EVENT_END(ctx->getTraceContext(), "copyOutputs");

// Return the IO buffer to the IO buffer pool.
ioBufferPool->put(std::move(ioBuffer));
Expand Down

0 comments on commit ff44209

Please sign in to comment.