-
Notifications
You must be signed in to change notification settings - Fork 635
[SimpleFSDP] add CI to guard compiler optimization passes #2072
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
Open
ruisizhang123
wants to merge
2
commits into
main
Choose a base branch
from
ruisi/add_passes_ci
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
255 changes: 255 additions & 0 deletions
255
torchtitan/experiments/simple_fsdp/tests/compiler_pass_integration_tests.py
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,255 @@ | ||
| # Copyright (c) Meta Platforms, Inc. and affiliates. | ||
| # All rights reserved. | ||
| # | ||
| # This source code is licensed under the BSD-style license found in the | ||
| # LICENSE file in the root directory of this source tree. | ||
|
|
||
| import argparse | ||
| import os | ||
|
|
||
| from tests.integration_tests import OverrideDefinitions | ||
| from tests.integration_tests.run_tests import run_tests | ||
|
|
||
|
|
||
| def build_simple_fsdp_test_list() -> list[OverrideDefinitions]: | ||
| """ | ||
| key is the config file name and value is a list of OverrideDefinitions | ||
| that is used to generate variations of integration tests based on the | ||
| same root config file. | ||
| """ | ||
| integration_tests_flavors = [ | ||
| OverrideDefinitions( | ||
| [ | ||
| [ | ||
| "--model.name simple_fsdp.llama3", | ||
| "--compile.enable", | ||
| "--job.custom_config_module=torchtitan.experiments.simple_fsdp.job_config", | ||
| "--compile.backend aot_eager", | ||
| "--compile.graph_passes auto_bucketing", | ||
| "--comm.mode fake_backend", | ||
| ], | ||
| ], | ||
| "1D+autobucketing", | ||
| "1d_autobucketing", | ||
| ngpu=8, | ||
| ), | ||
| OverrideDefinitions( | ||
| [ | ||
| [ | ||
| "--model.name simple_fsdp.llama3", | ||
| "--compile.enable", | ||
| "--job.custom_config_module=torchtitan.experiments.simple_fsdp.job_config", | ||
| "--compile.backend aot_eager", | ||
| "--compile.graph_passes transformer_block_bucketing", | ||
| "--comm.mode fake_backend", | ||
| ], | ||
| ], | ||
| "1D+transformer_block_bucketing", | ||
| "1d_transformer_block_bucketing", | ||
| ngpu=8, | ||
| ), | ||
| OverrideDefinitions( | ||
| [ | ||
| [ | ||
| "--model.name simple_fsdp.llama3", | ||
| "--parallelism.tensor_parallel_degree 2", | ||
| "--compile.enable", | ||
| "--job.custom_config_module=torchtitan.experiments.simple_fsdp.job_config", | ||
| "--compile.backend aot_eager", | ||
| "--compile.graph_passes auto_bucketing", | ||
| "--comm.mode fake_backend", | ||
| ], | ||
| ], | ||
| "2D+autobucketing", | ||
| "2d_autobucketing", | ||
| ngpu=8, | ||
| ), | ||
| OverrideDefinitions( | ||
| [ | ||
| [ | ||
| "--model.name simple_fsdp.llama3", | ||
| "--parallelism.tensor_parallel_degree 2", | ||
| "--compile.enable", | ||
| "--job.custom_config_module=torchtitan.experiments.simple_fsdp.job_config", | ||
| "--compile.backend aot_eager", | ||
| "--compile.graph_passes transformer_block_bucketing", | ||
| "--comm.mode fake_backend", | ||
| ], | ||
| ], | ||
| "2D+transformer_block_bucketing", | ||
| "2d_transformer_block_bucketing", | ||
| ngpu=8, | ||
| ), | ||
| # TODO(ruisizhang123): add back after passes + PP is supported | ||
| # OverrideDefinitions( | ||
| # [ | ||
| # [ | ||
| # "--model.name simple_fsdp.llama3", | ||
| # "--parallelism.tensor_parallel_degree 2", | ||
| # "--parallelism.pipeline_parallel_degree 2", | ||
| # "--compile.enable", | ||
| # "--job.custom_config_module=torchtitan.experiments.simple_fsdp.job_config", | ||
| # "--compile.backend aot_eager", | ||
| # "--compile.graph_passes auto_bucketing", | ||
| # "--comm.mode fake_backend", | ||
| # ], | ||
| # ], | ||
| # "3D+autobucketing", | ||
| # "3d_autobucketing", | ||
| # ngpu=8, | ||
| # ), | ||
| # OverrideDefinitions( | ||
| # [ | ||
| # [ | ||
| # "--model.name simple_fsdp.llama3", | ||
| # "--parallelism.tensor_parallel_degree 2", | ||
| # "--parallelism.pipeline_parallel_degree 2", | ||
| # "--compile.enable", | ||
| # "--job.custom_config_module=torchtitan.experiments.simple_fsdp.job_config", | ||
| # "--compile.backend aot_eager", | ||
| # "--compile.graph_passes transformer_block_bucketing", | ||
| # "--comm.mode fake_backend", | ||
| # ], | ||
| # ], | ||
| # "3D+transformer_block_bucketing", | ||
| # "3d_transformer_block_bucketing", | ||
| # ngpu=8, | ||
| # ), | ||
| # OverrideDefinitions( | ||
| # [ | ||
| # [ | ||
| # "--model.name simple_fsdp.llama3", | ||
| # "--parallelism.tensor_parallel_degree 2", | ||
| # "--parallelism.context_parallel_degree 2", | ||
| # "--compile.enable", | ||
| # "--job.custom_config_module=torchtitan.experiments.simple_fsdp.job_config", | ||
| # "--compile.backend aot_eager", | ||
| # "--compile.graph_passes auto_bucketing", | ||
| # "--comm.mode fake_backend", | ||
| # ], | ||
| # ], | ||
| # "FSDP+TP+CP+autobucketing", | ||
| # "fsdp+tp+cp_autobucketing", | ||
| # ngpu=8, | ||
| # ), | ||
| OverrideDefinitions( | ||
| [ | ||
| [ | ||
| "--model.name simple_fsdp.llama3", | ||
| "--parallelism.tensor_parallel_degree 2", | ||
| "--parallelism.context_parallel_degree 2", | ||
| "--compile.enable", | ||
| "--job.custom_config_module=torchtitan.experiments.simple_fsdp.job_config", | ||
| "--compile.backend aot_eager", | ||
| "--compile.graph_passes transformer_block_bucketing", | ||
| "--comm.mode fake_backend", | ||
| ], | ||
| ], | ||
| "FSDP+TP+CP+transformer_block_bucketing", | ||
| "fsdp+tp+cp_transformer_block_bucketing", | ||
| ngpu=8, | ||
| ), | ||
| OverrideDefinitions( | ||
| [ | ||
| [ | ||
| "--model.name simple_fsdp.deepseek_v3", | ||
| "--parallelism.data_parallel_shard_degree 4", | ||
| "--parallelism.expert_parallel_degree 2", | ||
| "--job.custom_config_module=torchtitan.experiments.simple_fsdp.job_config", | ||
| "--compile.backend aot_eager", | ||
| "--compile.graph_passes auto_bucketing", | ||
| "--comm.mode fake_backend", | ||
| ], | ||
| ], | ||
| "FSDP+EP+autobucketing", | ||
| "fsdp+ep_autobucketing", | ||
| ngpu=4, | ||
| ), | ||
| OverrideDefinitions( | ||
| [ | ||
| [ | ||
| "--model.name simple_fsdp.deepseek_v3", | ||
| "--parallelism.data_parallel_shard_degree 4", | ||
| "--parallelism.expert_parallel_degree 2", | ||
| "--job.custom_config_module=torchtitan.experiments.simple_fsdp.job_config", | ||
| "--compile.backend aot_eager", | ||
| "--compile.graph_passes transformer_block_bucketing", | ||
| "--comm.mode fake_backend", | ||
| ], | ||
| ], | ||
| "FSDP+EP+transformer_block_bucketing", | ||
| "fsdp+ep_transformer_block_bucketing", | ||
| ngpu=4, | ||
| ), | ||
| OverrideDefinitions( | ||
| [ | ||
| [ | ||
| "--model.name simple_fsdp.deepseek_v3", | ||
| "--parallelism.data_parallel_shard_degree 2", | ||
| "--parallelism.tensor_parallel_degree 2", | ||
| "--parallelism.expert_parallel_degree 4", | ||
| "--parallelism.expert_tensor_parallel_degree 1", | ||
| "--job.custom_config_module=torchtitan.experiments.simple_fsdp.job_config", | ||
| "--compile.backend aot_eager", | ||
| "--compile.graph_passes auto_bucketing", | ||
| "--comm.mode fake_backend", | ||
| ], | ||
| ], | ||
| "FSDP+TP+EP+autobucketing", | ||
| "fsdp+tp+ep_autobucketing", | ||
| ngpu=4, | ||
| ), | ||
| OverrideDefinitions( | ||
| [ | ||
| [ | ||
| "--model.name simple_fsdp.deepseek_v3", | ||
| "--parallelism.data_parallel_shard_degree 2", | ||
| "--parallelism.tensor_parallel_degree 2", | ||
| "--parallelism.expert_parallel_degree 4", | ||
| "--parallelism.expert_tensor_parallel_degree 1", | ||
| "--job.custom_config_module=torchtitan.experiments.simple_fsdp.job_config", | ||
| "--compile.backend aot_eager", | ||
| "--compile.graph_passes transformer_block_bucketing", | ||
| "--comm.mode fake_backend", | ||
| ], | ||
| ], | ||
| "FSDP+TP+EP+transformer_block_bucketing", | ||
| "fsdp+tp+ep_transformer_block_bucketing", | ||
| ngpu=4, | ||
| ), | ||
| ] | ||
| return integration_tests_flavors | ||
|
|
||
|
|
||
| _TEST_SUITES_FUNCTION = { | ||
| "simple_fsdp": build_simple_fsdp_test_list, | ||
| } | ||
|
|
||
|
|
||
| def main(): | ||
| parser = argparse.ArgumentParser() | ||
| parser.add_argument("output_dir") | ||
| parser.add_argument( | ||
| "--config_path", | ||
| default="./tests/integration_tests/base_config.toml", | ||
| help="Base config path for integration tests. This is the config that will be used as a base for all tests.", | ||
| ) | ||
| parser.add_argument( | ||
| "--test_name", | ||
| default="all", | ||
| help="test to run, acceptable values: `test_name` in `build_test_list` (default: all)", | ||
| ) | ||
| parser.add_argument("--ngpu", default=8, type=int) | ||
| args = parser.parse_args() | ||
|
|
||
| if not os.path.exists(args.output_dir): | ||
| os.makedirs(args.output_dir) | ||
| if os.listdir(args.output_dir): | ||
| raise RuntimeError("Please provide an empty output directory.") | ||
|
|
||
| test_list = _TEST_SUITES_FUNCTION["simple_fsdp"]() | ||
| run_tests(args, test_list) | ||
|
|
||
|
|
||
| if __name__ == "__main__": | ||
| main() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not sure if splitting into two tests will incur overhead.
@wwwjn does this incur any overhead to CI?