aboutsummaryrefslogtreecommitdiffhomepage
path: root/tensorflow/core/profiler
diff options
context:
space:
mode:
Diffstat (limited to 'tensorflow/core/profiler')
-rw-r--r--tensorflow/core/profiler/internal/tfprof_node.cc13
1 files changed, 9 insertions, 4 deletions
diff --git a/tensorflow/core/profiler/internal/tfprof_node.cc b/tensorflow/core/profiler/internal/tfprof_node.cc
index 69198019cd..70b91c37e4 100644
--- a/tensorflow/core/profiler/internal/tfprof_node.cc
+++ b/tensorflow/core/profiler/internal/tfprof_node.cc
@@ -25,7 +25,7 @@ bool CountAsAcceleratorTime(const string& device) {
}
bool CountAsCPUTime(const string& device) {
- return RE2::FullMatch(device, ".*/(gpu|cpu):\\d+");
+ return RE2::FullMatch(device, ".*/(gpu|cpu|device:sycl):\\d+");
}
bool IsCanonicalDevice(const string& device) { return CountAsCPUTime(device); }
@@ -145,7 +145,7 @@ void TFGraphNode::AddStepStat(int64 step, const string& device,
// See run_metadata_test.py
// It can be /job:0/replica:0/xxxx/gpu:0, or simply /gpu:0.
// It can has some ad-hoc suffix, such as /stream:xx or /memcpy:xx.
- if (IsCanonicalDevice(device)) {
+ if (IsCanonicalDevice(dev)) {
if (!canonical_device_.empty()) {
if (canonical_device_ != dev) {
fprintf(stderr, "Unexpected: graph node changed device: %s->%s.\n",
@@ -155,7 +155,11 @@ void TFGraphNode::AddStepStat(int64 step, const string& device,
} else {
canonical_device_ = dev;
// TODO(xpan): Support things other than gpu?
- host_device_ = StringReplace(dev, "gpu:\\d+", "cpu:0");
+ if (dev.find("sycl") != dev.npos) {
+ host_device_ = StringReplace(dev, "device:sycl:\\d+", "cpu:0");
+ } else {
+ host_device_ = StringReplace(dev, "gpu:\\d+", "cpu:0");
+ }
AddOpType(canonical_device_);
}
}
@@ -229,7 +233,8 @@ TensorShapeProto VecToShapeProto(const std::vector<int64> shape_vec) {
}
bool IsPlacedOnAccelerator(const string& device) {
- return device.find("gpu") != device.npos;
+ return device.find("gpu") != device.npos ||
+ device.find("sycl") != device.npos;
}
} // namespace tfprof
} // namespace tensorflow