Skip to content

Commit

Permalink
Merge branch 'master' into feature/snippets/aarch64/prelu_sqrt_round
Browse files Browse the repository at this point in the history
  • Loading branch information
0xfedcafe authored Dec 30, 2024
2 parents e99c576 + 3ce61d6 commit 3f98c11
Show file tree
Hide file tree
Showing 1,472 changed files with 201 additions and 163,501 deletions.
1 change: 0 additions & 1 deletion .github/workflows/linux_riscv.yml
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,6 @@ jobs:
git submodule update --init -- ${OPENVINO_REPO}/thirdparty/gflags
git submodule update --init -- ${OPENVINO_REPO}/thirdparty/telemetry
git submodule update --init -- ${OPENVINO_REPO}/src/plugins/intel_cpu
git submodule update --init -- ${OPENVINO_REPO}/thirdparty/open_model_zoo
git submodule update --init -- ${OPENVINO_REPO}/thirdparty/flatbuffers/flatbuffers
popd
Expand Down
3 changes: 0 additions & 3 deletions .gitmodules
Original file line number Diff line number Diff line change
Expand Up @@ -52,9 +52,6 @@
[submodule "thirdparty/onednn_gpu"]
path = src/plugins/intel_gpu/thirdparty/onednn_gpu
url = https://github.com/oneapi-src/oneDNN.git
[submodule "tools/pot/thirdparty/open_model_zoo"]
path = thirdparty/open_model_zoo
url = https://github.com/openvinotoolkit/open_model_zoo.git
[submodule "thirdparty/json/nlohmann_json"]
path = thirdparty/json/nlohmann_json
url = https://github.com/nlohmann/json.git
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,19 +63,19 @@ the model precision and the ratio of P-cores and E-cores.

Then the default settings for low-level performance properties on Windows and Linux are as follows:

+--------------------------------------+-----------------------------------------------------------------------+-----------------------------------------------------------------------+
| Property | Windows | Linux |
+======================================+=======================================================================+=======================================================================+
| ``ov::num_streams`` | 1 | 1 |
+--------------------------------------+-----------------------------------------------------------------------+-----------------------------------------------------------------------+
| ``ov::inference_num_threads`` | is equal to the number of P-cores or P-cores+E-cores on one numa node | is equal to the number of P-cores or P-cores+E-cores on one numa node |
+--------------------------------------+-----------------------------------------------------------------------+-----------------------------------------------------------------------+
| ``ov::hint::scheduling_core_type`` | :ref:`Core Type Table of Latency Hint <core_type_latency>` | :ref:`Core Type Table of Latency Hint <core_type_latency>` |
+--------------------------------------+-----------------------------------------------------------------------+-----------------------------------------------------------------------+
| ``ov::hint::enable_hyper_threading`` | No | No |
+--------------------------------------+-----------------------------------------------------------------------+-----------------------------------------------------------------------+
| ``ov::hint::enable_cpu_pinning`` | No / Not Supported | Yes except using P-cores and E-cores together |
+--------------------------------------+-----------------------------------------------------------------------+-----------------------------------------------------------------------+
+--------------------------------------+--------------------------------------------------------------------+--------------------------------------------------------------------+
| Property | Windows | Linux |
+======================================+====================================================================+====================================================================+
| ``ov::num_streams`` | 1 | 1 |
+--------------------------------------+--------------------------------------------------------------------+--------------------------------------------------------------------+
| ``ov::inference_num_threads`` | is equal to the number of P-cores or P-cores+E-cores on one socket | is equal to the number of P-cores or P-cores+E-cores on one socket |
+--------------------------------------+--------------------------------------------------------------------+--------------------------------------------------------------------+
| ``ov::hint::scheduling_core_type`` | :ref:`Core Type Table of Latency Hint <core_type_latency>` | :ref:`Core Type Table of Latency Hint <core_type_latency>` |
+--------------------------------------+--------------------------------------------------------------------+--------------------------------------------------------------------+
| ``ov::hint::enable_hyper_threading`` | No | No |
+--------------------------------------+--------------------------------------------------------------------+--------------------------------------------------------------------+
| ``ov::hint::enable_cpu_pinning`` | No / Not Supported | Yes except using P-cores and E-cores together |
+--------------------------------------+--------------------------------------------------------------------+--------------------------------------------------------------------+

.. note::

Expand All @@ -96,7 +96,7 @@ Then the default settings for low-level performance properties on Windows and Li
Starting from 5th Gen Intel Xeon Processors, new microarchitecture enabled new sub-NUMA clusters
feature. A sub-NUMA cluster (SNC) can create two or more localization domains (numa nodes)
within a socket by BIOS configuration.
By default OpenVINO with latency hint uses single NUMA node for inference. Although such
By default OpenVINO with latency hint uses single socket for inference. Although such
behavior allows to achive best performance for most of the models, there might be corner
cases which require manual tuning of ``ov::num_streams`` and ``ov::hint::enable_hyper_threading parameters``.
Please find more detail about `Sub-NUMA Clustering <https://www.intel.com/content/www/us/en/developer/articles/technical/xeon-processor-scalable-family-technical-overview.html>`__
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -126,33 +126,36 @@ def process_coveo_meta(meta, url, link):
if tag_name == 'ovdoctype':
ET.SubElement(namespace_element, tag_name).text = process_link(link)
elif tag_name == 'ovcategory' and loc_element is not None:
ET.SubElement(namespace_element, tag_name).text = extract_hierarchy(loc_element.text)
ET.SubElement(namespace_element, tag_name).text = extract_categories(loc_element.text)
elif tag_name == 'ovversion':
ET.SubElement(namespace_element, tag_name).text = tag_value

def process_link(link):
if '/' in link:
return link.split('/')[0].replace("-", " ")
return link.split('.html')[0].replace("-", " ")
return format_segment(link.split('/')[0].replace("-", " "))
return format_segment(link.split('.html')[0].replace("-", " "))

def extract_hierarchy(link):
def extract_categories(link):
path = link.split("://")[-1]
segments = path.split('/')[1:]
if segments and segments[-1].endswith('.html'):
segments = segments[:-1]

if segments:
segments = segments[1:]

if segments and '.' in segments[0]:
year, *rest = segments[0].split('.')
if year.isdigit() and len(year) == 4:
segments[0] = year

segments = [format_segment(segment) for segment in segments]

hierarchy = []
for i in range(1, len(segments) + 1):
hierarchy.append('|'.join(segments[:i]))

return ';'.join(hierarchy)
if segments:
hierarchy = ['|'.join(segments[:i]) for i in range(1, len(segments) + 1)]
return ';'.join(hierarchy)
return "No category"

def format_segment(segment):
if segment == 'c_cpp_api': segment = 'C/C++_api'
Expand Down
4 changes: 2 additions & 2 deletions src/frontends/paddle/src/default_opset.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,13 @@
// SPDX-License-Identifier: Apache-2.0
//

#include "openvino/opsets/opset9.hpp"
#include "openvino/opsets/opset14.hpp"

namespace ov {
namespace frontend {
namespace paddle {
namespace op {
namespace default_opset = ov::opset9;
namespace default_opset = ov::opset14;

} // namespace op
} // namespace paddle
Expand Down
23 changes: 23 additions & 0 deletions src/frontends/paddle/src/op/elu.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
// Copyright (C) 2018-2024 Intel Corporation
// SPDX-License-Identifier: Apache-2.0
//

#include "default_opset.hpp"
#include "openvino/frontend/paddle/node_context.hpp"
#include "openvino/frontend/paddle/visibility.hpp"

namespace ov {
namespace frontend {
namespace paddle {
namespace op {
NamedOutputs elu(const NodeContext& node) {
auto data = node.get_input("X");
auto alpha = node.get_attribute<float>("alpha", 1.0);
const auto& elu_node = std::make_shared<default_opset::Elu>(data, alpha);
return node.default_single_output_mapping({elu_node}, {"Out"});
}

} // namespace op
} // namespace paddle
} // namespace frontend
} // namespace ov
10 changes: 9 additions & 1 deletion src/frontends/paddle/src/op/expand_v2.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,16 @@ NamedOutputs expand_v2(const NodeContext& node) {
auto inputs = node.get_ng_inputs("expand_shapes_tensor");
ov::NodeVector node_vec;
for (auto& input : inputs) {
if (input.get_partial_shape().rank().get_length() == 0) {
// should unsqueeze the input with non-shape.
auto unsqueeze_scalar = default_opset::Constant::create(ov::element::i32, {}, {0});
input = std::make_shared<default_opset::Unsqueeze>(input, unsqueeze_scalar);
}
PADDLE_OP_CHECK(node,
input.get_partial_shape().rank().get_length() == 1,
"the rank of conv input must == 1");
auto cast = std::make_shared<Convert>(input, element::i32);
node_vec.push_back(cast);
node_vec.emplace_back(cast);
}
shape_expected_node = std::make_shared<Concat>(node_vec, 0);
} else {
Expand Down
36 changes: 36 additions & 0 deletions src/frontends/paddle/src/op/eye.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
// Copyright (C) 2018-2024 Intel Corporation
// SPDX-License-Identifier: Apache-2.0
//

#include "default_opset.hpp"
#include "openvino/frontend/paddle/node_context.hpp"

namespace ov {
namespace frontend {
namespace paddle {
namespace op {
NamedOutputs eye(const NodeContext& node) {
auto row = node.get_attribute<int64_t>("num_rows");
auto col = node.get_attribute<int64_t>("num_columns", row);
auto dtype = node.get_attribute<ov::element::Type>("dtype", ov::element::f32);

const auto& row_node = std::make_shared<default_opset::Constant>(ov::element::i64, Shape{}, (row));
const auto& col_node = std::make_shared<default_opset::Constant>(ov::element::i64, Shape{}, (col));
const auto& diagonal_index_node = std::make_shared<default_opset::Constant>(ov::element::i32, Shape{}, (0));

std::shared_ptr<Node> out_node;
if (dtype == ov::element::i32 || dtype == ov::element::i64) {
out_node = std::make_shared<default_opset::Eye>(row_node, col_node, diagonal_index_node, dtype);
} else {
const auto& eye_node =
std::make_shared<default_opset::Eye>(row_node, col_node, diagonal_index_node, ov::element::i32);
out_node = std::make_shared<default_opset::Convert>(eye_node, dtype);
}

return node.default_single_output_mapping({out_node}, {"Out"});
}

} // namespace op
} // namespace paddle
} // namespace frontend
} // namespace ov
4 changes: 4 additions & 0 deletions src/frontends/paddle/src/op/fill_constant.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,10 @@ NamedOutputs fill_constant(const NodeContext& node) {
PADDLE_OP_CHECK(node, false, "fill_constant only supports i32, f32, i64");
}

if (shape.empty()) {
shape.emplace_back(1);
}

PADDLE_OP_CHECK(node,
shape.size() > 0 || node.has_input("ShapeTensor") || node.has_input("ShapeTensorList"),
"fill_constant shape not set");
Expand Down
6 changes: 4 additions & 2 deletions src/frontends/paddle/src/op/interp.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

#include "default_opset.hpp"
#include "openvino/frontend/paddle/node_context.hpp"
#include "openvino/opsets/opset4.hpp"

namespace ov {
namespace frontend {
Expand Down Expand Up @@ -147,8 +148,9 @@ static NamedOutputs interpolate(const NodeContext& node,
attrs.pads_begin = {0, 0, 0, 0};
attrs.pads_end = {0, 0, 0, 0};

return node.default_single_output_mapping({std::make_shared<Interpolate>(x, target_spatial_shape, scales, attrs)},
{"Out"});
return node.default_single_output_mapping(
{std::make_shared<ov::opset4::Interpolate>(x, target_spatial_shape, scales, attrs)},
{"Out"});
}

NamedOutputs linear_interp_v2(const NodeContext& node) {
Expand Down
4 changes: 4 additions & 0 deletions src/frontends/paddle/src/op/reduce_ops.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,10 @@ NamedOutputs reduce_ops(const NodeContext& node) {
dims = node.get_attribute<std::vector<int64_t>>("dim");
}

std::transform(dims.begin(), dims.end(), dims.begin(), [&input_rank](int64_t value) {
return value >= 0 ? value : value + input_rank;
});

int64_t axis_size = static_cast<int64_t>(dims.size());
reduce_all = reduce_all || (axis_size == input_rank || axis_size == 0);

Expand Down
4 changes: 4 additions & 0 deletions src/frontends/paddle/src/op_table.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -39,9 +39,11 @@ OP_CONVERTER(elementwise_sub);
OP_CONVERTER(equal);
OP_CONVERTER(greater_equal);
OP_CONVERTER(not_equal);
OP_CONVERTER(elu);
OP_CONVERTER(embedding);
OP_CONVERTER(exp);
OP_CONVERTER(expand_v2);
OP_CONVERTER(eye);
OP_CONVERTER(flip);
OP_CONVERTER(flatten_contiguous_range);
OP_CONVERTER(floor);
Expand Down Expand Up @@ -173,9 +175,11 @@ std::map<std::string, CreatorFunction> get_supported_ops() {
{"elementwise_sub", op::elementwise_sub},
{"dropout", op::dropout},
{"elementwise_pow", op::elementwise_pow},
{"elu", op::elu},
{"equal", op::equal},
{"exp", op::exp},
{"expand_v2", op::expand_v2},
{"eye", op::eye},
{"fill_any_like", op::fill_any_like},
{"fill_constant", op::fill_constant},
{"fill_constant_batch_size_like", op::fill_constant_batch_size_like},
Expand Down
4 changes: 4 additions & 0 deletions src/frontends/paddle/tests/op_fuzzy.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -188,6 +188,7 @@ static const std::vector<std::string> models{
std::string("elementwise_floordiv_int64_2/elementwise_floordiv_int64_2.pdmodel"),
std::string("elementwise_floordiv_int64_3/elementwise_floordiv_int64_3.pdmodel"),
std::string("elementwise_mul_bool1/elementwise_mul_bool1.pdmodel"),
std::string("elu/elu.pdmodel"),
std::string("embedding_0/embedding_0.pdmodel"),
std::string("embedding_sparse/embedding_sparse.pdmodel"),
std::string("embedding_none_weight/embedding_none_weight.pdmodel"),
Expand All @@ -201,6 +202,9 @@ static const std::vector<std::string> models{
std::string("expand_v2_tensor_list/expand_v2_tensor_list.pdmodel"),
std::string("expand_v2_tensor_list2/expand_v2_tensor_list2.pdmodel"),
std::string("exp_test_float32/exp_test_float32.pdmodel"),
std::string("eye/eye.pdmodel"),
std::string("eye_int32/eye_int32.pdmodel"),
std::string("eye_int64/eye_int64.pdmodel"),
std::string("flip_1/flip_1.pdmodel"),
std::string("flip_2/flip_2.pdmodel"),
std::string("flip_3/flip_3.pdmodel"),
Expand Down
44 changes: 44 additions & 0 deletions src/frontends/paddle/tests/test_models/gen_scripts/generate_elu.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
# Copyright (C) 2018-2024 Intel Corporation
# SPDX-License-Identifier: Apache-2.0

#
# relu6 paddle model generator
#
import numpy as np
from save_model import saveModel
import paddle
import sys


def elu(name: str, x, alpha=None, data_type='float32'):
paddle.enable_static()

with paddle.static.program_guard(paddle.static.Program(), paddle.static.Program()):
node_x = paddle.static.data(name='x', shape=x.shape, dtype=data_type)

if paddle.__version__ >= '2.0.0':
out = paddle.nn.functional.elu(node_x, alpha, name='elu')
else:
out = paddle.fluid.layers.elu(node_x, alpha, name='elu')
cpu = paddle.static.cpu_places(1)
exe = paddle.static.Executor(cpu[0])
# startup program will call initializer to initialize the parameters.
exe.run(paddle.static.default_startup_program())

outs = exe.run(
feed={'x': x},
fetch_list=[out])

saveModel(name, exe, feed_vars=[node_x], fetchlist=[out],
inputs=[x], outputs=[outs[0]], target_dir=sys.argv[1])

return outs[0]


def main():
data_type = 'float32'
data = np.random.randn(2, 3, 4).astype('float32')
elu("elu", data)

if __name__ == "__main__":
main()
41 changes: 41 additions & 0 deletions src/frontends/paddle/tests/test_models/gen_scripts/generate_eye.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
# Copyright (C) 2018-2024 Intel Corporation
# SPDX-License-Identifier: Apache-2.0

#
# fill_const paddle model generator
#
import numpy as np
from save_model import saveModel
import paddle
import sys


def eye(name : str, rows, cols = None, dtype = None):
paddle.enable_static()
with paddle.static.program_guard(paddle.static.Program(), paddle.static.Program()):
if paddle.__version__ >= '2.0.0':
x1 = paddle.eye(num_rows=rows, num_columns=cols, dtype=dtype, name='fill')
x2 = paddle.eye(num_rows=rows, num_columns=cols, dtype=dtype, name='fill')
else:
x1 = paddle.fluid.layers.eye(num_rows=rows, num_columns=cols, dtype=dtype, name='fill_constant')
x2 = paddle.fluid.layers.eye(num_rows=rows, num_columns=cols, dtype=dtype, name='fill_constant')
out = paddle.add(x1, x2)
cpu = paddle.static.cpu_places(1)
exe = paddle.static.Executor(cpu[0])
# startup program will call initializer to initialize the parameters.
exe.run(paddle.static.default_startup_program())

outs = exe.run(
fetch_list=[out])

saveModel(name, exe, feed_vars=[], fetchlist=[out], inputs=[], outputs=[outs[0]], target_dir=sys.argv[1])

return outs[0]

def main():
eye("eye", 3)
eye("eye_int32", 2, 3, "int32")
eye("eye_int64", 2, 3, "int64")

if __name__ == "__main__":
main()
1 change: 0 additions & 1 deletion thirdparty/open_model_zoo
Submodule open_model_zoo deleted from e7df86
8 changes: 0 additions & 8 deletions tools/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,18 +5,10 @@
# Python tools
#

# MO

add_subdirectory(mo)

if(ENABLE_PYTHON)
# Benchmark Tool
add_subdirectory(benchmark_tool)

# OpenVino Conversion Tool
add_subdirectory(ovc)
endif()

# wheel openvino-dev

add_subdirectory(openvino_dev)
Loading

0 comments on commit 3f98c11

Please sign in to comment.