TransformerEngine icon indicating copy to clipboard operation
TransformerEngine copied to clipboard

[PyTorch] Bugfix for wgrad bulk overlap conflict when dgrad overlap is reduce-scatter

Open denera opened this issue 1 year ago • 2 comments

Description

When Userbuffers config dictionary sets overlap method to ring-exchange or pipeline for any *_dgrad layer, that layer's *_wgrad overlap needs to be disabled in order for ub_overlap_rs_dgrad=True option for related TE modules to function correctly.

This PR fixes a bug where the "*_wgrad" overlap was persisting in the Userbuffer configuration and the corresponding UB object was being initialized even when it was not needed.

  • @fanshiqing for viz.

Type of change

  • [ ] Documentation change (change only to the documentation, either a fix or a new content)
  • [x] Bug fix (non-breaking change which fixes an issue)
  • [ ] New feature (non-breaking change which adds functionality)
  • [ ] Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • [ ] Infra/Build change
  • [ ] Code refractor

Changes

Please list the changes introduced in this PR:

  • *_wgrad overlap is now removed from methods["bulk"] list when the same layer's *_dgrad overlap has its method set to either ring-exchange or pipeline.
  • add_ub(name, **ub_cfg) is now only called if name is in the original user-provided ub_cfg. This avoids creating UB objects with default configs that may conflict with the user's intended TP overlap use.

Checklist:

  • [x] I have read and followed the contributing guidelines
  • [x] The functionality is complete
  • [ ] I have commented my code, particularly in hard-to-understand areas
  • [ ] I have made corresponding changes to the documentation
  • [x] My changes generate no new warnings
  • [x] I have added tests that prove my fix is effective or that my feature works
  • [x] New and existing unit tests pass locally with my changes

denera avatar Nov 18 '24 16:11 denera

/te-ci pytorch L0 L1

timmoon10 avatar Nov 18 '24 20:11 timmoon10

/te-ci pytorch L0 L1

denera avatar Nov 22 '24 16:11 denera