Skip to content

Add simple scripts for checking if generated code changed.#12835

Closed
gchanan wants to merge 3 commits intopytorch:masterfrom
gchanan:diff_gen_files
Closed

Add simple scripts for checking if generated code changed.#12835
gchanan wants to merge 3 commits intopytorch:masterfrom
gchanan:diff_gen_files

Conversation

@gchanan
Copy link
Copy Markdown
Contributor

@gchanan gchanan commented Oct 18, 2018

This is designed to make it easier to see how your codegen changes affected actual generated code.

Limitations:
A) This is NOT robust; if new directories are added that include generated files, they need to be added to tools/generated_dirs.txt. Note that subdirectories of the list are not included.

B) This is particular to my workflow which I don't claim is generally applicable. Ideally we would have a script that pumped out a diff that could be attached to PRs.

C) Only works on OSS and definitely won't work on windows.

How to use:

  1. python setup.py ...
  2. tools/git_add_generated_dirs
  3. Edit codegen
  4. python setup.py ...
  5. git diff to see changes
  6. If satisfied: tools/git_reset_generated_dirs, commit, etc.
    If not satisfied: Go to 3)

This is designed to make it easier to see how your codegen chagnes affected generated files.

Limitations:
This is NOT robust; if new directories are added that include generated files, they need to be added to tools/generated_dirs.txt.  Note that subdirectories of the list are not included.
This is particular to my workflow which I don't claim is generally applicable.  Ideally we would have a script that pumped out a diff that could be attached to PRs.

The process is for using these are:
1) python setup.py ...
2) tools/git_add_generated_dirs
3) Edit codegen
4) python setup.py ...
4) git diff to see changes
5) If satisfied: tools/git_reset_generated_dirs, commit, etc.
   If not satisfied: Go to 3)
Copy link
Copy Markdown
Contributor

@facebook-github-bot facebook-github-bot left a comment

Choose a reason for hiding this comment

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

gchanan has imported this pull request. If you are a Facebook employee, you can view this diff on Phabricator.

@gchanan
Copy link
Copy Markdown
Contributor Author

gchanan commented Oct 18, 2018

I am happy to be told these are too specific for my workflow and we shouldn't bless it by putting this in the tree. My real hope is that someone takes this and makes it actually generally useful.

@@ -0,0 +1,2 @@
BASEDIR=$(dirname "$0")
(< $BASEDIR/generated_dirs.txt xargs -i find {} -type f) | xargs git add -f

This comment was marked as off-topic.

Copy link
Copy Markdown
Contributor

@ezyang ezyang left a comment

Choose a reason for hiding this comment

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

The scripts themselves should have the docs you wrote in the commit.

Copy link
Copy Markdown
Contributor

@facebook-github-bot facebook-github-bot left a comment

Choose a reason for hiding this comment

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

gchanan has imported this pull request. If you are a Facebook employee, you can view this diff on Phabricator.

@@ -0,0 +1,13 @@
#!/bin/sh

# HOW TO USE:

This comment was marked as off-topic.

@ezyang ezyang added the merged label Jun 25, 2019
laurentdupin pushed a commit to laurentdupin/pytorch that referenced this pull request Apr 24, 2026
…2835)

Summary:
This is designed to make it easier to see how your codegen changes affected actual generated code.

Limitations:
A) This is NOT robust; if new directories are added that include generated files, they need to be added to tools/generated_dirs.txt.  Note that subdirectories of the list are not included.

B) This is particular to my workflow which I don't claim is generally applicable.  Ideally we would have a script that pumped out a diff that could be attached to PRs.

C) Only works on OSS and definitely won't work on windows.

How to use:
1) python setup.py ...
2) tools/git_add_generated_dirs
3) Edit codegen
4) python setup.py ...
4) git diff to see changes
5) If satisfied: tools/git_reset_generated_dirs, commit, etc.
   If not satisfied: Go to 3)
Pull Request resolved: pytorch#12835

Reviewed By: ezyang

Differential Revision: D10452255

Pulled By: gchanan

fbshipit-source-id: 294fc74d41d1b840c7a26d20e05efd0aff154635
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