forked from pytorch/pytorch
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[pytorch] add script to run all codegen (pytorch#46243)
Summary: Pull Request resolved: pytorch#46243 Add util script to test whether any codegen output changes. Test Plan: Imported from OSS Reviewed By: ezyang Differential Revision: D24388873 Pulled By: ljk53 fbshipit-source-id: ef9ef7fe6067df1e0c53aba725fc13b0dfd7f4c2
- Loading branch information
1 parent
707d271
commit d95e1af
Showing
4 changed files
with
65 additions
and
2 deletions.
There are no files selected for viewing
This file contains 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,60 @@ | ||
#!/usr/bin/env bash | ||
|
||
# This script can also be used to test whether your diff changes any codegen output. | ||
# | ||
# Run it before and after your change: | ||
# .jenkins/pytorch/codegen-test.sh <baseline_output_dir> | ||
# .jenkins/pytorch/codegen-test.sh <test_output_dir> | ||
# | ||
# Then run diff to compare the generated files: | ||
# diff -Naur <baseline_output_dir> <test_output_dir> | ||
|
||
set -eu -o pipefail | ||
|
||
if [ "$#" -eq 0 ]; then | ||
COMPACT_JOB_NAME="${BUILD_ENVIRONMENT}" | ||
source "$(dirname "${BASH_SOURCE[0]}")/common.sh" | ||
OUT="$(dirname "${BASH_SOURCE[0]}")/../../codegen_result" | ||
else | ||
OUT=$1 | ||
fi | ||
|
||
set -x | ||
|
||
rm -rf "$OUT" | ||
|
||
# aten codegen | ||
python -m tools.codegen.gen \ | ||
-d "$OUT"/torch/share/ATen | ||
|
||
# torch codegen | ||
python -m tools.setup_helpers.generate_code \ | ||
--declarations-path "$OUT"/torch/share/ATen/Declarations.yaml \ | ||
--install_dir "$OUT" | ||
|
||
# pyi codegen | ||
mkdir -p "$OUT"/pyi/torch/_C | ||
mkdir -p "$OUT"/pyi/torch/nn | ||
python -m tools.pyi.gen_pyi \ | ||
--declarations-path "$OUT"/torch/share/ATen/Declarations.yaml \ | ||
--out "$OUT"/pyi | ||
|
||
# autograd codegen (called by torch codegen but can run independently) | ||
python -m tools.autograd.gen_autograd \ | ||
"$OUT"/torch/share/ATen/Declarations.yaml \ | ||
"$OUT"/autograd \ | ||
tools/autograd | ||
|
||
# unboxing_wrappers codegen (called by torch codegen but can run independently) | ||
mkdir -p "$OUT"/unboxing_wrappers | ||
python -m tools.jit.gen_unboxing_wrappers \ | ||
"$OUT"/torch/share/ATen/Declarations.yaml \ | ||
"$OUT"/unboxing_wrappers \ | ||
tools/jit/templates | ||
|
||
# annotated_fn_args codegen (called by torch codegen but can run independently) | ||
mkdir -p "$OUT"/annotated_fn_args | ||
python -m tools.autograd.gen_annotated_fn_args \ | ||
"$OUT"/torch/share/ATen/Declarations.yaml \ | ||
"$OUT"/annotated_fn_args \ | ||
tools/autograd |
This file contains 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 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 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