Skip to content

[GPU] Onednn integration for handling reorders#7764

Merged
isanghao merged 1 commit intoopenvinotoolkit:masterfrom
byungilm:merge_remove_reorder
Oct 13, 2021
Merged

[GPU] Onednn integration for handling reorders#7764
isanghao merged 1 commit intoopenvinotoolkit:masterfrom
byungilm:merge_remove_reorder

Conversation

@byungilm
Copy link
Copy Markdown
Contributor

Signed-off-by: Min, Byungil byungil.min@intel.com

Details:

  • Integration for remove_redundant_reorders
  • Integration for add_required_reorders

Tickets:

  • ticket-id

@byungilm byungilm requested review from a team as code owners September 30, 2021 10:54
@openvino-pushbot openvino-pushbot added the category: GPU OpenVINO GPU plugin label Sep 30, 2021
Comment thread inference-engine/thirdparty/clDNN/src/graph_optimizer/add_required_reorders.cpp Outdated
@byungilm byungilm force-pushed the merge_remove_reorder branch from f9c4503 to c3d2150 Compare October 1, 2021 07:02
@byungilm byungilm force-pushed the merge_remove_reorder branch 2 times, most recently from aeb8e1a to 86903fd Compare October 6, 2021 03:04

bool all_users_fuse = true;
std::vector<program_node*> recalc_list;

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.

I found there is change like below. Did you omit it intentionally?

@@ -318,7 +318,6 @@ void remove_redundant_reorders::run(program_impl& p) {
         auto& dep = node_ptr->get_dependency(0);
         if (!usr->is_type<quantize>() ||
             (dep.get_output_layout().format != format::b_fs_yx_fsv16 &&
-             dep.get_output_layout().format != format::fs_b_yx_fsv32 &&
              dep.get_output_layout().format != format::bfyx))
             continue;

Copy link
Copy Markdown
Contributor Author

@byungilm byungilm Oct 7, 2021

Choose a reason for hiding this comment

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

modified

(usr->get_output_layout().data_type != dep.get_output_layout().data_type) ||
(dep.get_output_layout().format != format::bfyx) ||
(usr->get_output_layout().format != format::fs_b_yx_fsv32))
(usr->get_output_layout().format != format::fs_b_yx_fsv32 && usr->get_output_layout().format != format::b_fs_yx_fsv32) ||
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.

This is now mismatching with the comment. Could you check the comment just above this line?

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.

I found that this code was initially inserted by @sshlyapn.
Sergey, do we have update in convolution code as well to support b_fs_yx_fsv32?

Copy link
Copy Markdown
Contributor

@isanghao isanghao Oct 7, 2021

Choose a reason for hiding this comment

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

conv fusion of (b_fs_yx_fsv32 reorder) is supported only on onednn.

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.

it will be fixed as discussed.

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.

I think this is quite became quite difficult now. What about rewriting as below? It will include the diff in line 366.

        if (!(usr->is_type<convolution>()) ||
             usr->get_output_layout().data_type != dep.get_output_layout().data_type ||
             dep.get_output_layout().format != format::bfyx))
            return;
        if (usr->as<convolution().get_preferred_impl_type() == impl_types::cldnn &&
              usr->get_output_layout().format != format::fs_b_yx_fsv32)
             return;
        if (usr->as<convolution().get_preferred_impl_type() == impl_types::onednn &&
              usr->get_output_layout().format != format::b_fs_yx_fsv32)
              return;

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.

Ok.

@byungilm byungilm requested a review from sshlyapn October 7, 2021 07:06
@byungilm byungilm force-pushed the merge_remove_reorder branch 2 times, most recently from 1256933 to bbad62c Compare October 8, 2021 01:23
if ((usr->as<quantize>().get_preferred_impl_type() != impl_types::onednn) &&
(dep.get_output_layout().format == format::fs_b_yx_fsv32))
continue;

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.

From what I remember, we should not apply this snippet. 1) fs_b_yx_fsv32 won't be selected for onednn. 2) we should not touch cldnn logic.

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.

Ok it will be removed.

(usr->get_output_layout().data_type != dep.get_output_layout().data_type) ||
(dep.get_output_layout().format != format::bfyx) ||
(usr->get_output_layout().format != format::fs_b_yx_fsv32))
(usr->get_output_layout().format != format::fs_b_yx_fsv32 && usr->get_output_layout().format != format::b_fs_yx_fsv32) ||
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.

I think this is quite became quite difficult now. What about rewriting as below? It will include the diff in line 366.

        if (!(usr->is_type<convolution>()) ||
             usr->get_output_layout().data_type != dep.get_output_layout().data_type ||
             dep.get_output_layout().format != format::bfyx))
            return;
        if (usr->as<convolution().get_preferred_impl_type() == impl_types::cldnn &&
              usr->get_output_layout().format != format::fs_b_yx_fsv32)
             return;
        if (usr->as<convolution().get_preferred_impl_type() == impl_types::onednn &&
              usr->get_output_layout().format != format::b_fs_yx_fsv32)
              return;

@byungilm byungilm force-pushed the merge_remove_reorder branch 2 times, most recently from c0025ab to 909caa9 Compare October 8, 2021 08:33
@byungilm byungilm requested a review from isanghao October 8, 2021 09:49
@byungilm
Copy link
Copy Markdown
Contributor Author

Passed dry-run with gpu_tools/dryrun_benchmark.sh update.

Signed-off-by: Min, Byungil <byungil.min@intel.com>
@byungilm byungilm force-pushed the merge_remove_reorder branch from 909caa9 to 48cd925 Compare October 13, 2021 04:01
@isanghao isanghao merged commit d23ec24 into openvinotoolkit:master Oct 13, 2021
@vladimir-paramuzov vladimir-paramuzov added this to the 2022.1 milestone Oct 13, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

category: GPU OpenVINO GPU plugin

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants