-
Notifications
You must be signed in to change notification settings - Fork 2.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[GPU] Optimize out Gather by converting to implicit crop #17743
Conversation
7d9919b
to
8848ebd
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
looks good in general. let me check performance.
if (usr->get_preferred_impl_type() == impl_types::onednn) | ||
return; | ||
} | ||
if (is_optimizable_padding_for_crop(node)) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
what about style below:
if (!is_optimizable_padding_for_crop)())
return;
Other code uses such style and it keeps indent small.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Applied
if (is_optimizable_padding_for_crop(node)) { | ||
const auto& crop_layout = node.get_output_layout(); | ||
const auto& crop_size = crop_layout.get_tensor(); | ||
const auto& out_padd = crop_layout.data_padding; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: padd
-> pad
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Modified. Also applied to old code.
auto new_padding = out_padd; | ||
new_padding.lower_size().batch[0] = opt_lower_pad; | ||
new_padding.upper_size().batch[0] = opt_upper_pad; | ||
node.set_output_padding(new_padding); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please add a unittest for this.
4c370b6
to
6b96b85
Compare
2e6186d
to
356bbdc
Compare
|
||
std::vector<int8_t> expected_results = { | ||
5, 6, 7, 8 | ||
}; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
what is the purpose of this test? It is just generated as gather, not crop..
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As I explained shortly, I wanted to check processing of B axis cropping by both gather and crop.
I also added similar test into crop_gpu_test.
Expected results of can_be_optimized are different.
28c0955
to
9d4d38e
Compare
|
||
std::vector<int8_t> expected_results = { | ||
5, 6, 7, 8 | ||
}; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
could you add crop test for opt-out?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This test also pass through the logic.
[ RUN ] crop_single_axis.simple_Baxis
-- prepare_buffer_fusing::run
-- can_crop_be_optimized_along_batch()
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added test into 'prepare_buffer_fusing'
9d4d38e
to
28dc744
Compare
+ Changed Gather if it divides input tensor along batch axis + Converted Gather to cldnn Crop in CreateGatherOpBase + Added implicit Crop condition for batch axis Signed-off-by: Min, Byungil <[email protected]>
28dc744
to
8f35c81
Compare
…lkit#17743) + Changed Gather if it divides input tensor along batch axis + Converted Gather to cldnn Crop in CreateGatherOpBase + Added implicit Crop condition for batch axis Signed-off-by: Min, Byungil <[email protected]>
Details:
Tickets: