-
Notifications
You must be signed in to change notification settings - Fork 24.3k
[AOTI] Conv-BN folding on CPU not working anymore after benchmark script change in https://github.com/pytorch/pytorch/pull/123403 #127513
8000New 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
Comments
The graph is different after this change for hf_T5, hf_T5_base and hf_T5_base in the Torchbench suite, which has also brought performance regression, seems there're other optimizations besides Conv-BN folding that are also missing after switching from |
@angelayi , any comments? |
Sorry, looks like this is also an issue regarding pattern matching, where we're missing some patterns in the |
Thanks for the comment. May I know if there's a plan to fix this issue or any other suggestions? Since conv-bn folding is not working anymore after the change in #123403, many CNN models have regressions using AOTI on CPU. We're wondering if there's a quick fix possible to address this issue before the PT 2.4 branch cut on 6/10. |
Hi @angelayi, just want to further check with you if any fix plan on this issue since we observed 10% - 50% performance regression on multiple CNN models in the dynamo benchmark suite on CPU after this change. We fixed the support of freezing in AOTI on CPU (#124350) and would like to propose in the coming PT 2.4 that AOTI can match or exceeding the performance of torch.compile counterparts. However, due to the current issue, there will be large performance gap between AOTI and Inductor on CNN models since AOTI does not have conv-bn folding anymore. For example the below models in TIMM are impacted: |
@chunyuan-w I not sure whats a quick way to fix this before the 2.4 release, so I'm ok with changing it back to using |
Sure, #128377 is created to revert the change in #123403. I've also added a comment as TODO to point to this issue. I see that branch cut has already been done for 2.4. I'll submit a cherry-pick PR to release/2.4 when #128377 lands on main. |
…#123403)"" This reverts commit d78991a. This PR reverts #123403 to fix the performance regression as discussed in #127513 (comment). cc voznesenskym penguinwu EikanWang jgong5 Guobing-Chen XiaobingSuper zhuhaozhe blzheng wenzhe-nrv jiayisunx chenyang78 kadeng chauhang [ghstack-poisoned]
…#128377) This reverts commit d78991a. This PR reverts #123403 to fix the performance regression as discussed in #127513 (comment). Pull Request resolved: #128377 Approved by: https://github.com/jgong5, https://github.com/angelayi, https://github.com/desertfire
…23403)" (pytorch#128377) This reverts commit d78991a. This PR reverts pytorch#123403 to fix the performance regression as discussed in pytorch#127513 (comment). Pull Request resolved: pytorch#128377 Approved by: https://github.com/jgong5, https://github.com/angelayi, https://github.com/desertfire (cherry picked from commit 5ef70fa)
… (#128377) Summary: This reverts commit d78991a7381adb3df5e9b63c365db4506643edce. This PR reverts pytorch/pytorch#123403 to fix the performance regression as discussed in pytorch/pytorch#127513 (comment). X-link: pytorch/pytorch#128377 Approved by: https://github.com/jgong5, https://github.com/angelayi, https://github.com/desertfire Reviewed By: clee2000 Differential Revision: D58501783 fbshipit-source-id: 1e55cc2c0b315ed6869195ee6730e72eb6be9da9
…23403)" (pytorch#128377) This reverts commit d78991a. This PR reverts pytorch#123403 to fix the performance regression as discussed in pytorch#127513 (comment). Pull Request resolved: pytorch#128377 Approved by: https://github.com/jgong5, https://github.com/angelayi, https://github.com/desertfire
…23403)" (pytorch#128377) This reverts commit d78991a. This PR reverts pytorch#123403 to fix the performance regression as discussed in pytorch#127513 (comment). Pull Request resolved: pytorch#128377 Approved by: https://github.com/jgong5, https://github.com/angelayi, https://github.com/desertfire
#128511) Revert "Make torch_geometric models compatible with export (#123403)" (#128377) This reverts commit d78991a. This PR reverts #123403 to fix the performance regression as discussed in #127513 (comment). Pull Request resolved: #128377 Approved by: https://github.com/jgong5, https://github.com/angelayi, https://github.com/desertfire (cherry picked from commit 5ef70fa)
Uh oh!
There was an error while loading. Please reload this page.
🐛 Describe the bug
Before #123403, when running the dynamo benchmark for AOTI, for inference on CPU, Conv and BN could be folded. However, after this PR which changed the benchmark script
common.py
: fromgm = torch.export._trace._export_to_torch_ir
togm = torch.export._trace._export(xxx).module()
, Conv-BN folding on CPU is not working anymore. This will bring performance gap between AOTI and Inductor for many CNN models in the benchmark.Reproducer:
On the bottom is
test.py
to reproduce this issue.By running
TORCH_LOGS="+inductor" python -u test.py
which simulates the behavior before this PR, from the output log we can see that Conv and BN have been folded:By running
TORCH_LOGS="+inductor" python -u test.py -a
which is the situation after the above PR, we can see from the output log that Conv and BN are not folded, there's extra computationfull
andmul
:Versions
Collecting environment information...
PyTorch version: 2.4.0a0+git669560d
Is debug build: False
CUDA used to build PyTorch: None
ROCM used to build PyTorch: N/A
OS: CentOS Stream 8 (x86_64)
GCC version: (GCC) 11.2.1 20220127 (Red Hat 11.2.1-9)
Clang version: Could not collect
CMake version: version 3.26.4
Libc version: glibc-2.28
Python version: 3.9.18 (main, Sep 11 2023, 13:41:44) [GCC 11.2.0] (64-bit runtime)
Python platform: Linux-5.16.0-x86_64-with-glibc2.28
Is CUDA available: False
CUDA runtime version: No CUDA
CUDA_MODULE_LOADING set to: N/A
GPU models and configuration: No CUDA
Nvidia driver version: No CUDA
cuDNN version: No CUDA
HIP runtime version: N/A
MIOpen runtime version: N/A
Is XNNPACK available: True
CPU:
Architecture: x86_64
CPU op-mode(s): 32-bit, 64-bit
Byte Order: Little Endian
CPU(s): 240
On-line CPU(s) list: 0-239
Thread(s) per core: 2
Core(s) per socket: 60
Socket(s): 2
NUMA node(s): 2
Vendor ID: GenuineIntel
CPU family: 6
Model: 143
Model name: Intel(R) Xeon(R) Platinum 8490H
Stepping: 8
CPU MHz: 1900.000
CPU max MHz: 3500.0000
CPU min MHz: 800.0000
BogoMIPS: 3800.00
Virtualization: VT-x
L1d cache: 48K
L1i cache: 32K
L2 cache: 2048K
L3 cache: 115200K
NUMA node0 CPU(s): 0-59,120-179
NUMA node1 CPU(s): 60-119,180-239
Flags: fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm pbe syscall nx pdpe1gb rdtscp lm constant_tsc art arch_perfmon pebs bts rep_good nopl xtopology nonstop_tsc cpuid aperfmperf tsc_known_freq pni pclmulqdq dtes64 monitor ds_cpl vmx smx est tm2 ssse3 sdbg fma cx16 xtpr pdcm pcid dca sse4_1 sse4_2 x2apic movbe popcnt tsc_deadline_timer aes xsave avx f16c rdrand lahf_lm abm 3dnowprefetch cpuid_fault epb cat_l3 cat_l2 cdp_l3 invpcid_single intel_ppin cdp_l2 ssbd mba ibrs ibpb stibp ibrs_enhanced tpr_shadow vnmi flexpriority ept vpid ept_ad fsgsbase tsc_adjust bmi1 avx2 smep bmi2 erms invpcid cqm rdt_a avx512f avx512dq rdseed adx smap avx512ifma clflushopt clwb intel_pt avx512cd sha_ni avx512bw avx512vl xsaveopt xsavec xgetbv1 xsaves cqm_llc cqm_occup_llc cqm_mbm_total cqm_mbm_local split_lock_detect avx_vnni avx512_bf16 wbnoinvd dtherm ida arat pln pts hwp hwp_act_window hwp_epp hwp_pkg_req avx512vbmi umip pku ospke waitpkg avx512_vbmi2 gfni vaes vpclmulqdq avx512_vnni avx512_bitalg tme avx512_vpopcntdq la57 rdpid bus_lock_detect cldemote movdiri movdir64b enqcmd fsrm md_clear serialize tsxldtrk pconfig arch_lbr avx512_fp16 amx_tile flush_l1d arch_capabilities
Versions of relevant libraries:
[pip3] flake8==6.1.0
[pip3] flake8-bugbear==23.3.23
[pip3] flake8-comprehensions==3.12.0
[pip3] flake8-executable==2.1.3
[pip3] flake8-logging-format==0.9.0
[pip3] flake8-pyi==23.3.1
[pip3] flake8-simplify==0.19.3
[pip3] mypy==1.9.0
[pip3] mypy-extensions==1.0.0
[pip3] numpy==1.26.0
[pip3] optree==0.11.0
[pip3] torch==2.4.0a0+git669560d
[pip3] torchvision==0.19.0a0+f0c94cd
[pip3] vit-pytorch==0.40.2
[conda] blas 1.0 mkl
[conda] mkl 2023.1.0 h213fc3f_46343
[conda] mkl-include 2023.2.0 pypi_0 pypi
[conda] mkl-service 2.4.0 py39h5eee18b_1
[conda] mkl-static 2023.2.0 pypi_0 pypi
[conda] mkl_fft 1.3.8 py39h5eee18b_0
[conda] mkl_random 1.2.4 py39hdb19cb5_0
[conda] numpy 1.26.0 pypi_0 pypi
[conda] numpy-base 1.26.4 py39hb5e798b_0
[conda] optree 0.11.0 pypi_0 pypi
[conda] torch 2.4.0a0+git669560d dev_0
[conda] torchfix 0.4.0 pypi_0 pypi
[conda] torchvision 0.19.0a0+f0c94cd dev_0
[conda] vit-pytorch 0.40.2 dev_0
cc @ezyang @msaroufim @bdhirsh @anijain2305 @chauhang @voznesenskym @penguinwu @EikanWang @jgong5 @Guobing-Chen @XiaobingSuper @zhuhaozhe @blzheng @wenzhe-nrv @jiayisunx @peterbell10 @ipiszy @yf225 @chenyang78 @kadeng @muchulee8 @ColinPeppler @amjames @desertfire
The text was updated successfully, but these errors were encountered: