[XLA:CPU/GPU] Run ZeroSizedHloElimination pass to remove zero-sized HLOs from

the input module.

This is to avoid the need of making other passes, such as algebraic
simplification to handle zero-size HLOs.

PiperOrigin-RevId: 241814646
This commit is contained in:
Bixia Zheng 2019-04-03 15:09:26 -07:00 committed by TensorFlower Gardener
parent f40a65e2d4
commit 875b3e6965
2 changed files with 9 additions and 0 deletions

View File

@ -252,6 +252,11 @@ Status CpuCompiler::RunHloPassesThroughLayoutAssn(
HloPassPipeline pipeline("HLO passes through layout assignment");
pipeline.AddInvariantChecker<HloVerifier>(/*layout_sensitive=*/false,
/*allow_mixed_precision=*/false);
// Remove zero-sized HLO from the input so that other passes don't have to
// handle it.
pipeline.AddPass<ZeroSizedHloElimination>();
pipeline.AddPass<DynamicIndexSplitter>();
pipeline.AddPass<CpuHloSupportChecker>();

View File

@ -183,6 +183,10 @@ Status OptimizeHloModule(HloModule* hlo_module, se::StreamExecutor* stream_exec,
HloPassPipeline pipeline("optimization");
pipeline.AddInvariantChecker<HloVerifier>(/*layout_sensitive=*/false,
/*allow_mixed_precision=*/false);
// Remove zero-sized HLO from the input so that other passes don't have to
// handle it.
pipeline.AddPass<ZeroSizedHloElimination>();
pipeline.AddPass<DynamicIndexSplitter>();
pipeline.AddPass<GpuHloSupportChecker>();
ReducePrecisionInsertion::AddPasses(