Skip to content

Optimizations for precision conversion operations in nGraph reference implementations#3974

Merged
dmitry-gorokhov merged 13 commits intoopenvinotoolkit:masterfrom
vladislav-volkov:dev-convert-precision
Feb 8, 2021
Merged

Optimizations for precision conversion operations in nGraph reference implementations#3974
dmitry-gorokhov merged 13 commits intoopenvinotoolkit:masterfrom
vladislav-volkov:dev-convert-precision

Conversation

@vladislav-volkov
Copy link
Copy Markdown
Contributor

Data precision conversion operations take up a significant part of the load time. On average ConvertPrecision transformation pass takes 34% of load time for FP16 models. This fix significantly reduce time of int8->fp16 and fp16->fp32 conversions.

@vladislav-volkov vladislav-volkov requested review from a team January 22, 2021 14:11
@openvino-pushbot openvino-pushbot added category: inference OpenVINO Runtime library - Inference category: Core OpenVINO Core (aka ngraph) labels Jan 22, 2021
@vladislav-volkov vladislav-volkov marked this pull request as draft January 22, 2021 14:34
@vladislav-volkov vladislav-volkov marked this pull request as ready for review January 25, 2021 13:07
@vladislav-volkov vladislav-volkov force-pushed the dev-convert-precision branch 2 times, most recently from 4027bf2 to 3414af4 Compare January 25, 2021 16:53
@vladislav-volkov vladislav-volkov marked this pull request as draft January 26, 2021 07:36
@vladislav-volkov vladislav-volkov force-pushed the dev-convert-precision branch 2 times, most recently from 85c7c33 to 23e4f88 Compare January 26, 2021 10:33
@vladislav-volkov vladislav-volkov marked this pull request as ready for review January 26, 2021 11:03
@vladislav-volkov vladislav-volkov requested review from a team and ilya-lavrenov January 26, 2021 11:03
@vladislav-volkov vladislav-volkov force-pushed the dev-convert-precision branch 2 times, most recently from 4e3db8b to e1552e8 Compare January 26, 2021 13:35
Copy link
Copy Markdown
Contributor

@GlebKazantaev GlebKazantaev left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Transformations part looks good,

@GlebKazantaev GlebKazantaev self-requested a review January 26, 2021 17:35
for (size_t i = 0; i < size; ++i) {
dst_data[i] = convert_value<src_type, dst_type>(src_data[i]);
for (size_t i = 0; i < size; ++i) {
dst_data[i] = convert_value<src_type, dst_type>(src_data[i]);
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why cannot I always use the reference implementation?
I thought that reference implementation should support any precisions

Copy link
Copy Markdown
Contributor Author

@vladislav-volkov vladislav-volkov Jan 29, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The behavior of two convert operations is slightly different. The nGraph conversion operation does not check upper and lower bounds. In my cases, for int8->fp16 and fp16->fp32 conversions, I can use nGraph implementations as-is, because the target type values range is wider than the source.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

May be we should align conversion operations in Graph and transformations library.

@ilya-lavrenov ilya-lavrenov added this to the 2021.3 milestone Feb 2, 2021
@ilya-lavrenov ilya-lavrenov added the pr: needs tests PR needs tests updating label Feb 2, 2021
@@ -0,0 +1,273 @@
//*****************************************************************************
// Copyright 2017-2020 Intel Corporation
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Only 2021 I suppose.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fixed

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

please fix in other files as well

@dmitry-gorokhov dmitry-gorokhov merged commit 2ad7db7 into openvinotoolkit:master Feb 8, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

category: Core OpenVINO Core (aka ngraph) category: inference OpenVINO Runtime library - Inference pr: needs tests PR needs tests updating

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants