pytorch
0e7918b9 - fix mkldnn quantization issue for weight reorder error (#86876)

Commit
2 years ago
fix mkldnn quantization issue for weight reorder error (#86876) Differential Revision: [D40351062](https://our.internmc.facebook.com/intern/diff/D40351062) For mkldnn quantization path, we will do weight prepack using dummy data to query the expected weight format, the packed weight's format may differ from the real input case(the weight format depends on the input's shape), and there will have a block weight to block weight reorder if the packed weight format differs with the expected weight format. The mkldnn may meet the following issue when doing such reorder(test on ICX machine): ``` test_conv_reorder_issue_onednn torch.ops.quantized.conv2d(qx, w_packed, output_scale=1.0, output_zero_point=0) File "/home/weiwen/.conda/envs/int8-dev/lib/python3.9/site-packages/torch/_ops.py", line 472, in __call__ return self._op(*args, **kwargs or {}) RuntimeError: could not create a primitive descriptor for a reorder primitive ``` This PR will fix it: if the block weight to block weight reorder is failed, we will reorder the block weight to plain weight first, and then reorder the plain weight to the target block weight. Pull Request resolved: https://github.com/pytorch/pytorch/pull/86876 Approved by: https://github.com/jgong5, https://github.com/jerryzh168
Author
Committer
Parents
Loading