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

【AutoParallelism】Add refined_ops_patterns in refined-reompute #58533

Merged
merged 8 commits into from
Nov 2, 2023

Conversation

heavyrain-lzy
Copy link
Contributor

@heavyrain-lzy heavyrain-lzy commented Oct 31, 2023

PR types

New features

PR changes

Others

Description

PCard-71568

  1. Add refined_ops_patterns to support detect the special operators sequence to be excluded in reompute segments

The format is as follow:

[{main_ops:[matmul_v2, elementwise_add], num: 4, pre_ops:[]; suf_ops:[]},
 {main_ops: [flash_attn], num: -1, pre_ops: [], suf_ops: []}]

In the yaml file, you can set as follow:

  refined_ops_patterns:
    - {main_ops: [matmul_v2, elementwise_add], num: 4, pre_ops: [], suf_ops: []}
    - {main_ops: [flash_attn], num: -1, pre_ops: [], suf_ops: []}

In the shell scripts, you can use as follow:

    -o Model.refined_ops_patterns="[{\"main_ops\": [\"matmul_v2\", \"elementwise_add\"], \"num\": 4, \"pre_ops\": [], \"suf_ops\": []},\
                                    {\"main_ops\": [\"flash_attn\"], \"num\": -1, \"pre_ops\": [], \"suf_ops\": []}]"
  1. Add "recompute.sr" to specify the first "recompute.sr" chunks in every device not to recompute.
    In the yaml file, you can set as follow:
sr: 0

In the shell scripts, you can use as follow:

 -o Model.sr=1

@heavyrain-lzy heavyrain-lzy changed the title Add refined recom 【AutoParallelism】Add refined_ops_patterns in refined-reompute Oct 31, 2023
Copy link
Contributor

@zhiqiu zhiqiu left a comment

Choose a reason for hiding this comment

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

LGTM

@heavyrain-lzy heavyrain-lzy merged commit b184364 into PaddlePaddle:develop Nov 2, 2023
28 checks passed
@paddle-bot paddle-bot bot removed the contributor External developers label Nov 3, 2023
zeroRains pushed a commit to zeroRains/Paddle that referenced this pull request Nov 8, 2023
…Paddle#58533)

* add refined-recompute support

* fix bug in recompute_pass

* fix coverage

* add ops_pattern

* add testcase

* add sr
danleifeng pushed a commit to danleifeng/Paddle that referenced this pull request Nov 14, 2023
…Paddle#58533)

* add refined-recompute support

* fix bug in recompute_pass

* fix coverage

* add ops_pattern

* add testcase

* add sr
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.

2 participants