Skip to content

Commit

Permalink
[IE CLDNN] Extend resample int8 packing optimization
Browse files Browse the repository at this point in the history
This extends resample optimization for 8-bit types that uses feature
packed to mode to process multiple features in one work-item to features
not being multiple of packing factor.

For nearest resampling it is safe to copy extra feature padding for
blocked formats, so this change only removes this condition.
  • Loading branch information
Konrad Dobros committed Aug 7, 2020
1 parent f832453 commit 80a7e7e
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,9 @@ static size_t packing_factor(const resample_params& params) {
size_t input_factor = get_layout_packing_factor(params.inputs[0].GetLayout());
size_t output_factor = get_layout_packing_factor(params.output.GetLayout());

return std::min(input_factor, output_factor);
if (input_factor % output_factor == 0 || output_factor % input_factor == 0)
return std::min(input_factor, output_factor);
return 1;
}

static bool use_packing(const resample_params& params) {
Expand All @@ -83,8 +85,7 @@ static bool use_packing(const resample_params& params) {
if (pack == 1)
return false;

if (params.inputs[0].Feature().v % pack != 0 || params.output.Feature().v % pack != 0 ||
params.inputs[0].Feature().pad.before % pack != 0 || params.output.Feature().pad.before % pack != 0)
if (params.inputs[0].Feature().pad.before % pack != 0 || params.output.Feature().pad.before % pack != 0)
return false;

auto packed_work_items = params.output.X().v * params.output.Y().v * params.output.Z().v
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -775,4 +775,6 @@ INSTANTIATE_TEST_CASE_P(smoke,

.smoke_params(data_types::f32, format::b_fs_yx_fsv16, format::b_fs_yx_fsv16)
.smoke_params(data_types::f16, format::b_fs_yx_fsv16, format::b_fs_yx_fsv16)
.smoke_params(data_types::i8, format::b_fs_yx_fsv16, format::b_fs_yx_fsv16)
.smoke_params(data_types::u8, format::b_fs_yx_fsv16, format::b_fs_yx_fsv16)
), );

0 comments on commit 80a7e7e

Please sign in to comment.