Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add source line and stack_frame functionality in hlo_module_map and utils #21209

Merged
merged 1 commit into from
Jan 11, 2025
Merged
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
16 changes: 16 additions & 0 deletions xla/tsl/profiler/convert/xla_op_utils.h
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,22 @@ inline bool MayHaveInnerOps(absl::string_view category) {
category == kHloWhile || category == kHloMegacoreFusion;
}

// File and line that the framework op corresponding to an HLO op is associated
// to in a user's program; e.g. it could be the file and line of user code that
// generated the op.
struct OpSourceInfo {
absl::string_view source_file;
int32_t source_line = -1;
std::string stack_frame;

std::string GetSourceTopLine() const {
if (source_file.empty()) return "";
return absl::StrCat(source_file, ":", source_line);
}

std::string GetSourceStack() const { return stack_frame; }
};

} // namespace profiler
} // namespace tsl

Expand Down
Loading