Pytorch2.2 slower than Pytorch1.11

cyanzhao42: <p>Hi I tried to run my model using pytorch2.2 but found it significantly slower than when it is running on pytorch1.11, without any code change/compiling.<br>
I tried adding<br>
# torch.set_float32_matmul_precision(‘high’)<br>
# torch.backends.cuda.matmul.allow_tf32 = True<br>
# torch.backends.cudnn.allow_tf32 = True<br>
# torch.jit.enable_onednn_fusion(True)<br>
but none of it is helpful.</p>
<p>One thing I found is that the CPU usage is much less when running with torch2.2 (500%) compared to torch1.11 (2300%) , any hint why this would happen? Thanks a lot.</p>
<p>GPU utility is 30% for torch2.2 and 60% for torch1.11<br>
there is no “dataloader” in my code - it is for a real-time application.<br>
I also tried<br>
# torch.set_num_interop_threads(24)<br>
# torch.set_num_threads(24)</p>

GuWei007: <p>Can you use a profiler tool to analyze the differences?</p>

cyanzhao42: <p>Hi, here is a cpu profiling information, seems all operations gets much slower.<br>
<div class="lightbox-wrapper"><a class="lightbox" href="https://discuss.pytorch.org/uploads/default/original/3X/1/8/18188d10316bf2c8a612e572ef3dcc0017e4d0e2.png" data-download-href="https://discuss.pytorch.org/uploads/default/18188d10316bf2c8a612e572ef3dcc0017e4d0e2" title="image"><img src="https://discuss.pytorch.org/uploads/default/optimized/3X/1/8/18188d10316bf2c8a612e572ef3dcc0017e4d0e2_2_690x415.png" alt="image" data-base62-sha1="3ra3HcDGHS14v35tL4Z23lEytN0" width="690" height="415" srcset="https://discuss.pytorch.org/uploads/default/optimized/3X/1/8/18188d10316bf2c8a612e572ef3dcc0017e4d0e2_2_690x415.png, https://discuss.pytorch.org/uploads/default/optimized/3X/1/8/18188d10316bf2c8a612e572ef3dcc0017e4d0e2_2_1035x622.png 1.5x, https://discuss.pytorch.org/uploads/default/optimized/3X/1/8/18188d10316bf2c8a612e572ef3dcc0017e4d0e2_2_1380x830.png 2x" data-dominant-color="F3F3F3"><div class="meta"><svg class="fa d-icon d-icon-far-image svg-icon" aria-hidden="true"><use href="#far-image"></use></svg><span class="filename">image</span><span class="informations">1752×1056 94.2 KB</span><svg class="fa d-icon d-icon-discourse-expand svg-icon" aria-hidden="true"><use href="#discourse-expand"></use></svg></div></a></div></p>

cyanzhao42: <p>seems that the MKL-DNN package is different, not sure if this can be the cause. <div class="lightbox-wrapper"><a class="lightbox" href="https://discuss.pytorch.org/uploads/default/original/3X/d/e/dea14a9cb18dcb092150b956e69a55a3a40cb807.png" data-download-href="https://discuss.pytorch.org/uploads/default/dea14a9cb18dcb092150b956e69a55a3a40cb807" title="image"><img src="https://discuss.pytorch.org/uploads/default/optimized/3X/d/e/dea14a9cb18dcb092150b956e69a55a3a40cb807_2_690x80.png" alt="image" data-base62-sha1="vLtyXbKmTf9qhbCKpGFb2F6gI2r" width="690" height="80" srcset="https://discuss.pytorch.org/uploads/default/optimized/3X/d/e/dea14a9cb18dcb092150b956e69a55a3a40cb807_2_690x80.png, https://discuss.pytorch.org/uploads/default/optimized/3X/d/e/dea14a9cb18dcb092150b956e69a55a3a40cb807_2_1035x120.png 1.5x, https://discuss.pytorch.org/uploads/default/optimized/3X/d/e/dea14a9cb18dcb092150b956e69a55a3a40cb807_2_1380x160.png 2x" data-dominant-color="F2F2F2"><div class="meta"><svg class="fa d-icon d-icon-far-image svg-icon" aria-hidden="true"><use href="#far-image"></use></svg><span class="filename">image</span><span class="informations">3066×358 79.7 KB</span><svg class="fa d-icon d-icon-discourse-expand svg-icon" aria-hidden="true"><use href="#discourse-expand"></use></svg></div></a></div></p>

GuWei007: <p>Please raises an issue and gives a way to reproduce it, so that code owner will analyze it,  Thank you.</p>