Skip to content

Commit

Permalink
[XLA:Python] Use a string tag for devices in a heap profile rather th…
Browse files Browse the repository at this point in the history
…an a numeric tag.

This makes filtering of heap profiles by device in pprof work reliably, e.g.:

```
pprof --tagfocus device=gpu:1 myprofile.prof
```

With a numeric filter, it was difficult to filter on device 0 (perhaps because proto3 conflates absent and default values for protobuf fields.)

PiperOrigin-RevId: 320998422
Change-Id: I537eba48a102f0f875aebf8452592d132e9947f1
  • Loading branch information
hawkinsp authored and tensorflower-gardener committed Jul 13, 2020
1 parent 3fc7725 commit 1b9e0ec
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion tensorflow/compiler/xla/python/py_client.cc
Original file line number Diff line number Diff line change
Expand Up @@ -275,7 +275,8 @@ py::bytes PyClient::HeapProfile() {
kind_label->set_str(buffer_string_id);
auto* device_label = sample->add_label();
device_label->set_key(device_string_id);
device_label->set_num(entry.first.device->id());
device_label->set_str(
builder.StringId(entry.first.device->DebugString()));
} else {
kind_label->set_str(executable_string_id);
}
Expand Down

0 comments on commit 1b9e0ec

Please sign in to comment.