MCPcopy Create free account
hub / github.com/DeepRec-AI/DeepRec / ToString

Method ToString

tensorflow/compiler/xla/service/gpu/thunk_schedule.cc:149–185  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

147}
148
149string ThunkSchedule::ToString() const {
150 if (thunk_total_order_.empty()) {
151 return "No thunks.";
152 }
153
154 const Thunk* thunk_with_longest_kind = *absl::c_max_element(
155 thunk_total_order_, [](const Thunk* a, const Thunk* b) {
156 return ThunkKindToString(a->kind()).length() <
157 ThunkKindToString(b->kind()).length();
158 });
159 int64 max_thunk_kind_len =
160 ThunkKindToString(thunk_with_longest_kind->kind()).length();
161
162 string result = "Total order:\n";
163 for (Thunk* thunk : thunk_total_order_) {
164 // Write out the thunk kind, padded out to max_thunk_kind_len.
165 absl::string_view kind_str = ThunkKindToString(thunk->kind());
166 absl::StrAppend(&result, kind_str,
167 string(max_thunk_kind_len - kind_str.length(), ' '), "\t");
168 if (thunk->hlo_instruction() != nullptr) {
169 absl::StrAppend(&result, thunk->hlo_instruction()->ToString());
170 } else {
171 absl::StrAppend(&result, "(no HloInstruction)");
172 }
173 absl::StrAppend(&result, "\n");
174 }
175 absl::StrAppend(&result, "\nDependencies:\n");
176 for (const auto& entry : depends_on_) {
177 const Thunk* dependent = entry.first;
178 for (const Thunk* dependency : entry.second) {
179 absl::StrAppend(&result, "\t", dependent->hlo_instruction()->name(),
180 " depends on ", dependency->hlo_instruction()->name(),
181 "\n");
182 }
183 }
184 return result;
185}
186
187} // namespace gpu
188} // namespace xla

Callers 15

TEST_FFunction · 0.45
GetBasePointerMethod · 0.45
RunCudnnSoftmaxFunction · 0.45
RunMethod · 0.45
GetGpuConvParamsFunction · 0.45
RunGpuConvFunction · 0.45

Calls 7

ThunkKindToStringFunction · 0.85
hlo_instructionMethod · 0.80
nameMethod · 0.65
StrAppendFunction · 0.50
emptyMethod · 0.45
lengthMethod · 0.45
kindMethod · 0.45

Tested by 12

TEST_FFunction · 0.36
TEST_FFunction · 0.36
GetOptimizedHloMethod · 0.36
TEST_FFunction · 0.36
TEST_FFunction · 0.36
TEST_FFunction · 0.36
TEST_FFunction · 0.36
TEST_FFunction · 0.36
TEST_FFunction · 0.36
TEST_FFunction · 0.36