Skip to content

Commit

Permalink
Merge branch 'master' of https://github.com/openvinotoolkit/openvino
Browse files Browse the repository at this point in the history
…into as/weights_bank_dq_update
  • Loading branch information
smirnov-alexey committed Oct 3, 2024
2 parents 52fc4cf + 2fc0fae commit d82f570
Show file tree
Hide file tree
Showing 26 changed files with 1,750 additions and 94 deletions.
39 changes: 14 additions & 25 deletions .github/workflows/job_pytorch_layer_tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,6 @@ on:
description: 'Machine on which the tests would run'
type: string
required: true
shell:
description: "shell to override the default shell settings in the runner's operating system."
type: string
required: true
container:
description: 'JSON to be converted to the value of the "container" configuration for the job'
type: string
Expand All @@ -20,12 +16,15 @@ on:
description: 'Components that are affected by changes in the commit defined by the Smart CI Action'
type: string
required: true
python-version:
description: 'Python version to setup. E.g., "3.11"'
type: string
required: true

permissions: read-all

env:
PIP_CACHE_PATH: /mount/caches/pip/linux
PYTHON_VERSION: '3.11'

jobs:
PyTorch_Layer_Tests:
Expand All @@ -35,7 +34,7 @@ jobs:
container: ${{ fromJSON(inputs.container) }}
defaults:
run:
shell: ${{ inputs.shell }}
shell: ${{ contains(inputs.runner, 'win') && 'pwsh' || 'bash' }}
env:
DEBIAN_FRONTEND: noninteractive # to prevent apt-get from waiting user input
OPENVINO_REPO: ${{ github.workspace }}/openvino
Expand All @@ -55,12 +54,6 @@ jobs:
name: openvino_tests
path: ${{ env.INSTALL_TEST_DIR }}

- name: Download OpenVINO tokenizers extension
uses: actions/download-artifact@fa0a91b85d4f404e444e00e005971372dc801d16 # v4.1.8
with:
name: openvino_tokenizers_wheel
path: ${{ env.INSTALL_DIR }}

# Needed as ${{ github.workspace }} is not working correctly when using Docker
- name: Setup Variables
if: runner.os != 'Windows'
Expand Down Expand Up @@ -98,10 +91,10 @@ jobs:
sparse-checkout-cone-mode: false
path: 'openvino'

- name: Setup Python ${{ env.PYTHON_VERSION }}
- name: Setup Python ${{ inputs.python-version }}
uses: ./openvino/.github/actions/setup_python
with:
version: ${{ env.PYTHON_VERSION }}
version: ${{ inputs.python-version }}
pip-cache-path: ${{ runner.os == 'Linux' && env.PIP_CACHE_PATH || '' }}
should-setup-pip-paths: ${{ runner.os == 'Linux' }}
self-hosted-runner: ${{ runner.os == 'Linux' }}
Expand All @@ -112,43 +105,39 @@ jobs:
# Install the core OV wheel
python3 -m pip install ${INSTALL_DIR}/tools/openvino-*.whl
# Install the core OV Tokenizers wheel
python3 -m pip install ${INSTALL_DIR}/openvino_tokenizers-*.whl
- name: Install OpenVINO Python wheels (Windows)
if: runner.os == 'Windows'
run: |
# Find and install the core OV wheel
$ovCoreWheelPath=Get-ChildItem -Path ${{ env.INSTALL_DIR }}\tools -Filter openvino-*.whl | % { $_.FullName }
python3 -m pip install "$ovCoreWheelPath"
# Find and install the core OV Tokenizers wheel
$ovCoreWheelPath=Get-ChildItem -Path ${{ env.INSTALL_DIR }} -Filter openvino_tokenizers-*.whl | % { $_.FullName }
python3 -m pip install "$ovCoreWheelPath"
- name: Install Pytorch Layer tests dependencies
run: |
# pytorch test requirements
python3 -m pip install -r ${{ env.INSTALL_TEST_DIR }}/requirements_pytorch
- name: PyTorch Layer Tests
if: ${{ fromJSON(inputs.affected-components).PyTorch_FE.test && runner.arch != 'ARM64' }} # Ticket: 126287, 142196
run: python3 -m pytest ${{ env.LAYER_TESTS_INSTALL_DIR }}/pytorch_tests -n logical -m precommit --junitxml=${{ env.INSTALL_TEST_DIR }}/TEST-pytorch.xml
# due to CVS-152795, parallel run is not possible on Windows
run: python3 -m pytest ${{ env.LAYER_TESTS_INSTALL_DIR }}/pytorch_tests ${PARALLEL} -m precommit --junitxml=${{ env.INSTALL_TEST_DIR }}/TEST-pytorch.xml
env:
TEST_DEVICE: CPU
TEST_PRECISION: FP32
PARALLEL: ${{ runner.os == 'Windows' && ' ' || '-n logical'}}

- name: PyTorch torch.export Layer Tests
if: ${{ fromJSON(inputs.affected-components).PyTorch_FE.test && runner.arch != 'ARM64' }} # Ticket: 126287
if: ${{ fromJSON(inputs.affected-components).PyTorch_FE.test && runner.arch != 'ARM64' && runner.os != 'Windows' }} # Ticket: 126287
run: |
python3 -m pytest ${{ env.LAYER_TESTS_INSTALL_DIR }}/pytorch_tests -n logical -m precommit_torch_export --junitxml=${{ env.INSTALL_TEST_DIR }}/TEST-pytorch.xml
python3 -m pytest ${{ env.LAYER_TESTS_INSTALL_DIR }}/pytorch_tests ${PARALLEL} -m precommit_torch_export --junitxml=${{ env.INSTALL_TEST_DIR }}/TEST-pytorch.xml
env:
TEST_DEVICE: CPU
TEST_PRECISION: FP32
PYTORCH_TRACING_MODE: EXPORT
PARALLEL: ${{ runner.os == 'Windows' && ' ' || '-n logical'}}

- name: PyTorch torch.compile TORCHFX Layer Tests
if: ${{ fromJSON(inputs.affected-components).PyTorch_FE.test && runner.os != 'macOS' && runner.arch != 'ARM64' }} # Ticket: 126287
if: ${{ fromJSON(inputs.affected-components).PyTorch_FE.test && runner.os != 'macOS' && runner.arch != 'ARM64' && runner.os != 'Windows' }} # Ticket: 126287
run: |
python3 -m pytest ${{ env.LAYER_TESTS_INSTALL_DIR }}/pytorch_tests -m precommit_fx_backend --junitxml=${{ env.INSTALL_TEST_DIR }}/TEST-pytorch.xml
env:
Expand Down
15 changes: 7 additions & 8 deletions .github/workflows/job_tensorflow_layer_tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,6 @@ on:
description: 'Machine on which the tests would run'
type: string
required: true
shell:
description: "shell to override the default shell settings in the runner's operating system."
type: string
required: true
container:
description: 'JSON to be converted to the value of the "container" configuration for the job'
type: string
Expand All @@ -20,12 +16,15 @@ on:
description: 'Components that are affected by changes in the commit defined by the Smart CI Action'
type: string
required: true
python-version:
description: 'Python version to setup. E.g., "3.11"'
type: string
required: true

permissions: read-all

env:
PIP_CACHE_PATH: /mount/caches/pip/linux
PYTHON_VERSION: '3.11'

jobs:
TensorFlow_Layer_Tests:
Expand All @@ -35,7 +34,7 @@ jobs:
container: ${{ fromJSON(inputs.container) }}
defaults:
run:
shell: ${{ inputs.shell }}
shell: ${{ contains(inputs.runner, 'win') && 'pwsh' || 'bash' }}
env:
DEBIAN_FRONTEND: noninteractive # to prevent apt-get from waiting user input
OPENVINO_REPO: ${{ github.workspace }}/openvino
Expand Down Expand Up @@ -98,10 +97,10 @@ jobs:
sparse-checkout-cone-mode: false
path: 'openvino'

- name: Setup Python ${{ env.PYTHON_VERSION }}
- name: Setup Python ${{ inputs.python-version }}
uses: ./openvino/.github/actions/setup_python
with:
version: ${{ env.PYTHON_VERSION }}
version: ${{ inputs.python-version }}
pip-cache-path: ${{ runner.os == 'Linux' && env.PIP_CACHE_PATH || '' }}
should-setup-pip-paths: ${{ runner.os == 'Linux' }}
self-hosted-runner: ${{ runner.os == 'Linux' }}
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/linux_arm64.yml
Original file line number Diff line number Diff line change
Expand Up @@ -173,19 +173,19 @@ jobs:
uses: ./.github/workflows/job_tensorflow_layer_tests.yml
with:
runner: 'aks-linux-16-cores-arm'
shell: bash
container: '{"image": "${{ fromJSON(needs.docker.outputs.images).ov_test.ubuntu_20_04_arm64 }}", "volumes": ["/mount:/mount"]}'
affected-components: ${{ needs.smart_ci.outputs.affected_components }}
python-version: '3.11'

Pytorch_Layer_Tests:
name: Pytorch Layer Tests
needs: [ Build, Docker, Smart_CI, Openvino_tokenizers ]
needs: [ Build, Docker, Smart_CI ]
uses: ./.github/workflows/job_pytorch_layer_tests.yml
with:
runner: 'aks-linux-16-cores-arm'
shell: bash
container: '{"image": "${{ fromJSON(needs.docker.outputs.images).ov_test.ubuntu_20_04_arm64 }}", "volumes": ["/mount:/mount"]}'
affected-components: ${{ needs.smart_ci.outputs.affected_components }}
python-version: '3.11'

CPU_Functional_Tests:
name: CPU functional tests
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/mac.yml
Original file line number Diff line number Diff line change
Expand Up @@ -276,17 +276,17 @@ jobs:
uses: ./.github/workflows/job_tensorflow_layer_tests.yml
with:
runner: 'macos-13'
shell: bash
affected-components: ${{ needs.smart_ci.outputs.affected_components }}
python-version: '3.11'

Pytorch_Layer_Tests:
name: Pytorch Layer Tests
needs: [ Build, Smart_CI, Openvino_tokenizers ]
needs: [ Build, Smart_CI ]
uses: ./.github/workflows/job_pytorch_layer_tests.yml
with:
runner: 'macos-13'
shell: bash
affected-components: ${{ needs.smart_ci.outputs.affected_components }}
python-version: '3.11'

CPU_Functional_Tests:
name: CPU functional tests
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/mac_arm64.yml
Original file line number Diff line number Diff line change
Expand Up @@ -275,17 +275,17 @@ jobs:
uses: ./.github/workflows/job_tensorflow_layer_tests.yml
with:
runner: 'macos-13-xlarge'
shell: bash
affected-components: ${{ needs.smart_ci.outputs.affected_components }}
python-version: '3.11'

Pytorch_Layer_Tests:
name: Pytorch Layer Tests
needs: [ Build, Smart_CI, Openvino_tokenizers ]
needs: [ Build, Smart_CI ]
uses: ./.github/workflows/job_pytorch_layer_tests.yml
with:
runner: 'macos-13-xlarge'
shell: bash
affected-components: ${{ needs.smart_ci.outputs.affected_components }}
python-version: '3.11'

CPU_Functional_Tests:
name: CPU functional tests
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/ubuntu_22.yml
Original file line number Diff line number Diff line change
Expand Up @@ -305,19 +305,19 @@ jobs:
uses: ./.github/workflows/job_tensorflow_layer_tests.yml
with:
runner: 'aks-linux-4-cores-16gb'
shell: bash
container: '{"image": "${{ fromJSON(needs.docker.outputs.images).ov_test.ubuntu_22_04_x64 }}", "volumes": ["/mount:/mount"]}'
affected-components: ${{ needs.smart_ci.outputs.affected_components }}
python-version: '3.11'

Pytorch_Layer_Tests:
name: Pytorch Layer Tests
needs: [ Docker, Build, Smart_CI, Openvino_tokenizers ]
needs: [ Docker, Build, Smart_CI ]
uses: ./.github/workflows/job_pytorch_layer_tests.yml
with:
runner: 'aks-linux-4-cores-16gb'
shell: bash
container: '{"image": "${{ fromJSON(needs.docker.outputs.images).ov_test.ubuntu_22_04_x64 }}", "volumes": ["/mount:/mount"]}'
affected-components: ${{ needs.smart_ci.outputs.affected_components }}
python-version: '3.11'

CPU_Functional_Tests:
name: CPU functional tests
Expand Down
10 changes: 10 additions & 0 deletions .github/workflows/ubuntu_24.yml
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,16 @@ jobs:
affected-components: ${{ needs.smart_ci.outputs.affected_components }}
python-version: '3.12'

Pytorch_Layer_Tests:
name: Pytorch Layer Tests
needs: [ Docker, Build, Smart_CI ]
uses: ./.github/workflows/job_pytorch_layer_tests.yml
with:
runner: 'aks-linux-4-cores-16gb'
container: '{"image": "${{ fromJSON(needs.docker.outputs.images).ov_test.ubuntu_24_04_x64 }}", "volumes": ["/mount:/mount"]}'
affected-components: ${{ needs.smart_ci.outputs.affected_components }}
python-version: '3.12'

Overall_Status:
name: ci/gha_overall_status_ubuntu_24
needs: [Smart_CI, Build, Debian_Packages, Samples, Python_Unit_Tests]
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/windows_vs2019_release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -404,17 +404,17 @@ jobs:
uses: ./.github/workflows/job_tensorflow_layer_tests.yml
with:
runner: 'aks-win-8-cores-16gb'
shell: pwsh
affected-components: ${{ needs.smart_ci.outputs.affected_components }}
python-version: '3.11'

Pytorch_Layer_Tests:
name: Pytorch Layer Tests
needs: [ Build, Smart_CI, Openvino_tokenizers ]
needs: [ Build, Smart_CI ]
uses: ./.github/workflows/job_pytorch_layer_tests.yml
with:
runner: 'aks-win-8-cores-16gb'
shell: pwsh
affected-components: ${{ needs.smart_ci.outputs.affected_components }}
python-version: '3.11'

CXX_Unit_Tests:
name: C++ unit tests
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ NPU Device
:hidden:

npu-device/remote-tensor-api-npu-plugin
npu-device/batching-on-npu-plugin


The Neural Processing Unit is a low-power hardware solution, introduced with the
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
NPU Plugin Batching
===============================


.. meta::
:description: OpenVINO™ NPU plugin supports batching
either by executing concurrent inferences or by
relying on native compiler support for batching.

OpenVINO™ NPU plugin supports batching either by executing concurrent inferences or by relying on native compiler support for batching.

First, the NPU plugin checks if the following conditions are met:

* The batch size is on the first axis.
* All inputs and outputs have the same batch size.
* The model does not contain states.

**If the conditions are met**, the NPU plugin attempts to compile and execute the original model with batch_size forced to 1. This approach is due to current compiler limitations and ongoing work to improve performance for batch_size greater than one.
If the compilation is successful, the plugin detects a difference in batch size between the original model layout (with a batch size set to N)
and the transformed/compiled layout (with a batch size set to 1). Then it executes the following steps:

1. Internally constructs multiple command lists, one for each input.
2. Executes each command list for the proper offsets of input/output buffers.
3. Notifies the user of the completion of the inference request after all command lists have been executed.

This concurrency-based batching mode is transparent to the application. A single inference request handles all inputs from the batch.
While performance may be lower compared to regular batching (based on native compiler support), this mode provides basic batching functionality for use either with older drivers
or when the model cannot yet be compiled with a batch size larger than one.

**If the conditions are not met**, the NPU plugin tries to compile and execute the original model with the given
batch_size to N as any other regular model.

.. note::

With future performance improvements and support for compiling multiple models with a batch size larger
than one, the default order will change. NPU will try first to compile and execute the original model with the
given batch size and fall back to concurrent batching if compilation fails.
30 changes: 29 additions & 1 deletion src/frontends/tensorflow_common/src/op/expand_dims.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,13 @@
//

#include "common_op_table.hpp"
#include "helper_ops/complex_type_mark.hpp"
#include "openvino/op/constant.hpp"
#include "openvino/op/less.hpp"
#include "openvino/op/select.hpp"
#include "openvino/op/subtract.hpp"
#include "openvino/op/unsqueeze.hpp"
#include "utils.hpp"

using namespace std;
using namespace ov::op;
Expand All @@ -14,9 +20,31 @@ namespace tensorflow {
namespace op {

OutputVector translate_expand_dims_op(const NodeContext& node) {
default_op_checks(node, 2, {"ExpandDims", "EXPAND_DIMS"});
default_op_checks(node, 2, {"ExpandDims", "EXPAND_DIMS"}, true);
auto input = node.get_input(0);
auto axis = node.get_input(1);
auto complex_type_mark = as_type_ptr<ComplexTypeMark>(input.get_node_shared_ptr());

if (complex_type_mark) {
element::Type complex_part_type = complex_type_mark->get_complex_part_type();
input = complex_type_mark->input_value(0);

auto const_zero = create_same_type_const_scalar<int32_t>(axis, 0);

auto is_axis_neg = make_shared<v1::Less>(axis, const_zero);

auto const_one = create_same_type_const_scalar<int32_t>(axis, 1);
auto axis_min_one = make_shared<v1::Subtract>(axis, const_one);

auto new_axis = make_shared<v1::Select>(is_axis_neg, axis_min_one, axis);

auto unsqueeze = make_shared<v0::Unsqueeze>(input, new_axis);

set_node_name(node.get_name(), unsqueeze);
auto complex_result = make_shared<ComplexTypeMark>(unsqueeze, complex_part_type);
return {complex_result};
}

auto unsqueeze = make_shared<v0::Unsqueeze>(input, axis);
set_node_name(node.get_name(), unsqueeze);
return {unsqueeze};
Expand Down
Loading

0 comments on commit d82f570

Please sign in to comment.