Skip to content

Commit

Permalink
[XLA:GPU] Increase the size limit for dot merger to infinity (behind …
Browse files Browse the repository at this point in the history
…a flag).

PiperOrigin-RevId: 678585161
  • Loading branch information
Google-ML-Automation committed Sep 25, 2024
1 parent c53817c commit e0b9573
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 4 deletions.
6 changes: 6 additions & 0 deletions xla/debug_options_flags.cc
Original file line number Diff line number Diff line change
Expand Up @@ -293,6 +293,7 @@ DebugOptions DefaultDebugOptionsIgnoringFlags() {
opts.set_xla_gpu_executable_terminate_timeout_seconds(30);
opts.set_xla_gpu_experimental_disable_binary_libraries(false);
opts.set_xla_experimental_ignore_channel_id(false);
opts.set_xla_gpu_dot_merger_threshold_mb(32);
return opts;
}

Expand Down Expand Up @@ -1951,6 +1952,11 @@ void MakeDebugOptionsFlags(std::vector<tsl::Flag>* flag_list,
bool_setter_for(&DebugOptions::set_xla_experimental_ignore_channel_id),
debug_options->xla_experimental_ignore_channel_id(),
"Experimental: ignore channel ids for collective operations."));
flag_list->push_back(tsl::Flag(
"xla_gpu_dot_merger_threshold_mb",
int32_setter_for(&DebugOptions::set_xla_gpu_dot_merger_threshold_mb),
debug_options->xla_gpu_dot_merger_threshold_mb(),
"Dot merger pass threshold to be set in MB."));
} // NOLINT(readability/fn_size)

// Allocates flag_values and flag_objects; this function must not be called more
Expand Down
9 changes: 6 additions & 3 deletions xla/service/gpu/gpu_compiler.cc
Original file line number Diff line number Diff line change
Expand Up @@ -790,9 +790,12 @@ absl::Status RunOptimizationPasses(
// AlgebraicSimplifier may add contracting dimensions to a dot.
pipeline.AddPass<DotDimensionSorter>();
pipeline.AddPass<DotDecomposer>();
// Only merge "smallish" dots. This threshold was not set carefully, but
// so far we know that 1mb is too small.
pipeline.AddPass<DotMerger>(/*max_size_to_merge=*/int64_t{32} << 20);
// Only merge "smallish" dots. This threshold defaults to 32MB today, with
// a flag to override.
pipeline.AddPass<DotMerger>(
/*max_size_to_merge=*/int64_t{
debug_options.xla_gpu_dot_merger_threshold_mb()}
<< 20);
pipeline.AddPass<SortSimplifier>();
pipeline.AddPass<TupleSimplifier>();
pipeline.AddPass<WhileLoopConstantSinking>();
Expand Down
5 changes: 4 additions & 1 deletion xla/xla.proto
Original file line number Diff line number Diff line change
Expand Up @@ -978,7 +978,10 @@ message DebugOptions {
// for collectives in the given HLO.
bool xla_experimental_ignore_channel_id = 330;

// Next id: 331
// DotMerger pass threshold size to be used in MB.
int32 xla_gpu_dot_merger_threshold_mb = 331;

// Next id: 332

// Extra options to pass to the compilation backend (e.g. LLVM); specific
// interpretation of these values is left to the backend.
Expand Down

0 comments on commit e0b9573

Please sign in to comment.