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

[NewFeature] Support Patch mechanism #170

Closed
wants to merge 71 commits into from

Conversation

shenzhu1993
Copy link
Collaborator

@shenzhu1993 shenzhu1993 commented Aug 1, 2024

This is a brand-new patch mechanism aimed at helping manufacturers and users better utilize the FlagScale framework for training and inference.

##1. homogeneous scenarios
Under this mechanism, manufacturers use the tools provided by FlagScale to automatically adapt the code between the base commit-id and the current commit-id, generating a compliant patch, automatically commit the code. The sample command is as follows:

        python patch/patch.py --device-type A_X100 --base-commit-id aaaa --current-commit-id bbbb

        --device-type:  Required. manufacturers name and hip mode 
        --base-commit-id: Required. commit id modified based on FlagScale
        --current-commit-id: not Required. the commit-id that want to  git commit, if it's None, the head commit id will be choosen.
 if manufacturers or user want to unpatch the code adapted, The sample command is as follows:

        python patch/unpatch.py --device-type A_X100 --commit-id aaaa --dir build

        --device-type:  Required. manufacturers name and hip mode 
        --commit-id: Required. the base-commit-id Under the FlagScale's hardwares directory, in the manufacturer's directory. This is the --base commit id you enter when using patch.py.
        --dir: not Required. directory used to store the adapted code. if it's None, The unpatch operation will be performed in the current directory.
 if you want to push the patch code,  Each commit overwrites the previous patch, so there will be only one patch file at a time. Therefore, we recommend using the following command for pushing:
         
        git push  --force  origin HEAD:main
 
Notice: If you have iterated development based on the same base_commit_id, you need to rebase to resolve conflicts before pushing (because the same patch file has been modified).

##2. heterogeneous scenarios
Heterogeneous scenarios are as simple as homogeneous scenarios. You only need to add the manufacturer's name to the --device-type option. The sample command is as follows:

       python patch/patch.py --device-type A_X100 B_Y100 --base-commit-id aaaa --current-commit-id bbbb
          
       --device-type:  Required. both manufacturers name and hip mode adapt to perform heterogeneous training or inference.
       --base-commit-id: Required. the commit-id that  git pull from FlagScale
       --current-commit-id: Required. the commit-id that manufacturers adapted
  The input parameters have the same meaning as in homogeneous scenarios. However, it is important to note that the manufacturer's name and base-commit-id must exist in patch/hetero.txt.The format in patch/hetero.txt is as follows:
     
       aaaa: A_X100  B_Y100
  if manufacturers or user want to unpatch the code adapted, The sample command is as follows:

      python patch/unpatch.py --device-type A_X100 B_Y100 --commit-id aaaa --dir build
       
        --device-type:  Required.manufacturers name and hip mode 
        --commit-id: Required. the base-commit-id Under the FlagScale's hardwares directory, in the manufacturer's directory
        --dir: Required. directory used to store the unpatch code.

patch/patch.py Outdated

# Create in-place code branch to compare different.
origin_patch_branch = "origin_patch_code"
try:
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

del

@shenzhu1993 shenzhu1993 closed this Aug 7, 2024
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.

4 participants