Skip to content

Commit b6544ef

Browse files
swolchokfacebook-github-bot
authored andcommitted
[PyTorch] Fix MobileDebugInfo vector copy (pytorch#64030)
Summary: Pull Request resolved: pytorch#64030 ghstack-source-id: 137566816 Test Plan: Pixel 3 before: https://our.intern.facebook.com/intern/aibench/details/320277034999340 Pixel 3 after: https://our.intern.facebook.com/intern/aibench/details/724509739115867 can see the vector copy disappear in the flame graph. Overall mean decreased from 354 ms to 348 ms (though I'm not sure if this is outside usual noise). Reviewed By: raziel Differential Revision: D30559032 fbshipit-source-id: 6d8bb5396d3449cc63023ee7acf694b5d146ddc1
1 parent 0d0d2f2 commit b6544ef

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

torch/csrc/jit/mobile/debug_info.cpp

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -122,13 +122,14 @@ MobileDebugTable::MobileDebugTable(
122122
size_t debug_size{0};
123123
std::tie(debug_data, debug_size) = reader->getRecord(record_name);
124124
auto ivalues =
125-
jit::unpickle(
126-
reinterpret_cast<const char*>(debug_data.get()), debug_size)
127-
.toTuple()
128-
->elements();
125+
std::move(
126+
*jit::unpickle(
127+
reinterpret_cast<const char*>(debug_data.get()), debug_size)
128+
.toTuple())
129+
.elements();
129130
SourceRangeDeserializer deserializer;
130131
for (auto& val : ivalues) {
131-
auto tup_elems = val.toTuple()->elements();
132+
auto tup_elems = std::move(*std::move(val).toTuple()).elements();
132133
// For BC we decode only tuples with 3 elements
133134
// assuming it contains
134135
// byte_offset, debug_handle (=source range tag), source range

0 commit comments

Comments
 (0)