mirror of
https://github.com/zebrajr/pytorch.git
synced 2025-12-07 00:21:07 +01:00
Summary: Pull Request resolved: https://github.com/pytorch/pytorch/pull/42629 How to approach reviewing this diff: - The new codegen itself lives in `tools/codegen`. Start with `gen.py`, then read `model.py` and them the `api/` folder. The comments at the top of the files describe what is going on. The CLI interface of the new codegen is similar to the old one, but (1) it is no longer necessary to explicitly specify cwrap inputs (and now we will error if you do so) and (2) the default settings for source and install dir are much better; to the extent that if you run the codegen from the root source directory as just `python -m tools.codegen.gen`, something reasonable will happen. - The old codegen is (nearly) entirely deleted; every Python file in `aten/src/ATen` was deleted except for `common_with_cwrap.py`, which now permanently finds its home in `tools/shared/cwrap_common.py` (previously cmake copied the file there), and `code_template.py`, which now lives in `tools/codegen/code_template.py`. We remove the copying logic for `common_with_cwrap.py`. - All of the inputs to the old codegen are deleted. - Build rules now have to be adjusted to not refer to files that no longer exist, and to abide by the (slightly modified) CLI. - LegacyTHFunctions files have been generated and checked in. We expect these to be deleted as these final functions get ported to ATen. The deletion process is straightforward; just delete the functions of the ones you are porting. There are 39 more functions left to port. Signed-off-by: Edward Z. Yang <ezyang@fb.com> Test Plan: Imported from OSS Reviewed By: bhosmer Differential Revision: D23183978 Pulled By: ezyang fbshipit-source-id: 6073ba432ad182c7284a97147b05f0574a02f763
55 lines
1.5 KiB
Bash
Executable File
55 lines
1.5 KiB
Bash
Executable File
#!/bin/bash
|
|
|
|
set -ex
|
|
|
|
ignore_warning() {
|
|
# Invert match to filter out $1.
|
|
set +e
|
|
grep -v "$1" doxygen-log.txt > temp.txt
|
|
set -e
|
|
mv temp.txt doxygen-log.txt
|
|
}
|
|
|
|
command -v doxygen >/dev/null 2>&1 || { echo >&2 "doxygen is not supported. Aborting."; exit 1; }
|
|
|
|
pushd "$(dirname "$0")/../../.."
|
|
|
|
cp torch/_utils_internal.py tools/shared
|
|
|
|
python -m tools.codegen.gen
|
|
|
|
python tools/setup_helpers/generate_code.py \
|
|
--declarations-path build/aten/src/ATen/Declarations.yaml \
|
|
--nn-path aten/src
|
|
|
|
popd
|
|
|
|
# Run doxygen and log all output.
|
|
doxygen "$(dirname $0)" 2> original-doxygen-log.txt
|
|
cp original-doxygen-log.txt doxygen-log.txt
|
|
|
|
# Uncomment this if you need it for debugging; we're not printing this
|
|
# by default because it is confusing.
|
|
# echo "Original output"
|
|
# cat original-doxygen-log.txt
|
|
|
|
# Filter out some warnings.
|
|
ignore_warning "warning: no uniquely matching class member found for"
|
|
ignore_warning "warning: explicit link request to 'Item' could not be resolved"
|
|
ignore_warning "warning: Included by graph for 'types.h' not generated, too many nodes"
|
|
|
|
# Count the number of remaining warnings.
|
|
warnings="$(grep 'warning:' doxygen-log.txt | wc -l)"
|
|
|
|
echo "Treating all remaining warnings as errors"
|
|
|
|
if [[ "$warnings" -ne "0" ]]; then
|
|
echo "Failing Doxygen test because the following warnings were treated fatally:"
|
|
cat doxygen-log.txt
|
|
echo "Please fix these warnings. To run this test locally, use docs/cpp/source/check-doxygen.sh"
|
|
rm -f doxygen-log.txt original-doxygen-log.txt
|
|
exit 1
|
|
fi
|
|
|
|
rm -f doxygen-log.txt original-doxygen-log.txt
|