这是indexloc提供的服务,不要输入任何密码
Skip to content

[SDY] dump source sharding info when output shardyDir is non-empty. This occurs when xla_dump_to flag is set and xla_dump_hlo_pass_re regex matches the shardy pass (see getShardyDirIfShouldDump). #97321

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

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
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
4 changes: 2 additions & 2 deletions tensorflow/tools/pip_package/setup.py.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -107,8 +107,8 @@ REQUIRED_PACKAGES = [
# dependencies on the release branch is updated to the stable releases (RC
# or final). For example, 'keras-nightly ~= 2.14.0.dev' will be replaced by
# 'keras >= 2.14.0rc0, < 2.15' on the release branch after the branch cut.
'tb-nightly ~= 2.19.0.a',
'keras-nightly >= 3.6.0.dev',
'tb-nightly ~= 2.20.0.a',
'keras-nightly >= 3.10.0.dev',
'numpy >= 1.26.0',
'h5py >= 3.11.0',
'ml_dtypes >= 0.5.1, < 1.0.0',
Expand Down
3 changes: 3 additions & 0 deletions third_party/xla/xla/service/spmd/shardy/constants.h
Original file line number Diff line number Diff line change
Expand Up @@ -157,6 +157,9 @@ inline constexpr llvm::StringRef kLocalToGlobalShapeCallTargetName =
// The name of the global mesh.
inline constexpr llvm::StringRef kGlobalMeshName = "mesh";

// Regex for enabling the dumping of propagation debug information.
inline constexpr llvm::StringRef kShardyVerbose = "shardy-verbose";

} // namespace sdy
} // namespace xla

Expand Down
11 changes: 9 additions & 2 deletions third_party/xla/xla/service/spmd/shardy/shardy_xla_pass.cc
Original file line number Diff line number Diff line change
Expand Up @@ -298,11 +298,14 @@ void removeFrontendAttributes(HloModule* hloModule,
std::string getShardyDirIfShouldDump(const DebugOptions& debugOptions,
absl::string_view passName) {
std::string shardyDir = debugOptions.xla_dump_to();
std::string regex = debugOptions.xla_dump_hlo_pass_re();
if (shardyDir.empty()) {
return "";
}
if (debugOptions.xla_dump_hlo_pass_re().empty() ||
!RE2::PartialMatch(passName, debugOptions.xla_dump_hlo_pass_re())) {
if (regex == kShardyVerbose) {
return shardyDir;
}
if (regex.empty() || !RE2::PartialMatch(passName, regex)) {
return "";
}
return shardyDir;
Expand Down Expand Up @@ -330,6 +333,10 @@ absl::Status runShardingPropagation(HloModule* hloModule,
}

if (!shardyDir.empty()) {
if (debugOptions.xla_dump_hlo_pass_re() == kShardyVerbose) {
options.debugPropagationEdgeSharding = true;
options.debugShardingOrigins = true;
}
shardyDir =
tsl::io::JoinPath(shardyDir, "shardy", uniqueModuleName(*hloModule));
LOG(INFO) << "Using Shardy output directory: " << shardyDir;
Expand Down