Set environment variable FLAGS_logging_pir_py_code_dir
to an existed logging directory before running a paddle program. Once the paddle program finished, there are some pir python files generated under the logging directory.
The orignal pir programs passed into ApplyCinnPass are collected in log file original_programs.py
in the logging directory
The file named group_op_programs.py
in the logging directory collects all pir programs after pass ApplyBuildGroupOpPass
The file named fusion_op_programs.py
in the logging directory collects all pir programs after pass ApplyDivideGroupOpToFusionOpPass
python3 -m athena.module_op_unittests /path/to/original_programs.py --output_dir=/path/to/output/dir
examples see tests/test-generate-module-op-unittests.sh
python3 -m athena.group_op_unittests /path/to/group_op_programs.py --output_dir=/path/to/output/dir
examples see tests/test-generate-group-op-unittests.sh
python3 -m athena.fusion_op_unittests /path/to/fusion_op_programs.py --output_dir=/path/to/output/dir
examples see tests/test-generate-fusion-op-unittests.sh
You can bisearch on PADDLE_DEBUG_NUM_ALLOWED_OPS
to find the bug op.
The environment variable PADDLE_DEBUG_NUM_ALLOWED_OPS
allows you to reduce compute graph
# e.g.1: reduce compute graph to 0 ops
PADDLE_DEBUG_NUM_ALLOWED_OPS=0 python3.9 ./tmp/test_90a61f91bf628c33b3e398b98f44cf26.py
# e.g.2: reduce compute graph to 1 op
PADDLE_DEBUG_NUM_ALLOWED_OPS=1 python3.9 ./tmp/test_90a61f91bf628c33b3e398b98f44cf26.py
# e.g.3: reduce compute graph to 10000 ops
PADDLE_DEBUG_NUM_ALLOWED_OPS=10000 python3.9 ./tmp/test_90a61f91bf628c33b3e398b98f44cf26.py