[GPU] Do not add post reorder for inputs if data type does not change (#18797)

* Remove reorders of inputs for KV cache

* Fix failed CI TC for ov_gpu_func_tests
This commit is contained in:
Andrew Kwangwoong Park 2023-07-28 12:50:04 +09:00 committed by GitHub
parent acb7e870ce
commit aba2770921
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 17 additions and 2 deletions

View File

@ -367,6 +367,10 @@ std::shared_ptr<ngraph::Function> Graph::GetExecGraphInfoByPrimitivesInfo(std::v
auto param = std::make_shared<ngraph::op::Parameter>(out_et, out_pshape);
params.push_back(param);
return_node = param;
// create additional result node if parameter is output without post reorder
if (is_output) {
results.emplace_back(std::make_shared<ngraph::op::Result>(return_node->get_default_output()));
}
} else {
return_node = std::make_shared<ov::exec_model_info::ExecutionNode>(get_inputs(prim_info), output_size);

View File

@ -206,13 +206,24 @@ static void CreateParameterOp(Program& p, const std::shared_ptr<ngraph::op::v0::
} else {
auto preprocessPrimID = "reorder:" + inputName + Program::m_preProcessTag;
cldnn::layout inputLayout(networkInputLayout);
inputLayout.data_type = DataTypeFromPrecision(ip);
auto network_input_data_type = DataTypeFromPrecision(ip);
inputLayout.data_type = network_input_data_type;
p.inputLayouts.insert({ inputInfo->name(), inputLayout });
p.add_primitive(*op, cldnn::input_layout(inputName, inputLayout));
switch (preProcess.getMeanVariant()) {
case NONE:
case NONE: {
// If mean value is not specified and the data type does not change, do not add post reorder
if (network_input_data_type != networkInputLayout.data_type) {
p.add_primitive(*op, cldnn::reorder(preprocessPrimID,
cldnn::input_info(inputName),
networkInputLayout,
meanValues,
cldnn::reorder_mean_mode::none), {inputName});
}
break;
}
case MEAN_VALUE: {
p.add_primitive(*op, cldnn::reorder(preprocessPrimID,
cldnn::input_info(inputName),