[GPU] Cleanup buffer optimization code (#21012)

This commit is contained in:
Vladimir Paramuzov 2023-11-21 14:43:14 +04:00 committed by GitHub
parent 6607e5b8c2
commit a6e4d8fc30
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
14 changed files with 9 additions and 62 deletions

View File

@ -240,21 +240,11 @@ crop_inst::typed_primitive_inst(network& network, crop_node const& node) : paren
if (node.can_be_optimized()) {
build_deps();
reuse_input();
update_output_memory();
}
}
void crop_inst::on_execute() {
if (!can_be_optimized())
return;
if (_outputs[0] && _network.get_engine().is_the_same_buffer(output_memory(), input_memory()))
return;
reuse_input();
}
void crop_inst::reuse_input() {
update_output_memory();
}

View File

@ -58,8 +58,6 @@ public:
private:
void on_execute() override;
void reuse_input();
};
using crop_inst = typed_primitive_inst<crop>;

View File

@ -71,7 +71,6 @@ public:
private:
void on_execute() override;
void reuse_input();
};
using permute_inst = typed_primitive_inst<permute>;

View File

@ -108,7 +108,6 @@ public:
private:
void on_execute() override;
void reuse_input();
bool _req_reinterpr = false;
};

View File

@ -111,8 +111,6 @@ public:
private:
void on_execute() override;
void reuse_input();
};
using reshape_inst = typed_primitive_inst<reshape>;

View File

@ -26,7 +26,6 @@ public:
private:
void on_execute() override;
void reuse_input();
};
using scatter_elements_update_inst = typed_primitive_inst<scatter_elements_update>;

View File

@ -28,7 +28,6 @@ public:
private:
void on_execute() override;
void reuse_input();
};
using scatter_nd_update_inst = typed_primitive_inst<scatter_nd_update>;

View File

@ -41,7 +41,6 @@ public:
private:
void on_execute() override;
void reuse_input();
};
using scatter_update_inst = typed_primitive_inst<scatter_update>;

View File

@ -118,20 +118,14 @@ permute_inst::typed_primitive_inst(network& network, permute_node const& node) :
CLDNN_ERROR_MESSAGE(node.id(), "Permute order does not contain all of required values.");
}
if (node.can_be_optimized()) {
reuse_input();
}
update_output_memory();
}
void permute_inst::on_execute() {
if (can_be_optimized())
reuse_input();
}
void permute_inst::reuse_input() {
update_output_memory();
}
void permute_inst::update_output_memory() {
if (!can_be_optimized())
return;

View File

@ -219,8 +219,7 @@ reorder_inst::typed_primitive_inst(network& network, reorder_node const& node) :
parent(network, node, !node.can_be_optimized()
&& (node.get_output_layout().is_static() || node.get_output_layout().has_upper_bound()))
, _req_reinterpr(node.requires_reinterpret()) {
if (node.can_be_optimized())
reuse_input();
update_output_memory();
if (is_dynamic())
return;
@ -256,11 +255,6 @@ reorder_inst::typed_primitive_inst(network& network, reorder_node const& node) :
}
void reorder_inst::on_execute() {
if (can_be_optimized())
reuse_input();
}
void reorder_inst::reuse_input() {
update_output_memory();
}

View File

@ -182,25 +182,15 @@ reshape_inst::typed_primitive_inst(network& network, reshape_node const& node) :
_outputs = allocate_outputs();
_mem_allocated = true;
} else {
reuse_input();
update_output_memory();
}
} else {
if (_exec_deps.size() > 0 && input_memory_ptr())
reuse_input();
update_output_memory();
}
}
void reshape_inst::on_execute() {
if (!can_be_optimized())
return;
if (_outputs[0] && _network.get_engine().is_the_same_buffer(output_memory(), input_memory()))
return;
reuse_input();
}
void reshape_inst::reuse_input() {
update_output_memory();
}

View File

@ -59,10 +59,6 @@ void scatter_elements_update_inst::on_execute() {
auto input2_shape = _impl_params->input_layouts[2].get_partial_shape();
if ((ov::shape_size(input1_shape.to_shape()) == 0) || (ov::shape_size(input2_shape.to_shape()) == 0))
reuse_input();
}
void scatter_elements_update_inst::reuse_input() {
update_output_memory();
}

View File

@ -72,10 +72,6 @@ void scatter_nd_update_inst::on_execute() {
auto same_layouts = _impl_params->input_layouts[0] == _impl_params->output_layouts[0];
if (same_layouts && ((ov::shape_size(input1_shape.to_shape()) == 0) || (ov::shape_size(input2_shape.to_shape()) == 0)))
reuse_input();
}
void scatter_nd_update_inst::reuse_input() {
update_output_memory();
}

View File

@ -51,10 +51,6 @@ void scatter_update_inst::on_execute() {
auto input2_shape = _impl_params->input_layouts[2].get_partial_shape();
if ((ov::shape_size(input1_shape.to_shape()) == 0) || (ov::shape_size(input2_shape.to_shape()) == 0))
reuse_input();
}
void scatter_update_inst::reuse_input() {
update_output_memory();
}