Skip to content

Commit

Permalink
Disable the move-pad preseg pass when the resize scheduler is enabled (
Browse files Browse the repository at this point in the history
…#3675)

For a fusion with pad ops, as long as it can be accepted by the resize
scheduler, the move-pad pass is no longer necessary. This PR disables
the pass only when the resize scheduler is enabled.
  • Loading branch information
naoyam authored Jan 13, 2025
1 parent 33366f9 commit e286c6f
Showing 1 changed file with 13 additions and 2 deletions.
15 changes: 13 additions & 2 deletions csrc/preseg_passes/pre_segmenter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -58,8 +58,19 @@ namespace nvfuser::preseg_passes {
// avoid moving pad operatoins around, which could disturb the analysis
// from MarkAliasPrepare
// 2. after MoveSplitCat
// to avoid this pass moving PadOp around to break the MoveSplitCat.
OptimizationPass<MovePadPass>::runPass(fusion);
// to avoid this pass moving PadOp around to break the
// MoveSplitCat.
//
// Moving a pad backward means all preceding operations would be
// executed for the whole padded region too. Since the resize
// scheduler does not have the issue, let it take care of padding
// whenever enabled. Note that even when it is enabled, it is
// currently only limited to pointwise patterns and does not
// support, for example, reductions, etc, so this preseg pass still
// may be preferable in some cases.
if (!isOptionEnabled(EnableOption::ResizeScheduler)) {
OptimizationPass<MovePadPass>::runPass(fusion);
}
// NOTE vvv this doesn't really work, since our type promotion to higher
// precision for Add cannot be canceled out with previous cast to lower
// precision. Since it's not an no-op and it has a quantization effect. I'll
Expand Down

0 comments on commit e286c6f

Please sign in to comment.