Comments (4)
@Valentine233 Could you help to take a look?
from pytorch.
Tried on SPR with 56 threads.
According to the MKL verbose, the mkl_linear kernel (the highlighted shape in the issue) time has a regression starting from a certain moment:
257.85us -> 737.93us
MKL_VERBOSE SGEMM_COMPUTE(P,N,3072,197,768,0x7fdd360de040,768,0x1f629040,768,0x7ffcf8a68b38,0x1fca4540,3072) 257.85us CNR:OFF Dyn:1 FastMM:1 TID:0 NThr:56
MKL_VERBOSE SGEMM_COMPUTE(P,N,3072,197,768,0x7fde2a7d8040,768,0x1f99f980,768,0x7ffcf8a68b38,0x2003cdc0,3072) 737.93us CNR:OFF Dyn:1 FastMM:1 TID:0 NThr:56
By writing a small test case and running torch.addmm 2000 times, we could only see the kernel perf around 250us.
from pytorch.
257.85us -> 737.93us
Will the regression be further investigated and fixed?
The issue is really when weight prepacking is enabled with torch.compile() as highlighted in orange in the ticket. Even the shape becomes different with weight prepacking enabled compared to [[3072], [197, 768], [768, 3072], [], [], [197, 3072]] which is just torch.compile()
from pytorch.
There are some environment problems for the previous data. With enabling tcmalloc and iomp5 (need to install intel-openmp), the performance with weight prepack is better than that without it.
Tested on Xeon SPR with 56 threads.
Without weight prepacking:
Name Self CPU % Self CPU CPU total % CPU total CPU time avg # of Calls Input Shapes
aten::addmm 15.50% 476.529ms 17.17% 527.830ms 439.858us 1200 [[768], [197, 3072], [3072, 768], [], [], [197, 768]]
aten::addmm 14.05% 432.157ms 17.59% 540.775ms 112.662us 4800 [[768], [197, 768], [768, 768], [], [], [197, 768]]
aten::addmm 12.28% 377.698ms 14.79% 454.871ms 379.059us 1200 [[3072], [197, 768], [768, 3072], [], [], [197, 3072]]
With weight prepacking:
Name Self CPU % Self CPU CPU total % CPU total CPU time avg # of Calls Input Shapes
mkl::_mkl_linear 17.59% 458.226ms 17.80% 463.612ms 96.586us 4800 [[197, 768], [2900193, 1], [768, 768], [], []]
mkl::_mkl_linear 14.35% 373.810ms 14.41% 375.306ms 312.755us 1200 [[197, 3072], [5259489, 1], [768, 3072], [], []]
mkl::_mkl_linear 11.83% 308.105ms 11.89% 309.697ms 258.080us 1200 [[197, 768], [5259489, 1], [3072, 768], [], []]
@maajidkhann Could you try with the environment parameters mentioned above? Maybe you'd better run with the PyTorch launcher https://github.com/pytorch/pytorch/blob/main/torch/backends/xeon/run_cpu.py.
from pytorch.
Related Issues (20)
- Error in gradient of CTCLoss
- [Bug] Data on CPUs Are Not Synchronized Before Subsequent Operations HOT 4
- TORCH_LIBRARY breaks when passing (unexpanded) macro as namespace argument HOT 1
- custom_op API: better type anntation for Tuple
- Segfault, possibly due to recursion limit
- Fix accuracy regression for cspdarknet53 or flakiness associated with cu121 (and potentially cu124) HOT 1
- dynamo minifier test test_cpu_cuda_module_after_dynamo fail with nn module inlining. HOT 1
- SyntaxError: unterminated string literal (detected at line 1) (<unknown>, line 1) HOT 15
- c++ library written with a lot of errors HOT 1
- [export] Errors out when unflattening TorchTitan HOT 1
- OneCycleLR Example
- Illegal memory access resulted from pointwise autotuning of a cat-like kernel HOT 3
- DISABLED test_workspace_allocation_error (__main__.CudaGraphTreeTests) HOT 1
- Inductor generates unnecessary allocation + copy operations for custom ops with mutable inputs HOT 11
- Strange clamp assert error when building on Fedora 40/gcc 14 in IndexKernel.hip HOT 1
- Add line number to ` _warn_capture_scalar_outputs():`
- module 'torch.mps' has no attribute 'device' HOT 1
- Key error in index_propagation when looking up dynamic shape vr HOT 8
- RuntimeError: `jit.freeze` fails to find externally assigned attributes
- UNSTABLE inductor / cuda12.4-py3.10-gcc9-sm86 / test (dynamic_inductor_timm) HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from pytorch.