Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 7 additions & 4 deletions torch_xla/csrc/lowering_context.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -78,15 +78,18 @@ class HloMetadataSetter {
max_stack_depth = custom_opname_meta->max_stack_depth;
}

if (!nmeta.scope.empty()) {
else if (!nmeta.scope.empty()) {
op_name_prefix =
absl::StrCat(absl::StrReplaceAll(nmeta.scope, {{":", "_"}}), "/");
}
metadata.set_op_name(absl::StrCat(op_name_prefix, op_type));

// Sets file, line and stack_frame_id in metadata
lowering_context.stack_frame_index_builder()->AddStackFrameLocations(
nmeta.frame_info, static_cast<int>(max_stack_depth), metadata);
// NOTE: if max_stack_depth is 0, we are just renaming the op, so we don't need to add stack frame locations
if (max_stack_depth > 0) {
// Sets file, line and stack_frame_id in metadata
lowering_context.stack_frame_index_builder()->AddStackFrameLocations(
nmeta.frame_info, static_cast<int>(max_stack_depth), metadata);
}

lowering_context.builder()->SetOpMetadata(std::move(metadata));
}
Expand Down