Repository navigation
Conversation
[ghstack-poisoned]
| "mkldnn_convolution_transpose: bf16 path needs the cpu support avx512bw, avx512vl and avx512dq"); | ||
| } else if (input_t == ScalarType::Half) { | ||
| TORCH_CHECK(mkldnn_fp16_device_check(), | ||
| "mkldnn_convolution_transpose: fp16 path needs the cpu support avx512fp16"); |
There was a problem hiding this comment.
avx512fp16 doesn't have dot-product support. Are we sure that onednn has efficient conv/gemm support based on that?
There was a problem hiding this comment.
we need some benchmark number here.
There was a problem hiding this comment.
avx512fp16 doesn't have dot-product support. Are we sure that onednn has efficient conv/gemm support based on that?
Sorry for slow reply. I'm occupied by a urgent task. The performance should be worse than fp32 for computation bound ops on avx512fp16 platforms since there is internal fp16<->fp32 overhead. Avx512_fp16 has compute instructions (fma, etc) , but those accumulate to f16, not f32. So unfortunately oneDNN cant use avx512_f16 compute instructions, only convert instructions are used. For the performance between naïve fp16 impl of PT and onednn fp16 impl (avx512fp16), hard to say, it just depends on who optimized it well.
There was a problem hiding this comment.
So, if this is only for the reference implementation, not necessarily we would rely on avx512fp16, right? Also, with avx512fp16, there might be accuracy concern since the accumulation is with f16. We shouldn't turn it on by default, right?
There was a problem hiding this comment.
I think we would rely on avx512_fp16 since OneDNN requires the cpu has avx512_fp16 at least. Onednn does not use avx512_f16 to compute. Only convert instructions are used to prevent accuracy issue.
There was a problem hiding this comment.
But why has it to depend on avx512_fp16 if only conversion instructions are used for ref implementation? Can f16c be used instead?
There was a problem hiding this comment.
Currently oneDNN has no interest in supporting fp16 for anything earlier platforms than SPR so it requires the cpu has avx512_fp16 at least. oneDNN fp16 implements have much better performance compared to naive fp16 implements of PyTorch (shapes collect from RN50, not adequate testing) #99497 (comment) . It benefits to call oneDNN with avx512_fp16. We can add some conditions to avoid some slow cases of oneDNN in the future, and ask onednn to improve the performance for such cases.
cc jgong5 mingfeima XiaobingSuper sanchitintel ashokei jingxu10 [ghstack-poisoned]
cc jgong5 mingfeima XiaobingSuper sanchitintel ashokei jingxu10 [ghstack-poisoned]
ghstack-source-id: c329c71 Pull Request resolved: pytorch#99496
cc jgong5 mingfeima XiaobingSuper sanchitintel ashokei jingxu10 [ghstack-poisoned]
cc jgong5 mingfeima XiaobingSuper sanchitintel ashokei jingxu10 [ghstack-poisoned]
ghstack-source-id: 3e9e3ac Pull Request resolved: pytorch#99496
cc jgong5 mingfeima XiaobingSuper sanchitintel ashokei jingxu10 [ghstack-poisoned]
cc jgong5 mingfeima XiaobingSuper sanchitintel ashokei jingxu10 [ghstack-poisoned]
cc jgong5 mingfeima XiaobingSuper sanchitintel ashokei jingxu10 [ghstack-poisoned]
cc jgong5 mingfeima XiaobingSuper sanchitintel ashokei jingxu10 [ghstack-poisoned]
cc jgong5 mingfeima XiaobingSuper sanchitintel ashokei jingxu10 [ghstack-poisoned]
cc jgong5 mingfeima XiaobingSuper sanchitintel ashokei jingxu10 [ghstack-poisoned]
ghstack-source-id: bdfda01 Pull Request resolved: pytorch#99496
cc jgong5 mingfeima XiaobingSuper sanchitintel ashokei jingxu10 [ghstack-poisoned]
ghstack-source-id: 07c4b03 Pull Request resolved: pytorch#99496
cc jgong5 mingfeima XiaobingSuper sanchitintel ashokei jingxu10 [ghstack-poisoned]
cc jgong5 mingfeima XiaobingSuper sanchitintel ashokei jingxu10 [ghstack-poisoned]
The PR is part of #97068, which is to add fp16 support for mkldnn conv and mkldnn deconv to leverage avx512-fp16 or amx-fp16 via the oneDNN library. cc jgong5 mingfeima XiaobingSuper sanchitintel ashokei jingxu10 [ghstack-poisoned]
|
@cpuhrsch Could you please review this PR ? Thanks. |
| self._test_conv_lower_precision_base(dim=2, dtype=torch.bfloat16) | ||
| self._test_conv_lower_precision_base(dim=2, dtype=torch.half) | ||
|
|
||
| def test_conv3d_lower_precision(self): |
There was a problem hiding this comment.
nit: If you make these dtypes arguments to the tests and use a dtype decorator it'll be easier to see if one of them fails. Otherwise you'll get one failure for either one of the dtypes.
There was a problem hiding this comment.
Thanks for the comments. I will improve such test cases in #99497 since it also involves these tests.
cpuhrsch
left a comment
There was a problem hiding this comment.
Generally looks good, just see one nit around using dtype + decorator to create separate, individual tests per dtype.
The PR is part of #97068, which is to add fp16 support for mkldnn conv and mkldnn deconv to leverage avx_ne_convert, avx512-fp16, and amx-fp16 via the oneDNN library. cc jgong5 mingfeima XiaobingSuper sanchitintel ashokei jingxu10 [ghstack-poisoned]
|
@pytorchbot merge |
Merge startedYour change will be merged once all checks pass (ETA 0-4 Hours). Learn more about merging in the wiki. Questions? Feedback? Please reach out to the PyTorch DevX Team |
Merge failedReason: 9 jobs have failed, first few of them are: periodic / ios-build-test / build (default, 1, 1, macos-12, SIMULATOR, x86_64, 1, 0, 1), periodic / buck-build-test / buck-build-test (default, 1, 1, ubuntu-latest), slow / linux-focal-py3.8-clang10 / test (slow, 1, 1, linux.2xlarge), slow / linux-jammy-py3.9-clang12-asan / test (slow, 2, 2, linux.4xlarge), slow / linux-focal-rocm5.6-py3.8 / test (slow, 1, 1, linux.rocm.gpu) Details for Dev Infra teamRaised by workflow job |
The PR is part of #97068, which is to add fp16 support for mkldnn conv and mkldnn deconv to leverage avx_ne_convert, avx512-fp16, and amx-fp16 via the oneDNN library. cc jgong5 mingfeima XiaobingSuper sanchitintel ashokei jingxu10 [ghstack-poisoned]
|
@pytorchbot merge |
Merge startedYour change will be merged once all checks pass (ETA 0-4 Hours). Learn more about merging in the wiki. Questions? Feedback? Please reach out to the PyTorch DevX Team |
Stack from ghstack (oldest at bottom):
The PR is part of #97068, which is to add fp16 support for mkldnn conv and mkldnn deconv to leverage avx_ne_convert, avx512-fp16, and amx-fp16 via the oneDNN library.
cc @jgong5 @mingfeima @XiaobingSuper @sanchitintel @ashokei @jingxu10