Repository navigation
Conversation
🔗 Helpful Links🧪 See artifacts and rendered test results at hud.pytorch.org/pr/203265
Note: Links to docs will display an error until the docs builds have been completed. ✅ No FailuresAs of commit 9952853 with merge base 6bf26fa ( This comment was automatically generated by Dr. CI and updates every 15 minutes. |
frost-intel
left a comment
There was a problem hiding this comment.
I think this will overlap with work in #203181, so you might need to remeasure benchmarks when that lands first.
Also, this doesn't enable parallelism for large k and small m, n. The existing code doesn't either, but it's something you could consider.
| @@ -8891,6 +9621,27 @@ def test(): | |||
| check_correctness(torch.dot, torch.bfloat16, a, b) | |||
| check_correctness(torch.dot, torch.half, a, b) | |||
|
|
|||
| @onlyCPU | |||
| @dtypes(torch.bfloat16, torch.half) | |||
| def test_addmm_reduced_precision_without_mkldnn(self, device, dtype): | |||
| // it cannot read directly and use it for every layout. Leave tiny problems to naive loop. | ||
| if (m * n * k > 16 * 16 * 16) { | ||
| std::unique_ptr<scalar_t[]> a_packed, b_packed; | ||
| if (transa == TransposeType::NoTranspose) { |
There was a problem hiding this comment.
This copies all of A on every call. For large n the copy is cheap, but for n==1 or other small n the work would be limited by memory bandwidth, so the copy would be expensive. Could you skip the repack for small n and use a vectorized kernel that sweeps A column by column?
You could test this with n=1, 4, 16, 64 for non-transposed A.
|
@Kanya-Mo I tested this PR on the same laptop as well, but this time with MKL disabled so fp16 actually uses the new Most layouts show substantial speedups. However, I was able to reproduce the small- Here are the numbers:
|
The PR aims at improving performance of reduced precision gemm on old CPU platforms reported in #146508. When oneDNN does not handle a bf16/fp16 matmul on CPU,
cpublas::gemmfalls back to the kernels in BlasKernel.cpp. Only one of the four transpose layouts there had a vectorized, parallel kernelgemm_transa_. This PR modify the routing and does a few improvements.The performance data is measured on GNR Xeon 6960P emulating old CPUs.
cc @jgong5 @mingfeima @XiaobingSuper @sanchitintel @ashokei @jingxu10 @aditew01