Skip to content
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

[Dist Pass] Amp Pass #38764

Merged
merged 24 commits into from
Jan 12, 2022
Merged

Conversation

JZ-LIANG
Copy link
Contributor

@JZ-LIANG JZ-LIANG commented Jan 6, 2022

PR types

New features

PR changes

Others

Describe

  • amp pass supports for auto parallel (support dist op and dist context)
  • different from fleet.meta_optimizer.amp which uses nested callback for modification of forward/backward/update. this amp pass modify the full program(forward/backward/update) in once, which increases the independency and maintainability.
  • the performance is the same as fleet.meta_optimizer.amp

@paddle-bot-old
Copy link

paddle-bot-old bot commented Jan 6, 2022

Thanks for your contribution!
Please wait for the result of CI firstly. See Paddle CI Manual for details.

@JZ-LIANG JZ-LIANG changed the title [Auto Parallel] Amp Pass [Dist Pass] Amp Pass Jan 10, 2022
@@ -185,10 +188,9 @@ def _get_dist_program(self, rank, dist_context=None, relaunch_phase=False):
self._parameter_list, self._no_grad_set, self._callbacks)

# serial forward pass
self._apply_serial_pass(completed_main_program, serial_startup_program)

self._apply_serial_pass(completed_main_program, serial_startup_program,
Copy link
Contributor

@aoyulong aoyulong Jan 10, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please change _apply_serial_pass() to _apply_pre_passes() and change _apply_post_optimization_passed to _apply_post_passes.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fixed~

from ..dist_attribute import OperatorDistributedAttribute
from paddle.distributed.auto_parallel.process_group import get_world_process_groups

global_process_mesh = get_world_process_groups().ranks
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please change get_world_process_groups() to get_world_process_group().

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fixed, though it is not my fault~ lol

g_dist_attr.dims_mapping)
self.dist_context.set_op_dist_attr_for_program(new_op, new_op_dist_attr)

main_block._sync_with_cpp()
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please add the necessary comments, especially for the methods without underscores.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done~

aoyulong
aoyulong previously approved these changes Jan 10, 2022
Copy link
Collaborator

@sneaxiy sneaxiy left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@JZ-LIANG JZ-LIANG merged commit cc24427 into PaddlePaddle:develop Jan 12, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants