diff --git a/.github/actions/common/constants.py b/.github/actions/common/constants.py index 6a1d165fc7df13..a9ed34ce7a2275 100644 --- a/.github/actions/common/constants.py +++ b/.github/actions/common/constants.py @@ -16,6 +16,8 @@ class EventType(Enum): 'public_linux_ubuntu_24_04_x86_64_release', 'public_windows_vs2019_Release', 'public_windows_vs2019_Debug', + 'public_windows_vs2022_Release', + 'public_windows_vs2022_Debug', 'public_manylinux2014_x86_64_release', ) ProductType = Enum('ProductType', {t.upper(): t for t in productTypes}) @@ -41,5 +43,5 @@ class EventType(Enum): PlatformKey.UBUNTU20_ARM64: ProductType.PUBLIC_LINUX_UBUNTU_20_04_ARM64_RELEASE, PlatformKey.UBUNTU22_X86_64: ProductType.PUBLIC_LINUX_UBUNTU_22_04_X86_64_RELEASE, PlatformKey.UBUNTU24_X86_64: ProductType.PUBLIC_LINUX_UBUNTU_24_04_X86_64_RELEASE, - PlatformKey.WINDOWS_X86_64: ProductType.PUBLIC_WINDOWS_VS2019_RELEASE, + PlatformKey.WINDOWS_X86_64: ProductType.PUBLIC_WINDOWS_VS2022_RELEASE, } diff --git a/.github/actions/setup_python/action.yml b/.github/actions/setup_python/action.yml index ce85be46ced17e..507c52d8a69efa 100644 --- a/.github/actions/setup_python/action.yml +++ b/.github/actions/setup_python/action.yml @@ -15,10 +15,6 @@ inputs: description: 'If the runner is self-hosted' required: false default: 'true' - show-cache-info: - description: 'If the action should show the share space occupied by cache' - required: false - default: 'false' runs: using: 'composite' steps: @@ -75,8 +71,3 @@ runs: $pipVersion = python3 -c "import pip; print(pip.__version__)" Write-Host "Using pip version: $pipVersion" "PIP_CACHE_DIR=${{ inputs.pip-cache-path }}/$pipVersion" >> $env:GITHUB_ENV - - - if: ${{ inputs.show-cache-info == 'true' }} - name: Get pip cache info - shell: bash - run: python3 -m pip cache info diff --git a/.github/github_org_control/check_org.py b/.github/github_org_control/check_org.py index ab59d05066a630..7dd256e4c1fef8 100644 --- a/.github/github_org_control/check_org.py +++ b/.github/github_org_control/check_org.py @@ -1,4 +1,4 @@ -# Copyright (C) 2018-2021 Intel Corporation +# Copyright (C) 2018-2025 Intel Corporation # SPDX-License-Identifier: Apache-2.0 """ diff --git a/.github/github_org_control/check_pr.py b/.github/github_org_control/check_pr.py index 08cf6f4b4dbfff..79db5940e24a58 100644 --- a/.github/github_org_control/check_pr.py +++ b/.github/github_org_control/check_pr.py @@ -1,4 +1,4 @@ -# Copyright (C) 2018-2021 Intel Corporation +# Copyright (C) 2018-2025 Intel Corporation # SPDX-License-Identifier: Apache-2.0 """ diff --git a/.github/github_org_control/configs.py b/.github/github_org_control/configs.py index 3df12803c77de0..be93540cd4aa03 100644 --- a/.github/github_org_control/configs.py +++ b/.github/github_org_control/configs.py @@ -1,4 +1,4 @@ -# Copyright (C) 2018-2021 Intel Corporation +# Copyright (C) 2018-2025 Intel Corporation # SPDX-License-Identifier: Apache-2.0 """ diff --git a/.github/github_org_control/github_api.py b/.github/github_org_control/github_api.py index 6f9d14c5376742..581921f3943a1e 100644 --- a/.github/github_org_control/github_api.py +++ b/.github/github_org_control/github_api.py @@ -1,4 +1,4 @@ -# Copyright (C) 2018-2021 Intel Corporation +# Copyright (C) 2018-2025 Intel Corporation # SPDX-License-Identifier: Apache-2.0 """ diff --git a/.github/github_org_control/ldap_api.py b/.github/github_org_control/ldap_api.py index c0f7e2c18117ff..3c68242c40cf75 100644 --- a/.github/github_org_control/ldap_api.py +++ b/.github/github_org_control/ldap_api.py @@ -1,4 +1,4 @@ -# Copyright (C) 2018-2021 Intel Corporation +# Copyright (C) 2018-2025 Intel Corporation # SPDX-License-Identifier: Apache-2.0 """ diff --git a/.github/scripts/workflow_rerun/errors_to_look_for.json b/.github/scripts/workflow_rerun/errors_to_look_for.json index 8e45212a89a6f0..55b46f9df1b1bb 100644 --- a/.github/scripts/workflow_rerun/errors_to_look_for.json +++ b/.github/scripts/workflow_rerun/errors_to_look_for.json @@ -110,5 +110,13 @@ { "error_text": "download failed after attempts", "ticket": 159547 + }, + { + "error_text": "Failed to connect to github.com port 443: Connection refused", + "ticket": 156593 + }, + { + "error_text": "file DOWNLOAD cannot compute hash on failed download", + "ticket": 156593 } ] \ No newline at end of file diff --git a/.github/workflows/build_doc.yml b/.github/workflows/build_doc.yml index df85b1ef3aa385..b0739432f29066 100644 --- a/.github/workflows/build_doc.yml +++ b/.github/workflows/build_doc.yml @@ -64,7 +64,7 @@ jobs: - name: Cache documentation id: cache_sphinx_docs - uses: actions/cache@6849a6489940f00c2f30c0fb92c6274307ccb58a # v4.1.2 + uses: actions/cache@1bd1e32a3bdc45362d1e726936510720a7c30a57 # v4.2.0 with: path: build/docs/_build/.doctrees key: sphinx-docs-cache @@ -78,13 +78,13 @@ jobs: echo "PR_NUMBER=$PR_NUMBER" >> $GITHUB_ENV - name: 'Upload sphinx.log' - uses: actions/upload-artifact@v4.6.0 + uses: actions/upload-artifact@b4b15b8c7c6ac21ea08fcf65892d2ee8f75cf882 # v4.4.3 with: name: sphinx_build_log_${{ env.PR_NUMBER }}.log path: build/docs/sphinx.log - name: 'Upload docs html' - uses: actions/upload-artifact@v4.6.0 + uses: actions/upload-artifact@b4b15b8c7c6ac21ea08fcf65892d2ee8f75cf882 # v4.4.3 with: name: openvino_docs_html_${{ env.PR_NUMBER }}.zip path: build/docs/openvino_docs_html.zip @@ -101,7 +101,7 @@ jobs: - name: 'Upload test results' if: failure() - uses: actions/upload-artifact@v4.6.0 + uses: actions/upload-artifact@b4b15b8c7c6ac21ea08fcf65892d2ee8f75cf882 # v4.4.3 with: name: openvino_docs_pytest path: build/docs/_artifacts/ diff --git a/.github/workflows/code_style.yml b/.github/workflows/code_style.yml index 3969da2b97c5a1..89fb4e64670d8d 100644 --- a/.github/workflows/code_style.yml +++ b/.github/workflows/code_style.yml @@ -24,9 +24,11 @@ jobs: sudo apt update sudo apt --assume-yes install clang-format-15 - # Run cmake with -DENABLE_PROFILING_ITT=ON -DSELECTIVE_BUILD=COLLECT in order to enable codestyle check for ITT collector + # Run cmake with extra options to cover as much source code as possible: + # - -DENABLE_PROFILING_ITT=ON -DSELECTIVE_BUILD=COLLECT to enable codestyle check for ITT collector + # - -DENABLE_SNIPPETS_LIBXSMM_TPP to cover snippets TPP adaptation - name: CMake configure - run: cmake -DENABLE_PYTHON=ON -DENABLE_TESTS=ON -DENABLE_PROFILING_ITT=ON -DSELECTIVE_BUILD=COLLECT -B build + run: cmake -DENABLE_PYTHON=ON -DENABLE_TESTS=ON -DENABLE_PROFILING_ITT=ON -DSELECTIVE_BUILD=COLLECT -DENABLE_SNIPPETS_LIBXSMM_TPP=ON -B build - name: Create code style diff run: cmake --build build --target clang_format_fix_all -j8 @@ -54,9 +56,11 @@ jobs: sudo apt update sudo apt --assume-yes install binutils-aarch64-linux-gnu gcc-aarch64-linux-gnu g++-aarch64-linux-gnu scons clang-format-15 - # Run cmake with -DENABLE_PROFILING_ITT=ON -DSELECTIVE_BUILD=COLLECT in order to enable codestyle check for ITT collector + # Run cmake with extra options to cover as much source code as possible: + # - -DENABLE_PROFILING_ITT=ON -DSELECTIVE_BUILD=COLLECT to enable codestyle check for ITT collector + # - -DENABLE_SNIPPETS_LIBXSMM_TPP to cover snippets TPP adaptation - name: CMake configure - run: cmake -DENABLE_CLANG_FORMAT=ON -DENABLE_TESTS=ON -DENABLE_PROFILING_ITT=ON -DSELECTIVE_BUILD=COLLECT -DCMAKE_TOOLCHAIN_FILE=cmake/arm64.toolchain.cmake -B build_arm64 + run: cmake -DENABLE_CLANG_FORMAT=ON -DENABLE_TESTS=ON -DENABLE_PROFILING_ITT=ON -DSELECTIVE_BUILD=COLLECT -DENABLE_SNIPPETS_LIBXSMM_TPP=ON -DCMAKE_TOOLCHAIN_FILE=cmake/arm64.toolchain.cmake -B build_arm64 - name: Create code style diff run: cmake --build build_arm64 --target clang_format_fix_all -j8 @@ -94,7 +98,7 @@ jobs: # always provide suggestions even for skipped scripts in ov_shellcheck tagret - name: ShellCheck action if: always() - uses: reviewdog/action-shellcheck@ccaafec556ffa154f112bfcb7b9c9574190b7091 # v1.27.0 + uses: reviewdog/action-shellcheck@6e0e63d1750d02d761b3df0f2c5ba9f9ac4a9ed7 # v1.29.0 with: level: style reporter: github-pr-review diff --git a/.github/workflows/coverage.yml b/.github/workflows/coverage.yml index fd6a029abfaa67..50ff8d0153bd22 100644 --- a/.github/workflows/coverage.yml +++ b/.github/workflows/coverage.yml @@ -130,6 +130,6 @@ jobs: lcov --capture --directory ${{ github.workspace }}/. --output-file coverage.info genhtml coverage.info --output-directory coverage-report - name: Collect coverage - uses: codecov/codecov-action@b9fd7d16f6d7d1b5d2bec1a2887e65ceed900238 # v4.6.0 + uses: codecov/codecov-action@5a605bd92782ce0810fa3b8acc235c921b497052 # v5.2.0 with: verbose: true diff --git a/.github/workflows/job_build_linux.yml b/.github/workflows/job_build_linux.yml index c56de5872cc2df..d1dfd0504ae194 100644 --- a/.github/workflows/job_build_linux.yml +++ b/.github/workflows/job_build_linux.yml @@ -234,6 +234,11 @@ jobs: -DENABLE_WHEEL=OFF cmake --build ${BUILD_DIR} --parallel $(nproc) cmake --install ${BUILD_DIR} --prefix ${INSTALL_DIR_JS} + + - name: Pack openvino_js_package + if: ${{ fromJSON(inputs.affected-components).JS_API && inputs.build-js }} + run: tar -cvf - * | pigz > ${BUILD_DIR}/openvino_js_package.tar.gz + working-directory: ${{ env.INSTALL_DIR_JS }} - name: Build RPM packages if: ${{ inputs.build-rpm-packages }} @@ -279,7 +284,7 @@ jobs: uses: actions/upload-artifact@b4b15b8c7c6ac21ea08fcf65892d2ee8f75cf882 # v4.4.3 with: name: openvino_js_package - path: ${{ env.INSTALL_DIR_JS }} + path: ${{ env.BUILD_DIR }}/openvino_js_package.tar.gz if-no-files-found: 'error' - name: Upload openvino developer package @@ -333,8 +338,10 @@ jobs: ${{ env.BUILD_DIR }}/openvino_tests.tar.gz ${{ env.BUILD_DIR }}/deb ${{ env.MANIFEST_PATH }} + ${{ env.STORE_JS == 'true' && format('{0}/openvino_js_package.tar.gz', env.BUILD_DIR) || '' }} ${{ env.STORE_WHEELS == 'true' && format('{0}/wheels', env.INSTALL_WHEELS_DIR) || '' }} storage_dir: ${{ env.PRODUCT_TYPE }} storage_root: ${{ env.ARTIFACTS_SHARE }} env: STORE_WHEELS: ${{ inputs.os != 'debian_10' && inputs.arch != 'arm' }} + STORE_JS: ${{ fromJSON(inputs.affected-components).JS_API && inputs.build-js }} diff --git a/.github/workflows/job_build_windows.yml b/.github/workflows/job_build_windows.yml index d5d42ffcfea8d2..e725f15c7081c1 100644 --- a/.github/workflows/job_build_windows.yml +++ b/.github/workflows/job_build_windows.yml @@ -56,7 +56,7 @@ jobs: BUILD_DIR: "${{ github.workspace }}\\openvino_build" ARTIFACTS_SHARE: "C:\\mount\\build-artifacts" MANIFEST_PATH: "${{ github.workspace }}\\manifest.yml" - PRODUCT_TYPE: 'public_windows_vs2019_${{ inputs.build-type }}' + PRODUCT_TYPE: 'public_windows_vs2022_${{ inputs.build-type }}' steps: - name: Clone OpenVINO uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 @@ -80,7 +80,6 @@ jobs: pip-cache-path: ${{ env.PIP_CACHE_PATH }} should-setup-pip-paths: 'true' self-hosted-runner: 'true' - show-cache-info: 'true' - name: Generate product manifest and set CI_BUILD_NUMBER & CI_BUILD_DEV_TAG id: create_manifest @@ -155,10 +154,10 @@ jobs: restore-keys: | ${{ runner.os }}-${{ runner.arch }}-ccache - - name: Configure Developer Command Prompt for Microsoft Visual C++ (2019) + - name: Configure Developer Command Prompt for Microsoft Visual C++ uses: ilammy/msvc-dev-cmd@0b201ec74fa43914dc39ae48a89fd1d8cb592756 # v1.13.0 with: - toolset: 14.29 + toolset: 14.40 # v2022 - name: Set SSL_CERT_FILE for model downloading for unit tests run: echo SSL_CERT_FILE=$(python3 -m certifi) >> $env:GITHUB_ENV @@ -230,7 +229,7 @@ jobs: & $pythonExecutablePath -m pip install -r ${{ env.OPENVINO_REPO }}/src/bindings/python/wheel/requirements-dev.txt cmake -DPython3_EXECUTABLE="$pythonExecutablePath" -DOpenVINODeveloperPackage_DIR=${{ env.BUILD_DIR }} -S ${{ env.OPENVINO_REPO }}/src/bindings/python -B "$pyBuildDir" && - cmake --build "$pyBuildDir" --parallel --config ${{ env.CMAKE_BUILD_TYPE }} && + cmake --build "$pyBuildDir" --parallel $ENV:NUMBER_OF_PROCESSORS --target ie_wheel --config ${{ env.CMAKE_BUILD_TYPE }} && cmake --install "$pyBuildDir" --config ${{ env.CMAKE_BUILD_TYPE }} --prefix ${{ env.INSTALL_WHEELS_DIR }} --component python_wheels if ($LASTEXITCODE -ne 0) { Write-Host "Failed to build Python wheels for Python $pyVersion" @@ -265,6 +264,17 @@ jobs: -DENABLE_WHEEL=OFF cmake --build ${{ env.BUILD_DIR }} --parallel $ENV:NUMBER_OF_PROCESSORS cmake --install ${{ env.BUILD_DIR }} --config ${{ env.CMAKE_BUILD_TYPE }} --prefix ${{ env.INSTALL_DIR_JS }} + + - name: Pack JS Artifacts + if: ${{ fromJSON(inputs.affected-components).JS_API }} + run: | + $file = Get-ChildItem -Path "${{ env.INSTALL_DIR_JS }}" + $compress = @{ + Path = $file + CompressionLevel = "Optimal" + DestinationPath = "${{ env.BUILD_DIR }}/openvino_js_package.zip" + } + Compress-Archive @compress # # Upload build artifacts and logs @@ -297,7 +307,7 @@ jobs: uses: actions/upload-artifact@b4b15b8c7c6ac21ea08fcf65892d2ee8f75cf882 # v4.4.3 with: name: openvino_js_package - path: ${{ env.INSTALL_DIR_JS }} + path: ${{ env.BUILD_DIR }}/openvino_js_package.zip if-no-files-found: 'error' - name: Store artifacts to a shared drive @@ -309,8 +319,10 @@ jobs: ${{ env.BUILD_DIR }}/openvino_package.zip ${{ env.BUILD_DIR }}/openvino_tests.zip ${{ env.MANIFEST_PATH }} + ${{ env.STORE_JS == 'true' && format('{0}/openvino_js_package.zip', env.BUILD_DIR) || '' }} ${{ env.STORE_WHEELS == 'true' && format('{0}/wheels', env.INSTALL_WHEELS_DIR) || '' }} storage_dir: ${{ env.PRODUCT_TYPE }} storage_root: ${{ env.ARTIFACTS_SHARE }} env: STORE_WHEELS: ${{ inputs.build-type != 'Debug' }} + STORE_JS: ${{ fromJSON(inputs.affected-components).JS_API && inputs.build-js }} diff --git a/.github/workflows/job_cpu_functional_tests.yml b/.github/workflows/job_cpu_functional_tests.yml index 568c33d39e307b..74e54d389a8ec5 100644 --- a/.github/workflows/job_cpu_functional_tests.yml +++ b/.github/workflows/job_cpu_functional_tests.yml @@ -90,7 +90,7 @@ jobs: run: python3 -m pip install -r ${INSTALL_TEST_DIR}/functional_test_utils/layer_tests_summary/requirements.txt - name: Restore tests execution time - uses: actions/cache/restore@6849a6489940f00c2f30c0fb92c6274307ccb58a # v4.1.2 + uses: actions/cache/restore@1bd1e32a3bdc45362d1e726936510720a7c30a57 # v4.2.0 with: path: ${{ env.PARALLEL_TEST_CACHE }} key: ${{ runner.os }}-${{ runner.arch }}-tests-functional-cpu-stamp-${{ github.sha }} @@ -110,7 +110,7 @@ jobs: timeout-minutes: 25 - name: Save tests execution time - uses: actions/cache/save@6849a6489940f00c2f30c0fb92c6274307ccb58a # v4.1.2 + uses: actions/cache/save@1bd1e32a3bdc45362d1e726936510720a7c30a57 # v4.2.0 if: github.ref_name == 'master' with: path: ${{ env.PARALLEL_TEST_CACHE }} diff --git a/.github/workflows/job_openvino_js.yml b/.github/workflows/job_openvino_js.yml index fd04d8842daae7..dbee8511c4187b 100644 --- a/.github/workflows/job_openvino_js.yml +++ b/.github/workflows/job_openvino_js.yml @@ -45,11 +45,16 @@ jobs: echo "OPENVINO_JS_DIR=$GITHUB_WORKSPACE/openvino/src/bindings/js" >> "$GITHUB_ENV" echo "OPENVINO_JS_LIBS_DIR=$GITHUB_WORKSPACE/openvino/src/bindings/js/node/bin" >> "$GITHUB_ENV" - - name: Download OpenVINO JS package + - name: Download OpenVINO artifacts (JS) uses: actions/download-artifact@fa0a91b85d4f404e444e00e005971372dc801d16 # v4.1.8 with: - name: openvino_js_package + pattern: openvino_[js]* path: ${{ env.OPENVINO_JS_LIBS_DIR }} + merge-multiple: true + + - name: Extract OpenVINO packages + run: pigz -dc openvino_js_package.tar.gz | tar -xf - -C ${OPENVINO_JS_LIBS_DIR} + working-directory: ${{ env.OPENVINO_JS_LIBS_DIR }} - name: Setup Node ${{ env.NODE_VERSION }} if: runner.os != 'Linux' # Node is already installed in the Docker image diff --git a/.github/workflows/job_python_api_tests.yml b/.github/workflows/job_python_api_tests.yml index e12001cd67afba..75ce8cb2c808ea 100644 --- a/.github/workflows/job_python_api_tests.yml +++ b/.github/workflows/job_python_api_tests.yml @@ -66,7 +66,7 @@ jobs: working-directory: ${{ env.INSTALL_TEST_DIR }} - name: Fetch setup_python and install wheels actions - uses: actions/checkout@d632683dd7b4114ad314bca15554477dd762a938 # v4.2.0 + uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 timeout-minutes: 15 with: sparse-checkout: | @@ -122,7 +122,7 @@ jobs: - name: Clone API snippets if: ${{ runner.os != 'macOS' && fromJSON(inputs.affected-components).docs_snippets.test }} - uses: actions/checkout@d632683dd7b4114ad314bca15554477dd762a938 # v4.2.0 + uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 timeout-minutes: 15 with: sparse-checkout: docs/articles_en/assets/snippets diff --git a/.github/workflows/job_samples_tests.yml b/.github/workflows/job_samples_tests.yml index 07fc17b797592e..abcbc62c182342 100644 --- a/.github/workflows/job_samples_tests.yml +++ b/.github/workflows/job_samples_tests.yml @@ -84,11 +84,11 @@ jobs: version: '3.11' should-setup-pip-paths: 'false' - - name: Configure Developer Command Prompt for Microsoft Visual C++ (2022) + - name: Configure Developer Command Prompt for Microsoft Visual C++ if: runner.os == 'Windows' uses: ilammy/msvc-dev-cmd@0b201ec74fa43914dc39ae48a89fd1d8cb592756 # v1.13.0 with: - toolset: 14.40 + toolset: 14.40 # v2022 - name: Build cpp samples run: $INSTALL_DIR/samples/cpp/build_samples.sh -i $INSTALL_DIR -b $BUILD_DIR/cpp_samples diff --git a/.github/workflows/ovc.yml b/.github/workflows/ovc.yml index 3e7dedf50ad51b..a554ef4fadc6d3 100644 --- a/.github/workflows/ovc.yml +++ b/.github/workflows/ovc.yml @@ -28,7 +28,7 @@ jobs: python-version: '3.10' - name: Cache pip - uses: actions/cache@6849a6489940f00c2f30c0fb92c6274307ccb58a # v4.1.2 + uses: actions/cache@1bd1e32a3bdc45362d1e726936510720a7c30a57 # v4.2.0 with: path: ~/.cache/pip key: ${{ runner.os }}-pip-${{ hashFiles('src/bindings/python/requirements*.txt') }} diff --git a/.github/workflows/windows_conditional_compilation.yml b/.github/workflows/windows_conditional_compilation.yml index 0f965eabd3c1ad..ba9908558201e6 100644 --- a/.github/workflows/windows_conditional_compilation.yml +++ b/.github/workflows/windows_conditional_compilation.yml @@ -157,7 +157,7 @@ jobs: - name: Configure Developer Command Prompt for Microsoft Visual C++ uses: ilammy/msvc-dev-cmd@0b201ec74fa43914dc39ae48a89fd1d8cb592756 # v1.13.0 with: - toolset: 14.40 + toolset: 14.40 # v2022 - name: Set SSL_CERT_FILE for model downloading for unit tests run: echo SSL_CERT_FILE=$(python3 -m certifi) >> $env:GITHUB_ENV @@ -393,7 +393,7 @@ jobs: run: python3 -m pip install -r ${{ env.INSTALL_TEST_DIR }}/layer_tests_summary/requirements.txt - name: Restore tests execution time - uses: actions/cache/restore@6849a6489940f00c2f30c0fb92c6274307ccb58a # v4.1.2 + uses: actions/cache/restore@1bd1e32a3bdc45362d1e726936510720a7c30a57 # v4.2.0 with: path: ${{ env.PARALLEL_TEST_CACHE }} key: ${{ runner.os }}-tests-functional-cpu-stamp-${{ github.sha }} diff --git a/.github/workflows/windows_vs2019_debug.yml b/.github/workflows/windows_vs2019_debug.yml index 4fcdc6b58b79d1..c69ea87d1bcbf8 100644 --- a/.github/workflows/windows_vs2019_debug.yml +++ b/.github/workflows/windows_vs2019_debug.yml @@ -1,4 +1,4 @@ -name: Windows (VS 2019, Python 3.11, Debug) +name: Windows (VS 2022, Python 3.11, Debug) on: workflow_dispatch: merge_group: @@ -9,7 +9,7 @@ on: - 'releases/**' concurrency: # github.ref is not unique in post-commit - group: ${{ github.event_name == 'push' && github.run_id || github.ref }}-windows-vs2019-debug + group: ${{ github.event_name == 'push' && github.run_id || github.ref }}-windows-vs2022-debug cancel-in-progress: true permissions: read-all @@ -77,7 +77,7 @@ jobs: with: runner: 'aks-win-4-cores-8gb' affected-components: ${{ needs.smart_ci.outputs.affected_components }} - os: 'windows_2019' + os: 'windows_2022' build-type: 'Debug' timeout-minutes: 60 diff --git a/.github/workflows/windows_vs2019_release.yml b/.github/workflows/windows_vs2019_release.yml index 5708b529f25acc..0288bef986bbee 100644 --- a/.github/workflows/windows_vs2019_release.yml +++ b/.github/workflows/windows_vs2019_release.yml @@ -1,4 +1,4 @@ -name: Windows (VS 2019, Python 3.11, Release) +name: Windows (VS 2022, Python 3.11, Release) on: workflow_dispatch: pull_request: @@ -192,12 +192,17 @@ jobs: sparse-checkout: | src/bindings/js path: 'openvino' - - - name: Download OpenVINO js package + + - name: Download OpenVINO artifacts (JS) uses: actions/download-artifact@fa0a91b85d4f404e444e00e005971372dc801d16 # v4.1.8 with: - name: openvino_js_package + pattern: openvino_[js]* path: ${{ env.OPENVINO_JS_LIBS_DIR }} + merge-multiple: true + + - name: Extract OpenVINO packages + run: Expand-Archive openvino_js_package.zip -DestinationPath . + working-directory: ${{ env.OPENVINO_JS_LIBS_DIR }} - name: Setup Node ${{ env.NODE_VERSION }} uses: actions/setup-node@39370e3970a6d050c480ffad4ff0ed4d3fdee5af # v4.1.0 @@ -515,7 +520,7 @@ jobs: with: runner: 'aks-win-4-cores-8gb' affected-components: ${{ needs.smart_ci.outputs.affected_components }} - os: 'windows_2019' + os: 'windows_2022' build-type: 'Release' timeout-minutes: 50 @@ -576,7 +581,7 @@ jobs: run: python3 -m pip install -r ${{ github.workspace }}\install\tests\functional_test_utils\layer_tests_summary\requirements.txt - name: Restore tests execution time - uses: actions/cache/restore@6849a6489940f00c2f30c0fb92c6274307ccb58a # v4.1.2 + uses: actions/cache/restore@1bd1e32a3bdc45362d1e726936510720a7c30a57 # v4.2.0 with: path: ${{ env.PARALLEL_TEST_CACHE }} key: ${{ runner.os }}-tests-functional-cpu-stamp-${{ github.sha }} @@ -590,7 +595,7 @@ jobs: timeout-minutes: 60 - name: Save tests execution time - uses: actions/cache/save@6849a6489940f00c2f30c0fb92c6274307ccb58a # v4.1.2 + uses: actions/cache/save@1bd1e32a3bdc45362d1e726936510720a7c30a57 # v4.2.0 if: github.ref_name == 'master' with: path: ${{ env.PARALLEL_TEST_CACHE }} diff --git a/.github/workflows/workflows_to_track.txt b/.github/workflows/workflows_to_track.txt index ef3bb633ed7737..262465ead6b6e5 100644 --- a/.github/workflows/workflows_to_track.txt +++ b/.github/workflows/workflows_to_track.txt @@ -20,8 +20,8 @@ name: Linux Static CC (Ubuntu 22.04, Python 3.11, Clang) name: GitHub Actions Workflows Scans ==> ./check_pr_commits.yml <== name: PR Commits -==> ./windows_vs2019_debug.yml <== -name: Windows (VS 2019, Python 3.11, Debug) +==> ./windows_vs2022_debug.yml <== +name: Windows (VS 2022, Python 3.11, Debug) ==> ./files_size.yml <== name: Files Size ==> ./cleanup_caches.yml <== @@ -69,7 +69,7 @@ name: Webassembly name: Linux (Ubuntu 24.04, Python 3.12) ==> ./assign_issue.yml <== name: Take Issue -==> ./windows_vs2019_release.yml <== -name: Windows (VS 2019, Python 3.11, Release) +==> ./windows_vs2022_release.yml <== +name: Windows (VS 2022, Python 3.11, Release) ==> ./coverity.yml <== name: Coverity (Ubuntu 20.04, Python 3.11) diff --git a/README.md b/README.md index 8019bb892023f2..9ed2d4690e39e9 100644 --- a/README.md +++ b/README.md @@ -100,7 +100,7 @@ OpenVINO supports the CPU, GPU, and NPU [devices](https://docs.openvino.ai/2024/ ## Generative AI with OpenVINO -Get started with the OpenVINO GenAI [installation](https://docs.openvino.ai/2024/get-started/install-openvino/install-openvino-genai.html) and refer to the [detailed guide](https://docs.openvino.ai/2024/learn-openvino/llm_inference_guide/genai-guide.html) to explore the capabilities of Generative AI using OpenVINO. +Get started with the OpenVINO GenAI [installation](https://docs.openvino.ai/2024/get-started/install-openvino/install-openvino-genai.html) and refer to the [detailed guide](https://docs.openvino.ai/2024/openvino-workflow-generative/generative-inference.html) to explore the capabilities of Generative AI using OpenVINO. Learn how to run LLMs and GenAI with [Samples](https://github.com/openvinotoolkit/openvino.genai/tree/master/samples) in the [OpenVINO™ GenAI repo](https://github.com/openvinotoolkit/openvino.genai). See GenAI in action with Jupyter notebooks: [LLM-powered Chatbot](https://github.com/openvinotoolkit/openvino_notebooks/blob/latest/notebooks/llm-chatbot/README.md) and [LLM Instruction-following pipeline](https://github.com/openvinotoolkit/openvino_notebooks/blob/latest/notebooks/llm-question-answering/README.md). diff --git a/cspell.json b/cspell.json deleted file mode 100644 index f59d00a6a052f6..00000000000000 --- a/cspell.json +++ /dev/null @@ -1,412 +0,0 @@ -{ - "version": "0.2", - "ignorePaths": [], - "dictionaryDefinitions": [], - "dictionaries": [], - "words": [ - "aarch64", - "acdadcfa", - "acea", - "abmrd", - "acfb", - "acosh", - "Acosh", - "adfcd", - "addcmul", - "addif", - "addmm", - "aeaa", - "agem", - "agew", - "armeabi", - "armhf", - "artefacts", - "ARTEFACTS", - "Asinh", - "asynch", - "Atanh", - "autodoc", - "Autograd", - "autoplugin", - "AUTOPLUGIN", - "autoremove", - "autosummary", - "bace", - "Backprop", - "bblayers", - "Beautif", - "Bilat", - "bindir", - "bitbake", - "BFYX", - "BFXY", - "bkgr", - "brctl", - "Bucketize", - "BUILDDIR", - "buildtools", - "buildsystems", - "BYXF", - "bvalue", - "bvlc", - "caffe", - "caffemodel", - "camvid", - "cbba", - "cbcd", - "cdad", - "cdrom", - "chrpath", - "classov", - "cldnn", - "clumber", - "codepath", - "codepaths", - "coeffs", - "concat", - "Concat", - "Conts", - "constexpr", - "consts", - "Consts", - "conv", - "Convolutional", - "CPPLINT", - "cpplint", - "crbegin", - "crend", - "ctest", - "ctput", - "CVAT", - "cython", - "dadb", - "DANDROID", - "DARM", - "Datumaro", - "datumaro", - "DBUILD", - "DCMAKE", - "ddepth", - "Depthwise", - "dearmor", - "devicesupport", - "dequantization", - "Dequantization", - "deeplabv", - "deeced", - "DENABLE", - "delif", - "denormal", - "DENORMAL", - "denormalized", - "Detectron", - "Dequantize", - "devel", - "devtoolset", - "dgpu", - "diffstat", - "dldt", - "dlstreamer", - "dkms", - "Dockerfiles", - "DOPENVINO", - "downscript", - "doxid", - "doxygen", - "Doxygen", - "doxygensnippet", - "DTHREADING", - "dpkg", - "DPYTHON", - "DSELECTIVE", - "dylib", - "DWORD", - "efficientdet", - "Efficientdet", - "Einsum", - "Elems", - "Elementwise", - "elementwise", - "Eltwise", - "endsphinxdirective", - "enumov", - "emcmake", - "emmake", - "emod", - "emom", - "emow", - "Emscripten", - "emscripten", - "emsdk", - "epel", - "ERRORLEVEL", - "evolutionally", - "executionpolicy", - "fafe", - "fdupes", - "flatbuffers", - "FLATBUFFERS", - "frontends", - "Frontends", - "FYXB", - "gaddb", - "GAPI", - "gapi", - "Gaussed", - "gcompoundkernel", - "gcomputation", - "GCPU", - "gcpukernel", - "Gelu", - "GELU", - "Geti", - "getitem", - "gimg", - "gitee", - "gflags", - "globbing", - "gmmlib", - "GNAs", - "gmock", - "gnueabihf", - "googlenet", - "gpgcheck", - "gpgkey", - "graphviz", - "Graphviz", - "groupov", - "gtest", - "hardtanh", - "hashfile", - "HDDL", - "HKLM", - "HOSTTOOLS", - "Hotspots", - "hotspots", - "hostnet", - "hwloc", - "hwquote", - "idbf", - "IDFT", - "iigd", - "ifdef", - "ifdown", - "ifup", - "imgproc", - "imshow", - "inet", - "INTEGRITYCHECK", - "ILSVRC", - "inferenced", - "Informations", - "insmod", - "intelocl", - "INTERPROCEDURAL", - "INSTALLDIR", - "IRDFT", - "jemalloc", - "kaldi", - "Keras", - "keypress", - "keyrings", - "Khronos", - "KROIs", - "Landm", - "landm", - "Latency", - "Lcov", - "ldconfig", - "libc", - "libopencl", - "libopencv", - "libpython", - "libtbb", - "libtbbbind", - "libtpm", - "libvirtd", - "linmac", - "Liskov", - "lowlatency", - "LTSC", - "LSTM", - "makefiles", - "malloc", - "memleaks", - "manylinux", - "maxdepth", - "miktext", - "Mish", - "mklink", - "mmap", - "mobilenet", - "Mobilenet", - "monodepth", - "mozallowfullscreen", - "msallowfullscreen", - "MSVC", - "msvc", - "Multiclass", - "muxed", - "mxnet", - "namespaceov", - "NCHW", - "ncpu", - "netdev", - "netplan", - "ngraph", - "nireq", - "NNCF", - "nncf", - "nocache", - "noglob", - "nohup", - "nlohmann", - "norestart", - "noqueue", - "nproc", - "NUMA", - "numpy", - "Numpy", - "oallowfullscreen", - "ocloc", - "OCSP", - "oneapi", - "onetbb", - "onnx", - "opencl", - "openembedded", - "openvino", - "Opset", - "opset", - "opsets", - "OVMS", - "ovms", - "ovsa", - "OVSA", - "ovsatool", - "OVTF", - "PACKAGECONFIG", - "paddlepaddle", - "parameterizable", - "partitioner", - "patchelf", - "passpattern", - "Pexels", - "pdmodel", - "PDPD", - "pkgdata", - "pkgs", - "pkill", - "polylines", - "postproc", - "postprocess", - "preprocess", - "Preprocess", - "protobuf", - "Protobuf", - "PROTOBUF", - "prototxt", - "PSROI", - "Pugi", - "pugixml", - "PUGIXML", - "pypi", - "PYTHONPATH", - "pzstd", - "qcow", - "qlen", - "QSPECTRE", - "Qspectre", - "quantizer", - "Rects", - "Relu", - "relu", - "rcnn", - "RCNN", - "RDFT", - "Redistributable", - "remotesigned", - "repolist", - "reproject", - "reshapable", - "Requantize", - "retval", - "RHODS", - "rmmod", - "runtool", - "scons", - "SCONS", - "segm", - "Selu", - "servercore", - "setuptools", - "setupvars", - "SETX", - "SIMD", - "Softmax", - "skylake", - "sphinxdirective", - "Strided", - "squeezenet", - "SWTPM", - "swtpm", - "TBBBIND", - "TBBROOT", - "Tensro", - "texlive", - "textrm", - "tflite", - "thirdparty", - "Thresholded", - "toctree", - "toolset", - "Torchvision", - "tpmrm", - "tpmstate", - "tput", - "Tunables", - "unet", - "Uninstallation", - "unixio", - "unsharp", - "Unsharp", - "Unsh", - "Unsqueeze", - "Usecase", - "usecases", - "USERPROFILE", - "userspace", - "VAAPI", - "valgrind", - "vcpkg", - "vcvars", - "venv", - "virbr", - "virsh", - "virt", - "virtio", - "VMHWM", - "VMRSS", - "VNNI", - "vtune", - "vtunesummary", - "vtunebottonup", - "WHOLEARCHIVE", - "WDDM", - "WORKDIR", - "WORKSIZE", - "xbyak", - "Xbyak", - "xdot", - "xvfz", - "yocto", - "yolo", - "YOLO", - "yolov", - "Yolov", - "YXFB", - "zstd" - ], - "ignoreWords": [], - "import": [] -} diff --git a/docs/articles_en/about-openvino/key-features.rst b/docs/articles_en/about-openvino/key-features.rst index 6514bdc67a3302..7e4ffab3cbb2ec 100644 --- a/docs/articles_en/about-openvino/key-features.rst +++ b/docs/articles_en/about-openvino/key-features.rst @@ -13,8 +13,8 @@ Easy Integration :doc:`torch.compile <../openvino-workflow/torch-compile>` to improve model inference. Apply OpenVINO optimizations to your PyTorch models directly with a single line of code. -| :doc:`GenAI Out Of The Box <../learn-openvino/llm_inference_guide/genai-guide>` -| With the genAI flavor of OpenVINO, you can run generative AI with just a couple lines of code. +| :doc:`GenAI Out Of The Box <../openvino-workflow-generative/inference-with-genai>` +| With the OpenVINO GenAI, you can run generative models with just a few lines of code. Check out the GenAI guide for instructions on how to do it. | `Python / C++ / C / NodeJS APIs `__ diff --git a/docs/articles_en/about-openvino/performance-benchmarks.rst b/docs/articles_en/about-openvino/performance-benchmarks.rst index 4262ec6b2b3732..723bc1a96f7e9d 100644 --- a/docs/articles_en/about-openvino/performance-benchmarks.rst +++ b/docs/articles_en/about-openvino/performance-benchmarks.rst @@ -132,21 +132,21 @@ For a listing of all platforms and configurations used for testing, refer to the .. grid-item:: - .. button-link:: ../_static/benchmarks_files/OV-2024.6-platform_list.pdf + .. button-link:: ../_static/downloads/benchmarking_OV_platform_list.pdf :color: primary :outline: :expand: :material-regular:`download;1.5em` Click for Hardware Platforms [PDF] - .. button-link:: ../_static/benchmarks_files/OV-2024.6-system-info-detailed.xlsx + .. button-link:: ../_static/downloads/benchmarking_OV_system_info_detailed.xlsx :color: primary :outline: :expand: :material-regular:`download;1.5em` Click for Configuration Details [XLSX] - .. button-link:: ../_static/benchmarks_files/OV-2024.6-Performance-Data.xlsx + .. button-link:: ../_static/downloads/benchmarking_OV_performance-data.xlsx :color: primary :outline: :expand: diff --git a/docs/articles_en/about-openvino/performance-benchmarks/generative-ai-performance.rst b/docs/articles_en/about-openvino/performance-benchmarks/generative-ai-performance.rst index 83581d465df92e..1f111563a4f29a 100644 --- a/docs/articles_en/about-openvino/performance-benchmarks/generative-ai-performance.rst +++ b/docs/articles_en/about-openvino/performance-benchmarks/generative-ai-performance.rst @@ -56,7 +56,7 @@ The tables below list the key performance indicators for inference on built-in G .. grid-item:: - .. button-link:: https://docs.openvino.ai/2024/_static/benchmarks_files/llm_models_platform_list_.pdf + .. button-link:: https://docs.openvino.ai/2024/_static/download/benchmarking_genai_platform_list.pdf :color: primary :outline: :expand: diff --git a/docs/articles_en/about-openvino/release-notes-openvino.rst b/docs/articles_en/about-openvino/release-notes-openvino.rst index 0134ed15215541..f898ddaf42ba03 100644 --- a/docs/articles_en/about-openvino/release-notes-openvino.rst +++ b/docs/articles_en/about-openvino/release-notes-openvino.rst @@ -16,7 +16,7 @@ OpenVINO Release Notes -2024.6 - 18 December 2024 +2025.0 - 05 February 2025 ############################# :doc:`System Requirements <./release-notes-openvino/system-requirements>` | :doc:`Release policy <./release-notes-openvino/release-policy>` | :doc:`Installation Guides <./../get-started/install-openvino>` @@ -26,10 +26,9 @@ OpenVINO Release Notes What's new +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -* OpenVINO 2024.6 release includes updates for enhanced stability and improved LLM performance. -* Introduced support for Intel® Arc™ B-Series Graphics (formerly known as Battlemage). -* Implemented optimizations to improve the inference time and LLM performance on NPUs. -* Improved LLM performance with GenAI API optimizations and bug fixes. +* . + + @@ -39,26 +38,19 @@ OpenVINO™ Runtime CPU Device Plugin ----------------------------------------------------------------------------------------------- -* KV cache now uses asymmetric 8-bit unsigned integer (U8) as the default precision, reducing - memory stress for LLMs and increasing their performance. This option can be controlled by - model meta data. -* Quality and accuracy has been improved for selected models with several bug fixes. +* . +* . GPU Device Plugin ----------------------------------------------------------------------------------------------- -* Device memory copy optimizations have been introduced for inference with **Intel® Arc™ B-Series - Graphics** (formerly known as Battlemage). Since it does not utilize L2 cache for copying memory - between the device and host, a dedicated `copy` operation is used, if inputs or results are - not expected in the device memory. -* ChatGLM4 inference on GPU has been optimized. +* . + NPU Device Plugin ----------------------------------------------------------------------------------------------- -* LLM performance and inference time has been improved with memory optimizations. - - +* . @@ -76,10 +68,6 @@ Other Changes and Known Issues Jupyter Notebooks ----------------------------- -* `Visual-language assistant with GLM-Edge-V and OpenVINO `__ -* `Local AI and OpenVINO `__ -* `Multimodal understanding and generation with Janus and OpenVINO `__ - @@ -98,14 +86,10 @@ Previous 2025 releases .. ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -.. dropdown:: 2024.5 - 20 November 2024 +.. dropdown:: 2024.6 - 18 December 2024 :animate: fade-in-slide-down :color: secondary - **What's new** - - * More GenAI coverage and framework integrations to minimize code changes. - @@ -126,74 +110,44 @@ page. -Discontinued in 2024 +Discontinued in 2025 ----------------------------- * Runtime components: - * Intel® Gaussian & Neural Accelerator (Intel® GNA). Consider using the Neural Processing - Unit (NPU) for low-powered systems like Intel® Core™ Ultra or 14th generation and beyond. - * OpenVINO C++/C/Python 1.0 APIs (see - `2023.3 API transition guide `__ - for reference). - * All ONNX Frontend legacy API (known as ONNX_IMPORTER_API). - * ``PerfomanceMode.UNDEFINED`` property as part of the OpenVINO Python API. + * The OpenVINO property of Affinity API will is no longer available. It has been replaced with CPU + binding configurations (``ov::hint::enable_cpu_pinning``). * Tools: - * Deployment Manager. See :doc:`installation <../get-started/install-openvino>` and - :doc:`deployment <../get-started/install-openvino>` guides for current distribution - options. - * `Accuracy Checker `__. - * `Post-Training Optimization Tool `__ - (POT). Neural Network Compression Framework (NNCF) should be used instead. - * A `Git patch `__ - for NNCF integration with `huggingface/transformers `__. - The recommended approach is to use `huggingface/optimum-intel `__ - for applying NNCF optimization on top of models from Hugging Face. - * Support for Apache MXNet, Caffe, and Kaldi model formats. Conversion to ONNX may be used - as a solution. - * The macOS x86_64 debug bins are no longer provided with the OpenVINO toolkit, starting - with OpenVINO 2024.5. - * Python 3.8 is no longer supported, starting with OpenVINO 2024.5. - - * As MxNet doesn't support Python version higher than 3.8, according to the - `MxNet PyPI project `__, - it is no longer supported by OpenVINO, either. - - * Discrete Keem Bay support is no longer supported, starting with OpenVINO 2024.5. - * Support for discrete devices (formerly codenamed Raptor Lake) is no longer available for - NPU. + * The OpenVINO™ Development Tools package (pip install openvino-dev) is no longer available + for OpenVINO releases in 2025. + * Model Optimizer is no longer available. Consider using the + :doc:`new conversion methods <../openvino-workflow/model-preparation/convert-model-to-ir>` + instead. For more details, see the + `model conversion transition guide `__. + * Intel® Streaming SIMD Extensions (Intel® SSE) are currently not enabled in the binary + package by default. They are still supported in the source code form. Deprecated and to be removed in the future -------------------------------------------- -* Intel® Streaming SIMD Extensions (Intel® SSE) will be supported in source code form, but not - enabled in the binary package by default, starting with OpenVINO 2025.0. * Ubuntu 20.04 support will be deprecated in future OpenVINO releases due to the end of standard support. * The openvino-nightly PyPI module will soon be discontinued. End-users should proceed with the Simple PyPI nightly repo instead. More information in - `Release Policy `__. -* The OpenVINO™ Development Tools package (pip install openvino-dev) will be removed from - installation options and distribution channels beginning with OpenVINO 2025.0. -* Model Optimizer will be discontinued with OpenVINO 2025.0. Consider using the - :doc:`new conversion methods <../openvino-workflow/model-preparation/convert-model-to-ir>` - instead. For more details, see the - `model conversion transition guide `__. -* OpenVINO property Affinity API will be discontinued with OpenVINO 2025.0. - It will be replaced with CPU binding configurations (``ov::hint::enable_cpu_pinning``). - - - + `Release Policy `__. +* “auto shape” and “auto batch size” (reshaping a model in runtime) will be removed in the + future. OpenVINO's dynamic shape models are recommended instead. +* MacOS x86 is no longer recommended for use due to the discontinuation of validation. + Full support will be removed later in 2025. +* The `openvino` namespace of the OpenVINO Python API has been redesigned, removing the nested + `openvino.runtime` module. The old namespace is now considered deprecated and will be + discontinued in 2026.0. - * “auto shape” and “auto batch size” (reshaping a model in runtime) will be removed in the - future. OpenVINO's dynamic shape models are recommended instead. -* Starting with 2025.0 MacOS x86 is no longer recommended for use due to the discontinuation - of validation. Full support will be removed later in 2025. @@ -203,17 +157,13 @@ Legal Information +++++++++++++++++++++++++++++++++++++++++++++ You may not use or facilitate the use of this document in connection with any infringement -or other legal analysis concerning Intel products described herein. - -You agree to grant Intel a non-exclusive, royalty-free license to any patent claim -thereafter drafted which includes subject matter disclosed herein. +or other legal analysis concerning Intel products described herein. All information provided +here is subject to change without notice. Contact your Intel representative to obtain the +latest Intel product specifications and roadmaps. No license (express or implied, by estoppel or otherwise) to any intellectual property rights is granted by this document. -All information provided here is subject to change without notice. Contact your Intel -representative to obtain the latest Intel product specifications and roadmaps. - The products described may contain design defects or errors known as errata which may cause the product to deviate from published specifications. Current characterized errata are available on request. @@ -225,10 +175,9 @@ or from the OEM or retailer. No computer system can be absolutely secure. -Intel, Atom, Core, Xeon, OpenVINO, and the Intel logo are trademarks -of Intel Corporation in the U.S. and/or other countries. - -Other names and brands may be claimed as the property of others. +Intel, Atom, Core, Xeon, OpenVINO, and the Intel logo are trademarks of Intel Corporation in +the U.S. and/or other countries. Other names and brands may be claimed as the property of +others. Copyright © 2025, Intel Corporation. All rights reserved. diff --git a/docs/articles_en/assets/snippets/ov_dynamic_shapes.c b/docs/articles_en/assets/snippets/ov_dynamic_shapes.c index fa1f3158365ddf..68cbef8ab0159e 100644 --- a/docs/articles_en/assets/snippets/ov_dynamic_shapes.c +++ b/docs/articles_en/assets/snippets/ov_dynamic_shapes.c @@ -1,4 +1,4 @@ -// Copyright (C) 2018-2021 Intel Corporation +// Copyright (C) 2018-2025 Intel Corporation // SPDX-License-Identifier: Apache-2.0 // #include diff --git a/docs/articles_en/assets/snippets/ov_dynamic_shapes.cpp b/docs/articles_en/assets/snippets/ov_dynamic_shapes.cpp index c4e9002a9a61db..63d68516aa1c36 100644 --- a/docs/articles_en/assets/snippets/ov_dynamic_shapes.cpp +++ b/docs/articles_en/assets/snippets/ov_dynamic_shapes.cpp @@ -1,4 +1,4 @@ -// Copyright (C) 2018-2021 Intel Corporation +// Copyright (C) 2018-2025 Intel Corporation // SPDX-License-Identifier: Apache-2.0 // #include diff --git a/docs/articles_en/assets/snippets/ov_stateful_models_intro.cpp b/docs/articles_en/assets/snippets/ov_stateful_models_intro.cpp index a5271d148190d0..67afd8ea13029c 100644 --- a/docs/articles_en/assets/snippets/ov_stateful_models_intro.cpp +++ b/docs/articles_en/assets/snippets/ov_stateful_models_intro.cpp @@ -1,4 +1,4 @@ -// Copyright (C) 2018-2022 Intel Corporation +// Copyright (C) 2018-2025 Intel Corporation // SPDX-License-Identifier: Apache-2.0 // diff --git a/docs/articles_en/documentation/openvino-ecosystem.rst b/docs/articles_en/documentation/openvino-ecosystem.rst index 1975fe0a48a181..fbd4b6e53240a3 100644 --- a/docs/articles_en/documentation/openvino-ecosystem.rst +++ b/docs/articles_en/documentation/openvino-ecosystem.rst @@ -24,7 +24,7 @@ you an overview of a whole ecosystem of tools and solutions under the OpenVINO u | **GenAI** | :bdg-link-dark:`Github ` - :bdg-link-success:`User Guide ` + :bdg-link-success:`User Guide ` OpenVINO™ GenAI Library aims to simplify running inference of generative AI models. Check the LLM-powered Chatbot Jupyter notebook to see how GenAI works. @@ -113,7 +113,7 @@ generative AI and vision models directly on your computer or edge device using O | **Tokenizers** | :bdg-link-dark:`Github ` - :bdg-link-success:`User Guide ` + :bdg-link-success:`User Guide ` OpenVINO Tokenizers add text processing operations to OpenVINO. diff --git a/docs/articles_en/get-started/configurations.rst b/docs/articles_en/get-started/configurations.rst index 3e471c33445292..c0e885dd956c78 100644 --- a/docs/articles_en/get-started/configurations.rst +++ b/docs/articles_en/get-started/configurations.rst @@ -32,8 +32,9 @@ potential of OpenVINO™. Check the following list for components used in your w for details. | **OpenVINO GenAI Dependencies** -| OpenVINO GenAI is a flavor of OpenVINO, aiming to simplify running generative - AI models. For information on the dependencies required to use OpenVINO GenAI, see the +| OpenVINO GenAI is a tool based on the OpenVNO Runtime but simplifying the process of + running generative AI models. For information on the dependencies required to use + OpenVINO GenAI, see the :doc:`guide on OpenVINO GenAI Dependencies `. | **Open Computer Vision Library** diff --git a/docs/articles_en/get-started/configurations/genai-dependencies.rst b/docs/articles_en/get-started/configurations/genai-dependencies.rst index 4486890c3a40b8..13e28107f69d63 100644 --- a/docs/articles_en/get-started/configurations/genai-dependencies.rst +++ b/docs/articles_en/get-started/configurations/genai-dependencies.rst @@ -4,8 +4,8 @@ OpenVINO™ GenAI Dependencies OpenVINO™ GenAI depends on both `OpenVINO `__ and `OpenVINO Tokenizers `__. During OpenVINO™ GenAI installation from PyPi, the same versions of OpenVINO and OpenVINO Tokenizers -are used (e.g. ``openvino==2024.6.0`` and ``openvino-tokenizers==2024.6.0.0`` are installed for -``openvino-genai==2024.6.0``). +are used (e.g. ``openvino==2025.0.0`` and ``openvino-tokenizers==2025.0.0.0`` are installed for +``openvino-genai==2025.0.0``). Trying to update any of the dependency packages might result in a version incompatibility due to different Application Binary Interfaces (ABIs), which will result in errors while running @@ -27,5 +27,5 @@ Additional Resources * :doc:`OpenVINO GenAI Installation Guide <../install-openvino/install-openvino-genai>` * `OpenVINO GenAI repository `__ * :doc:`OpenVINO Installation Guide <../install-openvino>` -* :doc:`OpenVINO Tokenizers <../../learn-openvino/llm_inference_guide/ov-tokenizers>` +* :doc:`OpenVINO Tokenizers <../../openvino-workflow-generative/ov-tokenizers>` diff --git a/docs/articles_en/get-started/install-openvino.rst b/docs/articles_en/get-started/install-openvino.rst index 7603adf37b7e89..7616a87d6f3384 100644 --- a/docs/articles_en/get-started/install-openvino.rst +++ b/docs/articles_en/get-started/install-openvino.rst @@ -1,4 +1,4 @@ -Install OpenVINO™ 2024.6 +Install OpenVINO™ 2025.0 ========================== @@ -11,11 +11,11 @@ Install OpenVINO™ 2024.6 :maxdepth: 3 :hidden: + OpenVINO GenAI OpenVINO Runtime on Linux OpenVINO Runtime on Windows OpenVINO Runtime on macOS Create an OpenVINO Yocto Image - OpenVINO GenAI Flavor .. raw:: html @@ -23,20 +23,20 @@ Install OpenVINO™ 2024.6 -OpenVINO 2024.6, described here, is not a Long-Term-Support version! +OpenVINO 2025.0, described here, is not a Long-Term-Support version! All currently supported versions are: -* 2024.6 (development) +* 2025.0 (development) * 2023.3 (LTS) -.. dropdown:: Effortless GenAI integration with OpenVINO GenAI Flavor +.. dropdown:: Effortless GenAI integration with OpenVINO GenAI - A new OpenVINO GenAI Flavor streamlines application development by providing - LLM-specific interfaces for easy integration of language models, handling tokenization and - text generation. For installation and usage instructions, proceed to - :doc:`Install OpenVINO GenAI Flavor <../learn-openvino/llm_inference_guide/genai-guide>` and - :doc:`Run LLMs with OpenVINO GenAI Flavor <../learn-openvino/llm_inference_guide/genai-guide>`. + OpenVINO GenAI streamlines application development by providing LLM-specific interfaces for + easy integration of language models, handling tokenization and text generation. + For installation and usage instructions, check + :doc:`OpenVINO GenAI installation <../openvino-workflow-generative>` and + :doc:`inference with OpenVINO GenAI <../openvino-workflow-generative/inference-with-genai>`. .. dropdown:: Building OpenVINO from Source diff --git a/docs/articles_en/get-started/install-openvino/install-openvino-genai.rst b/docs/articles_en/get-started/install-openvino/install-openvino-genai.rst index bbfaa7817017ef..026a76f2ee86d7 100644 --- a/docs/articles_en/get-started/install-openvino/install-openvino-genai.rst +++ b/docs/articles_en/get-started/install-openvino/install-openvino-genai.rst @@ -1,24 +1,26 @@ Install OpenVINO™ GenAI ==================================== -OpenVINO GenAI is a new flavor of OpenVINO, aiming to simplify running inference of generative AI models. -It hides the complexity of the generation process and minimizes the amount of code required. -You can now provide a model and input context directly to OpenVINO, which performs tokenization of the -input text, executes the generation loop on the selected device, and returns the generated text. -For a quickstart guide, refer to the :doc:`GenAI API Guide <../../learn-openvino/llm_inference_guide/genai-guide>`. - -To see GenAI in action, check the Jupyter notebooks: -`LLM-powered Chatbot `__ and +OpenVINO GenAI is a tool, simplifying generative AI model inference. It is based on the +OpenVINO Runtime, hiding the complexity of the generation process and minimizing the amount of +code required. You provide a model and the input context directly to the tool, while it +performs tokenization of the input text, executes the generation loop on the selected device, +and returns the generated content. For a quickstart guide, refer to the +:doc:`GenAI API Guide <../../openvino-workflow-generative/inference-with-genai>`. + +To see OpenVINO GenAI in action, check these Jupyter notebooks: +`LLM-powered Chatbot `__ +and `LLM Instruction-following pipeline `__. -The OpenVINO GenAI flavor is available for installation via PyPI and Archive distributions. +OpenVINO GenAI is available for installation via PyPI and Archive distributions. A `detailed guide `__ on how to build OpenVINO GenAI is available in the OpenVINO GenAI repository. PyPI Installation ############################### -To install the GenAI flavor of OpenVINO via PyPI, follow the standard :doc:`installation steps `, +To install the GenAI package via PyPI, follow the standard :doc:`installation steps `, but use the *openvino-genai* package instead of *openvino*: .. code-block:: python @@ -28,9 +30,9 @@ but use the *openvino-genai* package instead of *openvino*: Archive Installation ############################### -The OpenVINO GenAI archive package includes the OpenVINO™ Runtime and :doc:`Tokenizers <../../learn-openvino/llm_inference_guide/ov-tokenizers>`. -To install the GenAI flavor of OpenVINO from an archive file, follow the standard installation steps for your system -but instead of using the vanilla package file, download the one with OpenVINO GenAI: +The OpenVINO GenAI archive package includes the OpenVINO™ Runtime, as well as :doc:`Tokenizers <../../openvino-workflow-generative/ov-tokenizers>`. +It installs the same way as the standard OpenVINO Runtime, so follow its installation steps, +just use the OpenVINO GenAI package instead: Linux ++++++++++++++++++++++++++ diff --git a/docs/articles_en/learn-openvino.rst b/docs/articles_en/learn-openvino.rst index 98797c9c67c126..762e51985159d3 100644 --- a/docs/articles_en/learn-openvino.rst +++ b/docs/articles_en/learn-openvino.rst @@ -14,7 +14,6 @@ Learn OpenVINO Interactive Tutorials (Python) Sample Applications (Python & C++) - Generative AI workflow @@ -28,6 +27,3 @@ as well as an experienced user. | :doc:`OpenVINO Samples ` | The OpenVINO samples (Python and C++) are simple console applications that show how to use specific OpenVINO API features. They can assist you in executing tasks such as loading a model, running inference, querying particular device capabilities, etc. - -| :doc:`Generative AI workflow ` -| Detailed information on how OpenVINO accelerates Generative AI use cases and what models it supports. This tutorial provides instructions for running Generative AI models using Hugging Face Optimum Intel and Native OpenVINO APIs. diff --git a/docs/articles_en/learn-openvino/llm_inference_guide.rst b/docs/articles_en/openvino-workflow-generative.rst similarity index 77% rename from docs/articles_en/learn-openvino/llm_inference_guide.rst rename to docs/articles_en/openvino-workflow-generative.rst index 8401923b8c7ac6..5ac880ace110c3 100644 --- a/docs/articles_en/learn-openvino/llm_inference_guide.rst +++ b/docs/articles_en/openvino-workflow-generative.rst @@ -9,10 +9,10 @@ Generative AI workflow :maxdepth: 1 :hidden: - Generative Model Preparation - Inference with OpenVINO GenAI - Inference with Optimum Intel - OpenVINO Tokenizers + Generative Model Preparation + Inference with OpenVINO GenAI + Inference with Optimum Intel + OpenVINO Tokenizers @@ -40,7 +40,7 @@ options: `Check out the OpenVINO GenAI Quick-start Guide [PDF] `__ - .. tab-item:: Hugging Face integration + .. tab-item:: Optimum Intel (Hugging Face integration) | - Suggested for prototyping and, if the use case is not covered by OpenVINO GenAI, production. | - Bigger footprint and more dependencies. @@ -55,10 +55,16 @@ options: as well as conversion on the fly. For integration with the final product it may offer lower performance, though. -Note that the base version of OpenVINO may also be used to run generative AI. Although it may -offer a simpler environment, with fewer dependencies, it has significant limitations and a more -demanding implementation process. For reference, see -`the article on generative AI usage of OpenVINO 2024.6 `__. + .. tab-item:: Base OpenVINO (not recommended) + + Note that the base version of OpenVINO may also be used to run generative AI. Although it may + offer a simpler environment, with fewer dependencies, it has significant limitations and a more + demanding implementation process. + + To learn more, refer to the article for the 2024.6 OpenVINO version: + `Generative AI with Base OpenVINO `__ + + The advantages of using OpenVINO for generative model deployment: @@ -90,8 +96,8 @@ The advantages of using OpenVINO for generative model deployment: Proceed to guides on: -* :doc:`OpenVINO GenAI Flavor <./llm_inference_guide/genai-guide>` -* :doc:`Hugging Face and Optimum Intel <./llm_inference_guide/llm-inference-hf>` -* `Generative AI with Base OpenVINO `__ +* :doc:`OpenVINO GenAI <./openvino-workflow-generative/inference-with-genai>` +* :doc:`Hugging Face and Optimum Intel <./openvino-workflow-generative/inference-with-optimum-intel>` +* `Generative AI with Base OpenVINO `__ diff --git a/docs/articles_en/learn-openvino/llm_inference_guide/genai-model-preparation.rst b/docs/articles_en/openvino-workflow-generative/genai-model-preparation.rst similarity index 100% rename from docs/articles_en/learn-openvino/llm_inference_guide/genai-model-preparation.rst rename to docs/articles_en/openvino-workflow-generative/genai-model-preparation.rst diff --git a/docs/articles_en/learn-openvino/llm_inference_guide/genai-guide.rst b/docs/articles_en/openvino-workflow-generative/inference-with-genai.rst similarity index 99% rename from docs/articles_en/learn-openvino/llm_inference_guide/genai-guide.rst rename to docs/articles_en/openvino-workflow-generative/inference-with-genai.rst index 43f9435bf79b1b..7e26f0891f779a 100644 --- a/docs/articles_en/learn-openvino/llm_inference_guide/genai-guide.rst +++ b/docs/articles_en/openvino-workflow-generative/inference-with-genai.rst @@ -2,13 +2,13 @@ Inference with OpenVINO GenAI =============================================================================================== .. meta:: - :description: Learn how to use the OpenVINO GenAI flavor to execute LLM models. + :description: Learn how to use OpenVINO GenAI to execute LLM models. .. toctree:: :maxdepth: 1 :hidden: - NPU inference of LLMs + NPU inference of LLMs OpenVINO™ GenAI is a library of pipelines and methods, extending the OpenVINO runtime to work @@ -16,7 +16,7 @@ with generative AI models more efficiently. This article provides reference code on its usage. Note that the base OpenVINO version will not work with these instructions, make sure to :doc:`install OpenVINO with GenAI <../../get-started/install-openvino/install-openvino-genai>`. -.. image:: ../../assets/images/genai_main_diagram.svg +.. image:: ../assets/images/genai_main_diagram.svg :align: center :alt: OpenVINO GenAI workflow diagram diff --git a/docs/articles_en/learn-openvino/llm_inference_guide/genai-guide-npu.rst b/docs/articles_en/openvino-workflow-generative/inference-with-genai/inference-with-genai-on-npu.rst similarity index 97% rename from docs/articles_en/learn-openvino/llm_inference_guide/genai-guide-npu.rst rename to docs/articles_en/openvino-workflow-generative/inference-with-genai/inference-with-genai-on-npu.rst index 8fb6ad27c4232f..540d13894c7d02 100644 --- a/docs/articles_en/learn-openvino/llm_inference_guide/genai-guide-npu.rst +++ b/docs/articles_en/openvino-workflow-generative/inference-with-genai/inference-with-genai-on-npu.rst @@ -2,9 +2,10 @@ Inference with OpenVINO GenAI ========================================== .. meta:: - :description: Learn how to use the OpenVINO GenAI flavor to execute LLM models on NPU. + :description: Learn how to use OpenVINO GenAI to execute LLM models on NPU. -This guide will give you extra details on how to utilize NPU with the GenAI flavor. + +This guide will give you extra details on how to utilize NPU with OpenVINO GenAI. :doc:`See the installation guide <../../get-started/install-openvino/install-openvino-genai>` for information on how to start. @@ -24,6 +25,10 @@ Note that for systems based on Intel® Core™ Ultra Processors Series 2, more t may be required to run prompts over 1024 tokens on models exceeding 7B parameters, such as Llama-2-7B, Mistral-0.2-7B, and Qwen-2-7B. +Make sure your model works with NPU. Some models may not be supported, for example, +**the FLUX.1 pipeline is currently not supported by the device**. + + Export an LLM model via Hugging Face Optimum-Intel ################################################## diff --git a/docs/articles_en/learn-openvino/llm_inference_guide/llm-inference-hf.rst b/docs/articles_en/openvino-workflow-generative/inference-with-optimum-intel.rst similarity index 100% rename from docs/articles_en/learn-openvino/llm_inference_guide/llm-inference-hf.rst rename to docs/articles_en/openvino-workflow-generative/inference-with-optimum-intel.rst diff --git a/docs/articles_en/learn-openvino/llm_inference_guide/ov-tokenizers.rst b/docs/articles_en/openvino-workflow-generative/ov-tokenizers.rst similarity index 99% rename from docs/articles_en/learn-openvino/llm_inference_guide/ov-tokenizers.rst rename to docs/articles_en/openvino-workflow-generative/ov-tokenizers.rst index 1dbd85e3ee59a5..c836eb52e99495 100644 --- a/docs/articles_en/learn-openvino/llm_inference_guide/ov-tokenizers.rst +++ b/docs/articles_en/openvino-workflow-generative/ov-tokenizers.rst @@ -6,7 +6,7 @@ generation with LLMs. Tokenizers convert the input text into a sequence of token corresponding IDs, so that the model can understand and process it during inference. The transformation of a sequence of numbers into a string is called detokenization. -.. image:: ../../assets/images/tokenization.svg +.. image:: ../assets/images/tokenization.svg :align: center There are two important points in the tokenizer-model relation: diff --git a/docs/articles_en/openvino-workflow/model-optimization-guide/weight-compression.rst b/docs/articles_en/openvino-workflow/model-optimization-guide/weight-compression.rst index 4b752b74187768..232e0f2c2a66b9 100644 --- a/docs/articles_en/openvino-workflow/model-optimization-guide/weight-compression.rst +++ b/docs/articles_en/openvino-workflow/model-optimization-guide/weight-compression.rst @@ -105,7 +105,7 @@ By default, weights are compressed asymmetrically to "INT8_ASYM" mode. print(results) For more details, refer to the article on how to - :doc:`infer LLMs using Optimum Intel <../../learn-openvino/llm_inference_guide/llm-inference-hf>`. + :doc:`infer LLMs using Optimum Intel <../../openvino-workflow-generative/inference-with-optimum-intel>`. .. tab-item:: Compression with NNCF :sync: nncf @@ -221,7 +221,7 @@ depending on the model. For more details, refer to the article on how to - :doc:`infer LLMs using Optimum Intel <../../../learn-openvino/llm_inference_guide/llm-inference-hf>`. + :doc:`infer LLMs using Optimum Intel <../../../openvino-workflow-generative/inference-with-optimum-intel>`. The code snippet below shows how to do 4-bit quantization of the model weights represented in OpenVINO IR using NNCF: @@ -344,7 +344,7 @@ load the compressed model later for faster time to first inference. .. tip:: Models optimized with with NNCF or Optimum Intel can be used with - :doc:`OpenVINO GenAI <../../learn-openvino/llm_inference_guide/genai-guide>`. + :doc:`OpenVINO GenAI <../../openvino-workflow-generative/inference-with-genai>`. Auto-tuning of Weight Compression Parameters diff --git a/docs/articles_en/openvino-workflow/model-preparation/convert-model-pytorch.rst b/docs/articles_en/openvino-workflow/model-preparation/convert-model-pytorch.rst index fc2637aba9139e..fa1b6b733bb548 100644 --- a/docs/articles_en/openvino-workflow/model-preparation/convert-model-pytorch.rst +++ b/docs/articles_en/openvino-workflow/model-preparation/convert-model-pytorch.rst @@ -179,7 +179,7 @@ It is recommended to address model outputs by the index rather then the name. Support for torch.export ######################## -`torch.export `__ is the current way to get a graph +`torch.export `__ is the current way to get a graph representation of a model (since PyTorch 2.1). It produces ``ExportedProgram`` which includes the graph representation in the FX format. To see why it has an advantage over the TorchScript representation, refer to `PyTorch documentation `__. @@ -198,11 +198,6 @@ Here is an example of how to convert a model obtained with ``torch.export``: exported_model = export(model, (torch.randn(1, 3, 224, 224),)) ov_model = convert_model(exported_model) -.. note:: - - This is an experimental feature. Use it only if you know that you need to. PyTorch version 2.2 - is recommended. Dynamic shapes are not supported yet. - Converting a PyTorch Model from Disk #################################### diff --git a/docs/articles_en/openvino-workflow/running-inference/inference-devices-and-modes/gpu-device/remote-tensor-api-gpu-plugin.rst b/docs/articles_en/openvino-workflow/running-inference/inference-devices-and-modes/gpu-device/remote-tensor-api-gpu-plugin.rst index f1018b82cf40ee..ce243dbd87f9ae 100644 --- a/docs/articles_en/openvino-workflow/running-inference/inference-devices-and-modes/gpu-device/remote-tensor-api-gpu-plugin.rst +++ b/docs/articles_en/openvino-workflow/running-inference/inference-devices-and-modes/gpu-device/remote-tensor-api-gpu-plugin.rst @@ -621,7 +621,7 @@ Two types of map entries are possible: descriptor and container. Descriptor sets the expected structure and possible parameter values of the map. For possible low-level properties and their description, refer to the header file: -`remote_properties.hpp `__. +`remote_properties.hpp `__. Examples ########################################################### diff --git a/docs/articles_en/openvino-workflow/running-inference/inference-devices-and-modes/npu-device.rst b/docs/articles_en/openvino-workflow/running-inference/inference-devices-and-modes/npu-device.rst index a3bdbfc7c2b7d1..ed28633f1a9198 100644 --- a/docs/articles_en/openvino-workflow/running-inference/inference-devices-and-modes/npu-device.rst +++ b/docs/articles_en/openvino-workflow/running-inference/inference-devices-and-modes/npu-device.rst @@ -22,7 +22,7 @@ for more streamlined resource management. NPU Plugin is now available through all relevant OpenVINO distribution channels. | **Supported Platforms:** -| Host: Intel® Core™ Ultra (former Meteor Lake) +| Host: Intel® Core™ Ultra series | NPU device: NPU 3720 | OS: Ubuntu* 22.04 64-bit (with Linux kernel 6.6+), MS Windows* 11 64-bit (22H2, 23H2) @@ -33,10 +33,10 @@ Follow the instructions below to install the latest NPU drivers: * `Linux driver `__ -The plugin uses the graph extension API exposed by the driver to convert the OpenVINO specific representation -of the model into a proprietary format. The compiler included in the user mode driver (UMD) performs -platform specific optimizations in order to efficiently schedule the execution of network layers and -memory transactions on various NPU hardware submodules. +The plugin uses the graph extension API exposed by the driver to convert the OpenVINO specific +representation of the model into a proprietary format. The compiler included in the user mode +driver (UMD) performs platform specific optimizations in order to efficiently schedule the +execution of network layers and memory transactions on various NPU hardware submodules. To use NPU for inference, pass the device name to the ``ov::Core::compile_model()`` method: diff --git a/docs/articles_en/openvino-workflow/running-inference/inference-devices-and-modes/query-device-properties.rst b/docs/articles_en/openvino-workflow/running-inference/inference-devices-and-modes/query-device-properties.rst index 913d0090b92a52..a704833b374f19 100644 --- a/docs/articles_en/openvino-workflow/running-inference/inference-devices-and-modes/query-device-properties.rst +++ b/docs/articles_en/openvino-workflow/running-inference/inference-devices-and-modes/query-device-properties.rst @@ -88,7 +88,7 @@ The ``ov::CompiledModel`` class is also extended to support the properties: * ``ov::CompiledModel::set_property`` For documentation about OpenVINO common device-independent properties, refer to -`properties.hpp (GitHub) `__. +`properties.hpp (GitHub) `__. Device-specific configuration keys can be found in a corresponding device folders, for example, ``openvino/runtime/intel_gpu/properties.hpp``. diff --git a/docs/articles_en/openvino-workflow/running-inference/optimize-inference/optimizing-latency.rst b/docs/articles_en/openvino-workflow/running-inference/optimize-inference/optimizing-latency.rst index 7d6df9166f163e..febba3134cad40 100644 --- a/docs/articles_en/openvino-workflow/running-inference/optimize-inference/optimizing-latency.rst +++ b/docs/articles_en/openvino-workflow/running-inference/optimize-inference/optimizing-latency.rst @@ -14,34 +14,62 @@ Optimizing for Latency improve throughput without degrading latency. -A significant portion of deep learning use cases involve applications loading a single model and using a single input at a time, which is the of typical "consumer" scenario. -While an application can create more than one request if needed, for example to support :ref:`asynchronous inputs population `, its **inference performance depends on how many requests are being inferenced in parallel** on a device. - -Similarly, when multiple models are served on the same device, it is important whether the models are executed simultaneously or in a chain, for example, in the inference pipeline. -As expected, the easiest way to achieve **low latency is by running only one inference at a time** on one device. Accordingly, any additional concurrency usually results in latency rising fast. - -However, some conventional "root" devices (i.e., CPU or GPU) can be in fact internally composed of several "sub-devices". In many cases, letting OpenVINO leverage the "sub-devices" transparently helps to improve application's throughput (e.g., serve multiple clients simultaneously) without degrading latency. For example, multi-socket CPUs can deliver as many requests at the same minimal latency as there are NUMA nodes in the system. Similarly, a multi-tile GPU, which is essentially multiple GPUs in a single package, can deliver a multi-tile scalability with the number of inference requests, while preserving the single-tile latency. - -Typically, human expertise is required to get more "throughput" out of the device, even in the inherently latency-oriented cases. OpenVINO can take this configuration burden via :doc:`high-level performance hints `, the `ov::hint::PerformanceMode::LATENCY `__ specified for the ``ov::hint::performance_mode`` property for the ``compile_model``. +An application that loads a single model and uses a single input at a time is +a widespread use case in deep learning. Surely, more requests can be created if +needed, for example to support :ref:`asynchronous input population `. +However, **the number of parallel requests affects inference performance** +of the application. + +Also, running inference of multiple models on the same device relies on whether the models +are executed simultaneously or in a chain: the more inference tasks at once, the higher the +latency. + +However, devices such as CPUs and GPUs may be composed of several "sub-devices". OpeVINO can +handle them transparently, when serving multiple clients, improving application's throughput +without impacting latency. What is more, multi-socket CPUs can deliver as many requests at the +same minimal latency as there are NUMA nodes in the system. Similarly, a multi-tile GPU, +which is essentially multiple GPUs in a single package, can deliver a multi-tile +scalability with the number of inference requests, while preserving the +single-tile latency. .. note:: - :doc:`OpenVINO performance hints ` is a recommended way for performance configuration, which is both device-agnostic and future-proof. + Balancing throughput and latency by manual configuration requires strong expertise + in this area. Instead, you should specify :doc:`performance hints ` + for ``compile_model``, which is a device-agnostic and future-proof option. -**When multiple models are to be used simultaneously**, consider running inference on separate devices for each of them. Finally, when multiple models are executed in parallel on a device, using additional ``ov::hint::model_priority`` may help to define relative priorities of the models. Refer to the documentation on the :doc:`OpenVINO feature support for devices <../../../../about-openvino/compatibility-and-support/supported-devices>` to check if your device supports the feature. +**For running multiple models simultaneously**, consider using separate devices for each of +them. When multiple models are executed in parallel on a device, use ``ov::hint::model_priority`` +to define relative priorities of the models. Note that this feature may not be available for +some devices. **First-Inference Latency and Model Load/Compile Time** -In some cases, model loading and compilation contribute to the "end-to-end" latency more than usual. -For example, when the model is used exactly once, or when it is unloaded and reloaded in a cycle, to free the memory for another inference due to on-device memory limitations. - -Such a "first-inference latency" scenario may pose an additional limitation on the model load\compilation time, as inference accelerators (other than the CPU) usually require a certain level of model compilation upon loading. -The :doc:`model caching ` option is a way to lessen the impact over multiple application runs. If model caching is not possible, for example, it may require write permissions for the application, the CPU offers the fastest model load time almost every time. +First-inference latency is the longest time the application requires to finish inference. +This means it includes the time to load and compile the model, which happens at the first +execution only. For some scenarios it may be a significant factor, for example, if the model is +always used just once or is unloaded after each run to free up the memory. + +In such cases the device choice is especially important. The CPU offers the fastest model load +time nearly every time. Other accelerators usually take longer to compile a model but may be +better for inference. In such cases, :doc:`Model caching ` +may reduce latency, as long as there are no additional limitations in write permissions +for the application. + +To improve "first-inference latency", you may choose between mapping the model into memory +(the default option) and reading it (the older solution). While mapping is better in most cases, +sometimes it may increase latency, especially when the model is located on a removable or a +network drive. To switch between the two, specify the +`ov::enable_mmap() <../../../api/ie_python_api/_autosummary/openvino.frontend.FrontEnd.html#openvino.frontend.FrontEnd.load>` +property for the ``ov::Core`` as either ``True`` or ``False``. + +You can also use :doc:`AUTO device selection inference mode <../inference-devices-and-modes/auto-device-selection>` +to deal with first-inference latency. +It starts inference on the CPU, while waiting for the proper accelerator to load +the model. At that point, it shifts to the new device seamlessly. -To improve common "first-inference latency" scenario, model reading was replaced with model mapping (using `mmap`) into a memory. But in some use cases (first of all, if model is located on removable or network drive) mapping may lead to latency increase. To switch mapping to reading, specify ``ov::enable_mmap(false)`` property for the ``ov::Core``. - -Another way of dealing with first-inference latency is using the :doc:`AUTO device selection inference mode <../inference-devices-and-modes/auto-device-selection>`. It starts inference on the CPU, while waiting for the actual accelerator to load the model. At that point, it shifts to the new device seamlessly. - -Finally, note that any :doc:`throughput-oriented options ` may significantly increase the model uptime. +.. note:: + Keep in mind that any :doc:`throughput-oriented options ` + may significantly increase inference time. diff --git a/docs/articles_en/openvino-workflow/running-inference/optimize-inference/optimizing-latency/model-caching-overview.rst b/docs/articles_en/openvino-workflow/running-inference/optimize-inference/optimizing-latency/model-caching-overview.rst index b3253f775bdb02..b1b6da190a0192 100644 --- a/docs/articles_en/openvino-workflow/running-inference/optimize-inference/optimizing-latency/model-caching-overview.rst +++ b/docs/articles_en/openvino-workflow/running-inference/optimize-inference/optimizing-latency/model-caching-overview.rst @@ -9,16 +9,16 @@ Model Caching Overview As described in :doc:`Integrate OpenVINO™ with Your Application <../../integrate-openvino-with-your-application>`, -a common application flow consists of the following steps: +a common workflow consists of the following steps: 1. | **Create a Core object**: | First step to manage available devices and read model objects 2. | **Read the Intermediate Representation**: - | Read an Intermediate Representation file into an object of the `ov::Model `__ + | Read an Intermediate Representation file into the `ov::Model `__ object 3. | **Prepare inputs and outputs**: | If needed, manipulate precision, memory layout, size or color format 4. | **Set configuration**: - | Pass device-specific loading configurations to the device + | Add device-specific loading configurations to the device 5. | **Compile and Load Network to device**: | Use the `ov::Core::compile_model() `__ method with a specific device 6. | **Set input data**: @@ -32,14 +32,15 @@ automatically and reuses it to significantly reduce the model compilation time. .. important:: - Not all devices support the network import/export feature. They will perform normally but will not + Not all devices support import/export of models. They will perform normally but will not enable the compilation stage speed-up. -Set "cache_dir" config option to enable model caching +Set configuration options +++++++++++++++++++++++++++++++++++++++++++++++++++++ -To enable model caching, the application must specify a folder to store the cached blobs: +| Use the ``device_name`` option to specify the inference device. +| Specify ``cache_dir`` to enable model caching. .. tab-set:: @@ -58,23 +59,25 @@ To enable model caching, the application must specify a folder to store the cach :fragment: [ov:caching:part0] -With this code, if the device specified by ``device_name`` supports import/export model capability, -a cached blob (the ``.cl_cache`` and ``.blob`` file for GPU and CPU respectively) is automatically +If the specified device supports import/export of models, +a cached blob file: ``.cl_cache`` (GPU) or ``.blob`` (CPU) is automatically created inside the ``/path/to/cache/dir`` folder. -If the device does not support the import/export capability, cache is not created and no error is thrown. +If the device does not support import/export of models, the cache is not +created and no error is thrown. -Note that the first ``compile_model`` operation takes slightly longer, as the cache needs to be created - -the compiled blob is saved into a cache file: +Note that the first ``compile_model`` operation takes slightly more time, +as the cache needs to be created - the compiled blob is saved into a file: .. image:: ../../../../assets/images/caching_enabled.svg -Make it even faster: use compile_model(modelPath) +Use optimized methods +++++++++++++++++++++++++++++++++++++++++++++++++++ -In some cases, applications do not need to customize inputs and outputs every time. Such application always -call ``model = core.read_model(...)``, then ``core.compile_model(model, ..)``, which can be further optimized. -For these cases, there is a more convenient API to compile the model in a single call, skipping the read step: +Applications do not always require an initial customization of inputs and +outputs, as they can call ``model = core.read_model(...)``, then ``core.compile_model(model, ..)``, +which can be further optimized. Thus, the model can be compiled conveniently in a single call, +skipping the read step: .. tab-set:: @@ -93,7 +96,7 @@ For these cases, there is a more convenient API to compile the model in a single :fragment: [ov:caching:part1] -With model caching enabled, the total load time is even shorter, if ``read_model`` is optimized as well. +The total load time is even shorter, when model caching is enabled and ``read_model`` is optimized as well. .. tab-set:: @@ -117,8 +120,9 @@ With model caching enabled, the total load time is even shorter, if ``read_model Advanced Examples ++++++++++++++++++++ -Not every device supports the network import/export capability. For those that don't, enabling caching has no effect. -To check in advance if a particular device supports model caching, your application can use the following code: +Enabling model caching has no effect when the specified device does not support +import/export of models. To check in advance if a particular device supports +model caching, use the following code in your application: .. tab-set:: @@ -136,10 +140,12 @@ To check in advance if a particular device supports model caching, your applicat :language: cpp :fragment: [ov:caching:part3] -Set "cache_encryption_callbacks" config option to enable cache encryption +Enable cache encryption +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -If model caching is enabled in the CPU Plugin, the model topology can be encrypted while it is saved to the cache and decrypted when it is loaded from the cache. Currently, this property can be set only in ``compile_model``. +If model caching is enabled in the CPU Plugin, set the "cache_encryption_callbacks" +config option to encrypt the model while caching it and decrypt it when +loading it from the cache. Currently, this property can be set only in ``compile_model``. .. tab-set:: @@ -157,7 +163,7 @@ If model caching is enabled in the CPU Plugin, the model topology can be encrypt :language: cpp :fragment: [ov:caching:part4] -If model caching is enabled in the GPU Plugin, the model topology can be encrypted while it is saved to the cache and decrypted when it is loaded from the cache. Full encryption only works when the ``CacheMode`` property is set to ``OPTIMIZE_SIZE``. +Full encryption only works when the ``CacheMode`` property is set to ``OPTIMIZE_SIZE``. .. tab-set:: @@ -177,4 +183,6 @@ If model caching is enabled in the GPU Plugin, the model topology can be encrypt .. important:: - Currently, this property is supported only by the CPU and GPU plugins. For other HW plugins, setting this property will not encrypt/decrypt the model topology in cache and will not affect performance. + Currently, encryption is supported only by the CPU and GPU plugins. Enabling this + feature for other HW plugins will not encrypt/decrypt model topology in the + cache and will not affect performance. diff --git a/docs/articles_en/openvino-workflow/running-inference/stateful-models.rst b/docs/articles_en/openvino-workflow/running-inference/stateful-models.rst index d00fd19c4d636d..55626d485c412d 100644 --- a/docs/articles_en/openvino-workflow/running-inference/stateful-models.rst +++ b/docs/articles_en/openvino-workflow/running-inference/stateful-models.rst @@ -66,7 +66,7 @@ from the application code to OpenVINO and all related internal work is hidden fr There are three methods of turning an OpenVINO model into a stateful one: -* :doc:`Optimum-Intel <../../learn-openvino/llm_inference_guide/llm-inference-hf>` - the most user-friendly option. All necessary optimizations +* :doc:`Optimum-Intel <../../openvino-workflow-generative/inference-with-optimum-intel>` - the most user-friendly option. All necessary optimizations are recognized and applied automatically. The drawback is, the tool does not work with all models. diff --git a/docs/articles_en/openvino-workflow/running-inference/stateful-models/obtaining-stateful-openvino-model.rst b/docs/articles_en/openvino-workflow/running-inference/stateful-models/obtaining-stateful-openvino-model.rst index 12a21a5dd1fad0..0ad6530cb61188 100644 --- a/docs/articles_en/openvino-workflow/running-inference/stateful-models/obtaining-stateful-openvino-model.rst +++ b/docs/articles_en/openvino-workflow/running-inference/stateful-models/obtaining-stateful-openvino-model.rst @@ -10,7 +10,7 @@ and you have three ways to do it: * `Optimum-Intel `__ - an automated solution applicable to a selection of models (not covered by this article, for a usage guide - refer to the :doc:`LLM Inference with Hugging Face and Optimum Intel <../../../learn-openvino/llm_inference_guide>` article). + refer to the :doc:`LLM Inference with Hugging Face and Optimum Intel <../../../openvino-workflow-generative>` article). * :ref:`MakeStateful transformation ` - to choose which pairs of Parameter and Result to replace. * :ref:`LowLatency2 transformation ` - to detect and replace Parameter diff --git a/docs/dev/ci/github_actions/custom_actions.md b/docs/dev/ci/github_actions/custom_actions.md index d2c2ca149b20b9..e65650aea2b741 100644 --- a/docs/dev/ci/github_actions/custom_actions.md +++ b/docs/dev/ci/github_actions/custom_actions.md @@ -29,14 +29,12 @@ Since `actions/setup-python` does not work on the Linux ARM64 machines, pip-cache-path: ${{ env.PIP_CACHE_PATH }} should-setup-pip-paths: 'true' self-hosted-runner: 'true' - show-cache-info: 'true' ``` where: * `version` - the Python version to install in the `MAJOR.MINOR` format * `pip-cache-path` - the path to the `pip` cache on the mounted share. Read more in the [shares and caches](./caches.md) documentation * `should-setup-pip-paths` - indicates whether the action should set up the `PIP_CACHE_DIR` and `PIP_INSTALL_PATH` environment variables for later usage * `self-hosted-runner` - indicates whether the runner is self-hosted. Learn more about [available runners](./runners.md) -* `show-cache-info` - indicates whether the action should show the share space occupied by the `pip` cache ## System Info Print diff --git a/docs/dev/ov_dependencies.txt b/docs/dev/ov_dependencies.txt index cb64e4d5a6534c..71c9c906f9640d 100644 --- a/docs/dev/ov_dependencies.txt +++ b/docs/dev/ov_dependencies.txt @@ -1,6 +1,6 @@ # Copyright (C) 2024 Intel Corporation # SPDX-License-Identifier: Apache-2.0 -#This file provides a comprehensive list of all dependencies of OpenVINO 2024.6 +#This file provides a comprehensive list of all dependencies of OpenVINO 2025.0 #The file is part of the automation pipeline for posting OpenVINO IR models on the HuggingFace Hub, including OneBOM dependency checks. diff --git a/docs/notebooks/llm-agent-functioncall-qwen-with-output.rst b/docs/notebooks/llm-agent-functioncall-qwen-with-output.rst index 07f84987dca33e..19b3f849a0f102 100644 --- a/docs/notebooks/llm-agent-functioncall-qwen-with-output.rst +++ b/docs/notebooks/llm-agent-functioncall-qwen-with-output.rst @@ -258,7 +258,7 @@ pipeline. You can get additional inference speed improvement with `Dynamic Quantization of activations and KV-cache quantization on -CPU `__. +CPU `__. These options can be enabled with ``ov_config`` as follows: .. code:: ipython3 diff --git a/docs/notebooks/llm-agent-react-langchain-with-output.rst b/docs/notebooks/llm-agent-react-langchain-with-output.rst index 9adb0311542426..34c81ef6e11e75 100644 --- a/docs/notebooks/llm-agent-react-langchain-with-output.rst +++ b/docs/notebooks/llm-agent-react-langchain-with-output.rst @@ -70,12 +70,12 @@ Prerequisites import requests from pathlib import Path - + r = requests.get( url="https://raw.githubusercontent.com/openvinotoolkit/openvino_notebooks/latest/utils/notebook_utils.py", ) open("notebook_utils.py", "w").write(r.text) - + if not Path("cmd_helper.py").exists(): r = requests.get(url="https://raw.githubusercontent.com/openvinotoolkit/openvino_notebooks/latest/utils/cmd_helper.py") open("cmd_helper.py", "w", encoding="utf-8").write(r.text) @@ -92,9 +92,9 @@ Prerequisites .. code:: ipython3 import os - + os.environ["GIT_CLONE_PROTECTION_ACTIVE"] = "false" - + %pip install -Uq pip %pip uninstall -q -y optimum optimum-intel %pip install --pre -Uq "openvino>=2024.5.0" openvino-tokenizers[transformers] --extra-index-url https://storage.openvinotoolkit.org/simple/wheels/nightly @@ -131,20 +131,20 @@ creating custom tools. .. code:: ipython3 from langchain_core.tools import tool - - + + @tool def multiply(first_int: int, second_int: int) -> int: """Multiply two integers together.""" return first_int * second_int - - + + @tool def add(first_int: int, second_int: int) -> int: "Add two integers." return first_int + second_int - - + + @tool def exponentiate(base: int, exponent: int) -> int: "Exponentiate the base to the exponent power." @@ -213,22 +213,22 @@ previous agent tool invocations and the corresponding tool outputs. .. code:: ipython3 PREFIX = """Respond to the human as helpfully and accurately as possible. You have access to the following tools:""" - + FORMAT_INSTRUCTIONS = """Use a json blob to specify a tool by providing an action key (tool name) and an action_input key (tool input). - + Valid "action" values: "Final Answer" or {tool_names} - + Provide only ONE action per $JSON_BLOB, as shown: - + ``` {{{{ "action": $TOOL_NAME, "action_input": $INPUT }}}} ``` - + Follow this format: - + Question: input question to answer Thought: consider previous and subsequent steps Action: @@ -245,10 +245,10 @@ previous agent tool invocations and the corresponding tool outputs. "action_input": "Final response to human" }}}} ```""" - + SUFFIX = """Begin! Reminder to ALWAYS respond with a valid json blob of a single action. Use tools if necessary. Respond directly if appropriate. Format is Action:```$JSON_BLOB```then Observation:. Thought:""" - + HUMAN_MESSAGE_TEMPLATE = "{input}\n\n{agent_scratchpad}" Create LLM @@ -294,7 +294,7 @@ select following models as LLM in agent pipeline. .. code:: python - ## login to huggingfacehub to get access to pretrained model + ## login to huggingfacehub to get access to pretrained model from huggingface_hub import notebook_login, whoami @@ -318,16 +318,16 @@ folder. .. code:: ipython3 import ipywidgets as widgets - + llm_model_ids = ["Qwen/Qwen2.5-7B-Instruct", "Qwen/Qwen2.5-3B-Instruct", "Qwen/qwen2.5-14b-instruct", "meta-llama/Meta-Llama-3.1-8B-Instruct"] - + llm_model_id = widgets.Dropdown( options=llm_model_ids, value=llm_model_ids[0], description="Model:", disabled=False, ) - + llm_model_id @@ -342,10 +342,10 @@ folder. .. code:: ipython3 from cmd_helper import optimum_cli - + llm_model_path = llm_model_id.value.split("/")[-1] repo_name = llm_model_id.value.split("/")[0] - + if not Path(llm_model_path).exists(): optimum_cli( llm_model_id.value, llm_model_path, additional_args={"task": "text-generation-with-past", "weight-format": "int4", "group-size": "128", "ratio": "1.0"} @@ -359,9 +359,9 @@ Select inference device for LLM .. code:: ipython3 from notebook_utils import device_widget - + device = device_widget("CPU", exclude=["NPU"]) - + device @@ -383,37 +383,37 @@ information `__. from langchain_huggingface import HuggingFacePipeline from transformers.generation.stopping_criteria import StoppingCriteriaList, StoppingCriteria - + import openvino.properties as props import openvino.properties.hint as hints import openvino.properties.streams as streams - - + + class StopSequenceCriteria(StoppingCriteria): """ This class can be used to stop generation whenever a sequence of tokens is encountered. - + Args: stop_sequences (`str` or `List[str]`): The sequence (or list of sequences) on which to stop execution. tokenizer: The tokenizer used to decode the model outputs. """ - + def __init__(self, stop_sequences, tokenizer): if isinstance(stop_sequences, str): stop_sequences = [stop_sequences] self.stop_sequences = stop_sequences self.tokenizer = tokenizer - + def __call__(self, input_ids, scores, **kwargs) -> bool: decoded_output = self.tokenizer.decode(input_ids.tolist()[0]) return any(decoded_output.endswith(stop_sequence) for stop_sequence in self.stop_sequences) - - + + ov_config = {hints.performance_mode(): hints.PerformanceMode.LATENCY, streams.num(): "1", props.cache_dir(): ""} stop_tokens = ["Observation:"] - + ov_llm = HuggingFacePipeline.from_model_id( model_id=llm_model_path, task="text-generation", @@ -425,20 +425,20 @@ information `__. }, pipeline_kwargs={"max_new_tokens": 2048}, ) - + tokenizer = ov_llm.pipeline.tokenizer ov_llm.pipeline._forward_params["stopping_criteria"] = StoppingCriteriaList([StopSequenceCriteria(stop_tokens, tokenizer)]) .. code:: ipython3 from langchain_huggingface import ChatHuggingFace - + ov_chat = ChatHuggingFace(llm=ov_llm, verbose=True) ov_chat = ov_chat.bind(skip_prompt=True, stop=["Observation:"]) You can get additional inference speed improvement with `Dynamic Quantization of activations and KV-cache quantization on -CPU `__. +CPU `__. These options can be enabled with ``ov_config`` as follows: .. code:: ipython3 @@ -466,7 +466,7 @@ outputs back to the agent, and repeats. .. code:: ipython3 from langchain.agents import AgentExecutor, StructuredChatAgent - + agent = StructuredChatAgent.from_llm_and_tools( ov_chat, tools, @@ -494,11 +494,11 @@ prompt template. .. parsed-literal:: - - + + > Entering new AgentExecutor chain... Thought: First, we need to take 3 to the fifth power. Then we will find the sum of twelve and three. After that, we multiply the first result by the second result. Finally, we'll square the whole result. - + Action: ``` { @@ -512,7 +512,7 @@ prompt template. Observation: Observation: 243 Thought:Next, let's find the sum of twelve and three. - + Action: ``` { @@ -526,7 +526,7 @@ prompt template. Observation: Observation: 15 Thought:Now, we will multiply the result of \(3^5\) (which is 243) by the sum of 12 and 3 (which is 15). - + Action: ``` { @@ -539,8 +539,8 @@ prompt template. ``` Observation: Observation: 3645 - Thought:Thought: Now, we need to square the result of the multiplication (3645). - + Thought:Thought: Now, we need to square the result of the multiplication (3645). + Action: ``` { @@ -553,7 +553,7 @@ prompt template. ``` Observation: 13286025 Thought:Thought: I know what to respond - + Action: ``` { @@ -561,7 +561,7 @@ prompt template. "action_input": "The final result is 13286025." } ``` - + > Finished chain. @@ -598,10 +598,10 @@ words generated by agent. from langchain_community.utilities import WikipediaAPIWrapper from langchain_core.callbacks import CallbackManagerForToolRun from typing import Optional - + from pydantic import BaseModel, Field - - + + class WikipediaQueryRunWrapper(WikipediaQueryRun): def _run( self, @@ -610,17 +610,17 @@ words generated by agent. ) -> str: """Use the Wikipedia tool.""" return self.api_wrapper.run(text) - - + + api_wrapper = WikipediaAPIWrapper(top_k_results=2, doc_content_chars_max=1000) - - + + class WikiInputs(BaseModel): """inputs to the wikipedia tool.""" - + text: str = Field(description="query to look up on wikipedia.") - - + + wikipedia = WikipediaQueryRunWrapper( description="A wrapper around Wikipedia. Useful for when you need to answer general questions about people, places, companies, facts, historical events, or other subjects. Input should be a search query.", args_schema=WikiInputs, @@ -652,8 +652,8 @@ In this examples, we will create 2 customized tools for import urllib.parse import json5 - - + + @tool def painting(prompt: str) -> str: """ @@ -661,8 +661,8 @@ In this examples, we will create 2 customized tools for """ prompt = urllib.parse.quote(prompt) return json5.dumps({"image_url": f"https://image.pollinations.ai/prompt/{prompt}"}, ensure_ascii=False) - - + + painting.invoke({"prompt": "a cat"}) @@ -683,10 +683,10 @@ In this examples, we will create 2 customized tools for """ Get the current weather for `city_name` """ - + if not isinstance(city_name, str): raise TypeError("City name must be a string") - + key_selection = { "current_condition": [ "temp_C", @@ -697,15 +697,15 @@ In this examples, we will create 2 customized tools for ], } import requests - + resp = requests.get(f"https://wttr.in/{city_name}?format=j1") resp.raise_for_status() resp = resp.json() ret = {k: {_v: resp[k][0][_v] for _v in v} for k, v in key_selection.items()} - + return str(ret) - - + + weather.invoke({"city_name": "London"}) @@ -725,7 +725,7 @@ Create AI agent demo with Gradio UI .. code:: ipython3 tools = [wikipedia, painting, weather] - + agent = StructuredChatAgent.from_llm_and_tools( ov_chat, tools, @@ -741,28 +741,28 @@ Create AI agent demo with Gradio UI def partial_text_processor(partial_text, new_text): """ helper for updating partially generated answer, used by default - + Params: partial_text: text buffer for storing previosly generated text new_text: text update for the current step Returns: updated text string - + """ partial_text += new_text return partial_text - - + + def run_chatbot(history): """ callback function for running chatbot on submit button click - + Params: history: conversation history - + """ partial_text = "" - + for new_text in agent_executor.stream( {"input": history[-1][0]}, ): @@ -770,8 +770,8 @@ Create AI agent demo with Gradio UI partial_text = partial_text_processor(partial_text, new_text["output"]) history[-1][1] = partial_text yield history - - + + def request_cancel(): ov_chat.llm.pipeline.model.request.cancel() @@ -780,11 +780,11 @@ Create AI agent demo with Gradio UI if not Path("gradio_helper.py").exists(): r = requests.get(url="https://raw.githubusercontent.com/openvinotoolkit/openvino_notebooks/latest/notebooks/llm-agent-react/gradio_helper.py") open("gradio_helper.py", "w").write(r.text) - + from gradio_helper import make_demo - + demo = make_demo(run_fn=run_chatbot, stop_fn=request_cancel) - + try: demo.launch() except Exception: diff --git a/docs/notebooks/llm-agent-react-with-output.rst b/docs/notebooks/llm-agent-react-with-output.rst index 791355276fd2fd..8741f5f5254013 100644 --- a/docs/notebooks/llm-agent-react-with-output.rst +++ b/docs/notebooks/llm-agent-react-with-output.rst @@ -62,22 +62,22 @@ Prerequisites import os import requests - - + + r = requests.get( url="https://raw.githubusercontent.com/openvinotoolkit/openvino_notebooks/latest/utils/notebook_utils.py", ) open("notebook_utils.py", "w").write(r.text) - + r = requests.get( url="https://raw.githubusercontent.com/openvinotoolkit/openvino_notebooks/latest/utils/pip_helper.py", ) open("pip_helper.py", "w").write(r.text) - + os.environ["GIT_CLONE_PROTECTION_ACTIVE"] = "false" - + from pip_helper import pip_install - + pip_install( "-q", "--extra-index-url", @@ -122,16 +122,16 @@ Vietnamese, Thai, Arabic, and more. For more details, please refer to .. code:: ipython3 import ipywidgets as widgets - + llm_model_ids = ["Qwen/Qwen2.5-3B-Instruct", "Qwen/Qwen2.5-7B-Instruct", "Qwen/qwen2.5-14b-instruct"] - + llm_model_id = widgets.Dropdown( options=llm_model_ids, value=llm_model_ids[0], description="Model:", disabled=False, ) - + llm_model_id @@ -146,9 +146,9 @@ Vietnamese, Thai, Arabic, and more. For more details, please refer to .. code:: ipython3 from pathlib import Path - + llm_model_path = llm_model_id.value.split("/")[-1] - + if not Path(llm_model_path).exists(): !optimum-cli export openvino --model {llm_model_id.value} --task text-generation-with-past --trust-remote-code --weight-format int4 --group-size 128 --ratio 1.0 --sym {llm_model_path} @@ -160,9 +160,9 @@ Select inference device for LLM .. code:: ipython3 from notebook_utils import device_widget - + llm_device = device_widget("CPU", exclude=["NPU"]) - + llm_device @@ -213,7 +213,7 @@ Tokenizer class and pipelines API are compatible with Optimum models. You can find more details about OpenVINO LLM inference using HuggingFace Optimum API in `LLM inference -guide `__. +guide `__. .. code:: ipython3 @@ -226,15 +226,15 @@ guide `__ import openvino.properties as props import openvino.properties.hint as hints import openvino.properties.streams as streams - + import json import json5 import torch - + tokenizer = AutoTokenizer.from_pretrained(llm_model_path, trust_remote_code=True) - + ov_config = {hints.performance_mode(): hints.PerformanceMode.LATENCY, streams.num(): "1", props.cache_dir(): ""} - + llm = OVModelForCausalLM.from_pretrained( llm_model_path, device=llm_device.value, @@ -242,7 +242,7 @@ guide `__ config=AutoConfig.from_pretrained(llm_model_path, trust_remote_code=True), trust_remote_code=True, ) - + llm.generation_config.top_k = 1 llm.generation_config.max_length = 2000 @@ -260,31 +260,31 @@ received from tool calling.. class StopSequenceCriteria(StoppingCriteria): """ This class can be used to stop generation whenever a sequence of tokens is encountered. - + Args: stop_sequences (`str` or `List[str]`): The sequence (or list of sequences) on which to stop execution. tokenizer: The tokenizer used to decode the model outputs. """ - + def __init__(self, stop_sequences, tokenizer): if isinstance(stop_sequences, str): stop_sequences = [stop_sequences] self.stop_sequences = stop_sequences self.tokenizer = tokenizer - + def __call__(self, input_ids, scores, **kwargs) -> bool: decoded_output = self.tokenizer.decode(input_ids.tolist()[0]) return any(decoded_output.endswith(stop_sequence) for stop_sequence in self.stop_sequences) - - + + def text_completion(prompt: str, stop_words) -> str: im_end = "<|im_end|>" if im_end not in stop_words: stop_words = stop_words + [im_end] streamer = TextStreamer(tokenizer, timeout=60.0, skip_prompt=True, skip_special_tokens=True) - + stopping_criteria = StoppingCriteriaList([StopSequenceCriteria(stop_words, tokenizer)]) input_ids = torch.tensor([tokenizer.encode(prompt)]) generate_kwargs = dict( @@ -297,7 +297,7 @@ received from tool calling.. output = tokenizer.decode(output, errors="ignore") assert output.startswith(prompt) output = output[len(prompt) :].replace("<|endoftext|>", "").replace(im_end, "") - + for stop_str in stop_words: idx = output.find(stop_str) if idx != -1: @@ -339,13 +339,13 @@ parameter should be a sequence of messages that contains the .. code:: ipython3 TOOL_DESC = """{name_for_model}: Call this tool to interact with the {name_for_human} API. What is the {name_for_human} API useful for? {description_for_model} Parameters: {parameters}""" - + PROMPT_REACT = """Answer the following questions as best you can. You have access to the following APIs: - + {tools_text} - + Use the following format: - + Question: the input question you must answer Thought: you should always think about what to do Action: the action to take, should be one of [{tools_name_text}] @@ -354,9 +354,9 @@ parameter should be a sequence of messages that contains the ... (this Thought/Action/Action Input/Observation can be repeated zero or more times) Thought: I now know the final answer Final Answer: the final answer to the original input question - + Begin! - + Question: {query}""" Meanwhile we have to create function for consolidate the tools @@ -381,9 +381,9 @@ information and conversation history into the prompt template. raise NotImplementedError tools_text.append(tool) tools_text = "\n\n".join(tools_text) - + tools_name_text = ", ".join([tool_info["name_for_model"] for tool_info in list_of_tool_info]) - + messages = [{"role": "system", "content": "You are a helpful assistant."}] for i, (query, response) in enumerate(chat_history): if list_of_tool_info: @@ -397,9 +397,9 @@ information and conversation history into the prompt template. messages.append({"role": "user", "content": query}) if response: messages.append({"role": "assistant", "content": response}) - + prompt = tokenizer.apply_chat_template(messages, add_generation_prompt=True, tokenize=False, return_tensors="pt") - + return prompt Create parser @@ -493,7 +493,7 @@ execute them according to the output of LLM. return str(ret) elif tool_name == "image_gen": import urllib.parse - + tool_args = tool_args.replace("(", "").replace(")", "") prompt = json5.loads(tool_args)["prompt"] prompt = urllib.parse.quote(prompt) @@ -503,11 +503,11 @@ execute them according to the output of LLM. ) else: raise NotImplementedError - - + + def llm_with_tool(prompt: str, history, list_of_tool_info=()): chat_history = [(x["user"], x["bot"]) for x in history] + [(prompt, "")] - + planning_prompt = build_input_text(chat_history, list_of_tool_info) text = "" while True: @@ -522,7 +522,7 @@ execute them according to the output of LLM. else: text += output break - + new_history = [] new_history.extend(history) new_history.append({"user": prompt, "bot": text}) @@ -537,7 +537,7 @@ Run agent history = [] query = "get the weather in London, and create a picture of Big Ben based on the weather information" - + response, history = llm_with_tool(prompt=query, history=history, list_of_tool_info=tools) diff --git a/docs/notebooks/llm-chatbot-generate-api-with-output.rst b/docs/notebooks/llm-chatbot-generate-api-with-output.rst index c09b463ae985d0..2c23e3ef3b4f64 100644 --- a/docs/notebooks/llm-chatbot-generate-api-with-output.rst +++ b/docs/notebooks/llm-chatbot-generate-api-with-output.rst @@ -81,9 +81,9 @@ Install required dependencies .. code:: ipython3 import os - + os.environ["GIT_CLONE_PROTECTION_ACTIVE"] = "false" - + %pip install -Uq pip %pip uninstall -q -y optimum optimum-intel %pip install -q -U "openvino>=2024.3.0" openvino-tokenizers[transformers] openvino-genai @@ -103,12 +103,12 @@ Install required dependencies from pathlib import Path import requests import shutil - + # fetch model configuration - + config_shared_path = Path("../../utils/llm_config.py") config_dst_path = Path("llm_config.py") - + if not config_dst_path.exists(): if config_shared_path.exists(): try: @@ -127,7 +127,7 @@ Install required dependencies r = requests.get(url="https://raw.githubusercontent.com/openvinotoolkit/openvino_notebooks/latest/utils/llm_config.py") with open("llm_config.py", "w", encoding="utf-8") as f: f.write(r.text) - + if not Path("notebook_utils.py").exists(): r = requests.get(url="https://raw.githubusercontent.com/openvinotoolkit/openvino_notebooks/latest/utils/notebook_utils.py") open("notebook_utils.py", "w").write(r.text) @@ -238,7 +238,7 @@ Click here to see available models options .. code:: python - # login to huggingfacehub to get access to pretrained model + # login to huggingfacehub to get access to pretrained model from huggingface_hub import notebook_login, whoami @@ -270,7 +270,7 @@ Click here to see available models options .. code:: python - # login to huggingfacehub to get access to pretrained model + # login to huggingfacehub to get access to pretrained model from huggingface_hub import notebook_login, whoami @@ -304,7 +304,7 @@ Click here to see available models options .. code:: python - # login to huggingfacehub to get access to pretrained model + # login to huggingfacehub to get access to pretrained model from huggingface_hub import notebook_login, whoami @@ -338,7 +338,7 @@ Click here to see available models options .. code:: python - # login to huggingfacehub to get access to pretrained model + # login to huggingfacehub to get access to pretrained model from huggingface_hub import notebook_login, whoami @@ -399,7 +399,7 @@ Click here to see available models options .. code:: python - # login to huggingfacehub to get access to pretrained model + # login to huggingfacehub to get access to pretrained model from huggingface_hub import notebook_login, whoami @@ -432,7 +432,7 @@ Click here to see available models options .. code:: python - # login to huggingfacehub to get access to pretrained model + # login to huggingfacehub to get access to pretrained model from huggingface_hub import notebook_login, whoami @@ -466,7 +466,7 @@ Click here to see available models options .. code:: python - # login to huggingfacehub to get access to pretrained model + # login to huggingfacehub to get access to pretrained model from huggingface_hub import notebook_login, whoami @@ -500,7 +500,7 @@ Click here to see available models options .. code:: python - # login to huggingfacehub to get access to pretrained model + # login to huggingfacehub to get access to pretrained model from huggingface_hub import notebook_login, whoami @@ -531,7 +531,7 @@ Click here to see available models options .. code:: python - # login to huggingfacehub to get access to pretrained model + # login to huggingfacehub to get access to pretrained model from huggingface_hub import notebook_login, whoami @@ -644,9 +644,9 @@ Click here to see available models options .. code:: ipython3 from llm_config import get_llm_selection_widget - + form, lang, model_id_widget, compression_variant, use_preconverted = get_llm_selection_widget() - + form @@ -668,7 +668,7 @@ Click here to see available models options .. parsed-literal:: Selected model qwen2-0.5b-instruct with INT4 compression - + Convert model using Optimum-CLI tool ------------------------------------ @@ -676,7 +676,7 @@ Convert model using Optimum-CLI tool `Optimum Intel `__ -is the interface between the +is the interface between the `Transformers `__ and `Diffusers `__ libraries and OpenVINO to accelerate end-to-end pipelines on Intel architectures. @@ -776,28 +776,28 @@ be additionally applied during model export with INT4 precision using .. code:: ipython3 from llm_config import convert_and_compress_model - + model_dir = convert_and_compress_model(model_id, model_configuration, compression_variant.value, use_preconverted.value) .. parsed-literal:: ✅ INT4 qwen2-0.5b-instruct model already converted and can be found in qwen2/INT4_compressed_weights - + Let’s compare model size for different compression types .. code:: ipython3 from llm_config import compare_model_size - + compare_model_size(model_dir) .. parsed-literal:: Size of model with INT4 compressed weights is 358.86 MB - + Select device for inference --------------------------- @@ -807,9 +807,9 @@ Select device for inference .. code:: ipython3 from notebook_utils import device_widget - + device = device_widget(default="CPU", exclude=["NPU"]) - + device @@ -852,14 +852,14 @@ of the available generation parameters more deeply later. .. code:: ipython3 import openvino_genai as ov_genai - + print(f"Loading model from {model_dir}\n") - - + + pipe = ov_genai.LLMPipeline(str(model_dir), device.value) - + generation_config = pipe.get_generation_config() - + input_prompt = "The Sun is yellow bacause" print(f"Input text: {input_prompt}") print(pipe.generate(input_prompt, max_new_tokens=10)) @@ -868,10 +868,10 @@ of the available generation parameters more deeply later. .. parsed-literal:: Loading model from qwen2/INT4_compressed_weights - + Input text: The Sun is yellow bacause it is made of hydrogen and oxygen atoms. The - + Run Chatbot ----------- @@ -932,7 +932,7 @@ history, we should move LLMPipeline to chat mode using ``start_chat()`` method. More info about OpenVINO LLM inference can be found in `LLM Inference -Guide `__ +Guide `__ .. raw:: html @@ -1022,11 +1022,11 @@ Click here to see detailed description of advanced options if not Path("gradio_helper_genai.py").exists(): r = requests.get(url="https://raw.githubusercontent.com/openvinotoolkit/openvino_notebooks/latest/notebooks/llm-chatbot/gradio_helper_genai.py") open("gradio_helper_genai.py", "w").write(r.text) - + from gradio_helper_genai import make_demo - + demo = make_demo(pipe, model_configuration, model_id, lang.value) - + try: demo.launch(debug=True) except Exception: diff --git a/docs/notebooks/llm-chatbot-with-output.rst b/docs/notebooks/llm-chatbot-with-output.rst index 0d214f5cccc0fc..24ebf376309f08 100644 --- a/docs/notebooks/llm-chatbot-with-output.rst +++ b/docs/notebooks/llm-chatbot-with-output.rst @@ -1012,7 +1012,7 @@ Tokenizer class and pipelines API are compatible with Optimum models. You can find more details about OpenVINO LLM inference using HuggingFace Optimum API in `LLM inference -guide `__. +guide `__. .. code:: ipython3 @@ -1109,7 +1109,7 @@ decoding methods in this generation updates conversation history for next conversation step. it makes stronger connection of next question with previously provided and allows user to make clarifications regarding previously provided -answers.https://docs.openvino.ai/2024/learn-openvino/llm_inference_guide.html +answers.https://docs.openvino.ai/2024/openvino-workflow-generative.html | There are several parameters that can control text generation quality: \* ``Temperature`` is a parameter used to control the level of @@ -1160,7 +1160,7 @@ answers.https://docs.openvino.ai/2024/learn-openvino/llm_inference_guide.html heavily than a token that has appeared only one time. A value of 1 means that there is no penalty and values larger than 1 discourage repeated - tokens.https://docs.openvino.ai/2024/learn-openvino/llm_inference_guide.html + tokens.https://docs.openvino.ai/2024/openvino-workflow-generative.html .. code:: ipython3 diff --git a/docs/notebooks/multilora-image-generation-with-output.rst b/docs/notebooks/multilora-image-generation-with-output.rst index 2efe1aaab50908..e2da1edafdd8f6 100644 --- a/docs/notebooks/multilora-image-generation-with-output.rst +++ b/docs/notebooks/multilora-image-generation-with-output.rst @@ -75,11 +75,11 @@ Guide 0.25.0" pillow "gradio>=4.19" "peft>=0.7.0" %pip install -q "git+https://github.com/huggingface/optimum-intel.git" %pip install -q -U "openvino>=2024.5.0" "openvino-tokenizers>=2024.5.0" "openvino-genai>=2024.5.0" - + if platform.system() == "Darwin": %pip install -q "numpy<2.0.0" @@ -87,16 +87,16 @@ Guide `__ is -the interface between the +the interface between the `Transformers `__ and `Diffusers `__ libraries and OpenVINO to accelerate end-to-end pipelines on Intel architectures. @@ -144,7 +144,7 @@ saved on disk before export. For avoiding this, we will use ``export_from_model`` function that accepts initialized model. Additionally, for using model with OpenVINO GenAI, we need to export tokenizers to OpenVINO format using `OpenVINO -Tokenizers `__ +Tokenizers `__ library. In this tutorial we will use `Stable Diffusion @@ -160,9 +160,9 @@ Diffusion family. from optimum.intel.openvino import OVConfig from optimum.exporters.openvino.convert import export_tokenizer import gc - + model_dir = Path("sdxl-lcm") - + if not model_dir.exists(): model_id = "stabilityai/stable-diffusion-xl-base-1.0" adapter_id = "latent-consistency/lcm-lora-sdxl" @@ -262,17 +262,17 @@ Prepare LoRA Adapters .. code:: ipython3 from lora_config import LORA - + # uncomment this line to see predefined LoRA adapters configuration used in this notebook # LORA .. code:: ipython3 from huggingface_hub import hf_hub_download - + lora_dir = Path("lora") adapter_paths = [] - + for lora in LORA: lora_model_dir = lora_dir / lora["name"].lower().replace(" ", "_") file_name = lora["file_name"] @@ -283,8 +283,8 @@ Prepare LoRA Adapters .. code:: ipython3 import openvino_genai as ov_genai - - + + def prepare_adapter_config(scales=None): if scales is None: scales = [1 / len(adapter_paths)] * len(adapter_paths) @@ -293,10 +293,10 @@ Prepare LoRA Adapters adapter_config = ov_genai.AdapterConfig() for adapter, scale in zip(adapter_paths, scales): adapter_config.add(ov_genai.Adapter(adapter), scale) - + return adapter_config - - + + adapters_config = prepare_adapter_config(0.0) adapters = adapters_config.get_adapters() @@ -312,7 +312,7 @@ denoising. For reproducibility of generation results, we will use .. code:: ipython3 from notebook_utils import device_widget - + device = device_widget(default="CPU", exclude=["NPU"]) device @@ -329,21 +329,21 @@ denoising. For reproducibility of generation results, we will use import openvino as ov import torch - - + + class Generator(ov_genai.Generator): def __init__(self, seed): ov_genai.Generator.__init__(self) self.generator = torch.Generator(device="cpu").manual_seed(seed) - + def next(self): return torch.randn(1, generator=self.generator, dtype=torch.float32).item() - + def randn_tensor(self, shape: ov.Shape): torch_tensor = torch.randn(list(shape), generator=self.generator, dtype=torch.float32) return ov.Tensor(torch_tensor.numpy()) - - + + pipe = ov_genai.Text2ImagePipeline(model_dir, "CPU", adapters=adapters_config) Selection specific adapter during generation @@ -370,7 +370,7 @@ let’s select LoRA for generation images in X-Ray style. .. code:: ipython3 from PIL import Image - + image = Image.fromarray(image_tensor.data[0]) image @@ -396,7 +396,7 @@ modern illustration pointillistic style. prompt_template2 = LORA[2].get("prompt", "") adapter1_weight = LORA[1].get("weight", 1.0) adapter2_weight = LORA[2].get("weight", 1.0) - + prompt = prompt_template2.replace("", prompt_template1.replace("", subject)) adapter_config = ov_genai.AdapterConfig() adapter_config.add(adapters[1], adapter1_weight) @@ -446,7 +446,7 @@ Interactive demo .. code:: ipython3 gradio_helper_path = Path("gradio_helper.py") - + if not gradio_helper_path.exists(): r = requests.get( url="https://raw.githubusercontent.com/openvinotoolkit/openvino_notebooks/latest/notebooks/multilora-image-generation/gradio_helper.py", @@ -456,9 +456,9 @@ Interactive demo .. code:: ipython3 from gradio_helper import make_demo - + demo = make_demo(pipe, Generator, adapters, LORA) - + try: demo.launch(debug=False) except Exception: diff --git a/docs/notebooks/speculative-sampling-with-output.rst b/docs/notebooks/speculative-sampling-with-output.rst index 868fbe9beccf9e..8dd300fa4bbaff 100644 --- a/docs/notebooks/speculative-sampling-with-output.rst +++ b/docs/notebooks/speculative-sampling-with-output.rst @@ -136,7 +136,7 @@ In case, if you want run own models, you should convert them using Optimum `__ library accelerated by OpenVINO integration. More details about model preparation can be found in `OpenVINO LLM inference -guide `__ +guide `__ .. code:: ipython3 diff --git a/docs/notebooks/text-to-image-genai-with-output.rst b/docs/notebooks/text-to-image-genai-with-output.rst index 126c654405b36a..d43b900d9133db 100644 --- a/docs/notebooks/text-to-image-genai-with-output.rst +++ b/docs/notebooks/text-to-image-genai-with-output.rst @@ -23,7 +23,7 @@ the Hugging Face Transformers library to the OpenVINO™ IR format. For more details, refer to the `Hugging Face Optimum Intel documentation `__. 2. Run inference using the `Text-to-Image Generation -pipeline `__ +pipeline `__ from OpenVINO GenAI. @@ -59,19 +59,19 @@ Prerequisites import platform import requests - - + + %pip install -q "git+https://github.com/huggingface/optimum-intel.git" %pip install -q -U "openvino>=2024.5" "openvino-tokenizers>=2024.5" "openvino-genai>=2024.5" %pip install -q Pillow "diffusers>=0.30.3" "gradio>=4.19" "typing_extensions>=4.9" if platform.system() == "Darwin": %pip install -q "numpy<2.0.0" - + r = requests.get( url="https://raw.githubusercontent.com/openvinotoolkit/openvino_notebooks/latest/utils/notebook_utils.py", ) open("notebook_utils.py", "w").write(r.text) - + r = requests.get( url="https://raw.githubusercontent.com/openvinotoolkit/openvino_notebooks/latest/utils/cmd_helper.py", ) @@ -83,7 +83,7 @@ Convert model using Optimum-CLI tool `Optimum Intel `__ -is the interface between the +is the interface between the `Transformers `__ and `Diffusers `__ libraries and OpenVINO to accelerate end-to-end pipelines on Intel architectures. @@ -118,12 +118,12 @@ wrapper over cli-command. .. code:: ipython3 from pathlib import Path - + from cmd_helper import optimum_cli - - + + model_dir = Path("dreamlike_anime_1_0_ov") - + if not model_dir.exists(): optimum_cli("dreamlike-art/dreamlike-anime-1.0", model_dir) @@ -137,8 +137,8 @@ select device from dropdown list for running inference using OpenVINO .. code:: ipython3 from notebook_utils import device_widget - - + + device = device_widget("CPU", exclude=["NPU"]) device @@ -163,27 +163,27 @@ That’s it:) import openvino as ov from PIL import Image import torch - - + + class Generator(ov_genai.Generator): def __init__(self, seed): ov_genai.Generator.__init__(self) self.generator = torch.Generator(device="cpu").manual_seed(seed) - + def next(self): return torch.randn(1, generator=self.generator, dtype=torch.float32).item() - + def randn_tensor(self, shape: ov.Shape): torch_tensor = torch.randn(list(shape), generator=self.generator, dtype=torch.float32) return ov.Tensor(torch_tensor.numpy()) - - + + random_generator = Generator(42) # openvino_genai.CppStdGenerator can be used to have same images as C++ sample pipe = ov_genai.Text2ImagePipeline(model_dir, device.value) prompt = "anime, masterpiece, high quality, a green snowman with a happy smiling face in the snows" - + image_tensor = pipe.generate(prompt, width=512, height=512, num_inference_steps=20, num_images_per_prompt=1, generator=random_generator) - + image = Image.fromarray(image_tensor.data[0]) .. code:: ipython3 @@ -230,20 +230,20 @@ from command line: def prepare_adapter_config(adapters): adapter_config = ov_genai.AdapterConfig() - + # Multiple LoRA adapters applied simultaneously are supported, parse them all and corresponding alphas from cmd parameters: for i in range(int(len(adapters) / 2)): adapter = ov_genai.Adapter(adapters[2 * i]) alpha = float(adapters[2 * i + 1]) adapter_config.add(adapter, alpha) - + return adapter_config - - + + adapter_config = prepare_adapter_config(["soulcard.safetensors", 0.5]) - + pipe = ov_genai.Text2ImagePipeline(model_dir, device.value, adapters=adapter_config) - + image_tensor = pipe.generate(prompt, generator=Generator(42), width=512, height=512, num_inference_steps=20) image = Image.fromarray(image_tensor.data[0]) @@ -270,10 +270,10 @@ Interactive demo .. code:: ipython3 from gradio_helper import make_demo - - + + demo = make_demo(pipe, Generator, adapter_config) - + try: demo.launch(debug=True) except Exception: diff --git a/docs/openvino_sphinx_theme/setup.py b/docs/openvino_sphinx_theme/setup.py index 28af421d8d4e4b..0776711a7765f2 100644 --- a/docs/openvino_sphinx_theme/setup.py +++ b/docs/openvino_sphinx_theme/setup.py @@ -1,4 +1,4 @@ -# Copyright (C) 2018-2023 Intel Corporation +# Copyright (C) 2018-2025 Intel Corporation # SPDX-License-Identifier: Apache-2.0 from setuptools import setup diff --git a/docs/scripts/articles_helper.py b/docs/scripts/articles_helper.py index 6b01325fa24a95..1065e8b30f85a4 100644 --- a/docs/scripts/articles_helper.py +++ b/docs/scripts/articles_helper.py @@ -1,4 +1,4 @@ -# Copyright (C) 2018-2023 Intel Corporation +# Copyright (C) 2018-2025 Intel Corporation # SPDX-License-Identifier: Apache-2.0 import argparse diff --git a/docs/scripts/create_mapping.py b/docs/scripts/create_mapping.py index e36bfb53184fbc..b1094dd936f021 100644 --- a/docs/scripts/create_mapping.py +++ b/docs/scripts/create_mapping.py @@ -1,4 +1,4 @@ -# Copyright (C) 2018-2023 Intel Corporation +# Copyright (C) 2018-2025 Intel Corporation # SPDX-License-Identifier: Apache-2.0 import argparse diff --git a/docs/snippets/example_itask_executor.cpp b/docs/snippets/example_itask_executor.cpp index e951917249f059..0890518e2f86f9 100644 --- a/docs/snippets/example_itask_executor.cpp +++ b/docs/snippets/example_itask_executor.cpp @@ -1,4 +1,4 @@ -// Copyright (C) 2018-2020 Intel Corporation +// Copyright (C) 2018-2025 Intel Corporation // SPDX-License-Identifier: Apache-2.0 // diff --git a/docs/sphinx_setup/_static/download/GenAI_Quick_Start_Guide.pdf b/docs/sphinx_setup/_static/download/GenAI_Quick_Start_Guide.pdf index c5632a7e3f9627..2046f7d9427421 100644 Binary files a/docs/sphinx_setup/_static/download/GenAI_Quick_Start_Guide.pdf and b/docs/sphinx_setup/_static/download/GenAI_Quick_Start_Guide.pdf differ diff --git a/docs/sphinx_setup/_static/benchmarks_files/OV-2024.6-Performance-Data.xlsx b/docs/sphinx_setup/_static/download/benchmarking_OV_performance-data.xlsx similarity index 100% rename from docs/sphinx_setup/_static/benchmarks_files/OV-2024.6-Performance-Data.xlsx rename to docs/sphinx_setup/_static/download/benchmarking_OV_performance-data.xlsx diff --git a/docs/sphinx_setup/_static/benchmarks_files/OV-2024.6-platform_list.pdf b/docs/sphinx_setup/_static/download/benchmarking_OV_platform_list.pdf similarity index 100% rename from docs/sphinx_setup/_static/benchmarks_files/OV-2024.6-platform_list.pdf rename to docs/sphinx_setup/_static/download/benchmarking_OV_platform_list.pdf diff --git a/docs/sphinx_setup/_static/benchmarks_files/OV-2024.6-system-info-detailed.xlsx b/docs/sphinx_setup/_static/download/benchmarking_OV_system_info_detailed.xlsx similarity index 100% rename from docs/sphinx_setup/_static/benchmarks_files/OV-2024.6-system-info-detailed.xlsx rename to docs/sphinx_setup/_static/download/benchmarking_OV_system_info_detailed.xlsx diff --git a/docs/sphinx_setup/_static/benchmarks_files/llm_models_platform_list_.pdf b/docs/sphinx_setup/_static/download/benchmarking_genai_platform_list.pdf similarity index 100% rename from docs/sphinx_setup/_static/benchmarks_files/llm_models_platform_list_.pdf rename to docs/sphinx_setup/_static/download/benchmarking_genai_platform_list.pdf diff --git a/docs/sphinx_setup/_static/selector-tool/assets/selector-DiE3WrtX.js b/docs/sphinx_setup/_static/selector-tool/assets/selector-DiE3WrtX.js index 264f23f1dd17e3..568dd5dad034f2 100644 --- a/docs/sphinx_setup/_static/selector-tool/assets/selector-DiE3WrtX.js +++ b/docs/sphinx_setup/_static/selector-tool/assets/selector-DiE3WrtX.js @@ -56,4 +56,4 @@ enabled=1 gpgcheck=1 repo_gpgcheck=1 gpgkey=https://yum.repos.intel.com/intel-gpg-keys/GPG-PUB-KEY-INTEL-SW-PRODUCTS.PUB -EOF`,getMoveRepoFileCommand:e=>`sudo mv /tmp/openvino-${e.metadata.yumYear}.repo ${Zu}`,verifyRepoCommand:"yum repolist | grep -i openvino",getInstallCommand:e=>`sudo yum install openvino-${e.metadata.yumVersion}`};class Sv extends Ae{constructor(t){super({level:T.DISTRIBUTION,key:A.ZYPPER,metadata:{title:"ZYPPER",subtitle:de("distributions.CAPIOnly")}}),this._data=t}get data(){return{...this._data,commands:xv}}}const xv={addRepo:"sudo zypper addrepo https://download.opensuse.org/repositories/science/openSUSE_Tumbleweed/science.repo",refresh:"sudo zypper refresh",getInstallCommand:({metadata:e})=>`sudo zypper install openvino-devel-${e.zypperVersion} openvino-sample-${e.zypperVersion}`};class aa extends Xr{constructor(t,n,r){super({level:T.OP_SYSTEM,key:t,metadata:n},r),this._setDefaultOS()}_setDefaultOS(){const t=this._detectOS()||Qe.WINDOWS;this.key===t&&this.default()}_detectOS(){const{userAgent:t}=navigator,n={windows:/(Windows|Win)/g,macOS:/(Macintosh|Mac)/g,linux:/(Linux|X11)/g};return n.windows.test(t)?Qe.WINDOWS:n.macOS.test(t)?Qe.MACOS:n.linux.test(t)?Qe.LINUX:null}}class Zr extends aa{constructor(t){super(Qe.WINDOWS,Mm,t)}}class qr extends aa{constructor(t){super(Qe.MACOS,Bm,t)}}class ei extends aa{constructor(t){super(Qe.LINUX,Km,t)}}const Ov=new ei([new Ee({linksSet:{installation:"https://docs.openvino.ai/nightly/get-started/install-openvino/install-openvino-pip.html"}},{pythonAPI:!0}).includesNPUPlugin().default(),new Pe({linksSet:{installation:"https://docs.openvino.ai/nightly/get-started/install-openvino/install-openvino-archive-linux.html"},downloadLink:"https://storage.openvinotoolkit.org/repositories/openvino/packages/nightly/latest"}),new _e,new Ne]),Pv=new qr([new Ee({linksSet:{installation:"https://docs.openvino.ai/nightly/get-started/install-openvino/install-openvino-pip.html"}},{pythonAPI:!0}).default(),new Pe({linksSet:{installation:"https://docs.openvino.ai/nightly/get-started/install-openvino/install-openvino-archive-macos.html"},downloadLink:"https://storage.openvinotoolkit.org/repositories/openvino/packages/nightly/latest"}),new _e,new Ne]),Nv=new Zr([new Ee({linksSet:{installation:"https://docs.openvino.ai/nightly/get-started/install-openvino/install-openvino-pip.html"}},{pythonAPI:!0}).includesNPUPlugin().default(),new Pe({linksSet:{installation:"https://docs.openvino.ai/nightly/get-started/install-openvino/install-openvino-archive-windows.html"},downloadLink:"https://storage.openvinotoolkit.org/repositories/openvino/packages/nightly/latest"}),new _e,new Ne]),_v=new Cd([Nv,Pv,Ov]),Ev=new ei([new Ee({linksSet:{installation:"https://docs.openvino.ai/2023.3/openvino_docs_install_guides_installing_openvino_pip.html"}},{pythonAPI:!0}).default(),new Pe({linksSet:{installation:"https://docs.openvino.ai/2023.3/openvino_docs_install_guides_installing_openvino_from_archive_linux.html"},downloadLink:"https://storage.openvinotoolkit.org/repositories/openvino/packages/2023.3/linux"}).includesNPUPlugin(),new Id({linksSet:{installation:"https://docs.openvino.ai/2023.3/openvino_docs_install_guides_installing_openvino_apt.html"},os:[re.UBUNTU_18,re.UBUNTU_20,re.UBUNTU_22]}),new Td({linksSet:{installation:"https://docs.openvino.ai/2023.3/openvino_docs_install_guides_installing_openvino_yum.html"}}),new _e,new Ne,new ir({linksSet:{installation:"https://docs.openvino.ai/2023.3/openvino_docs_install_guides_installing_openvino_docker.html"},downloadLink:"https://docs.openvino.ai/2023.3/openvino_docs_install_guides_installing_openvino_docker.html"}),new rr({linksSet:{installation:"https://docs.openvino.ai/2023.3/openvino_docs_install_guides_installing_openvino_conda.html"}}),new nr({linksSet:{installation:"https://docs.openvino.ai/2023.3/openvino_docs_install_guides_installing_openvino_conan.html"}})]),Cv=new qr([new Ee({linksSet:{installation:"https://docs.openvino.ai/2023.3/openvino_docs_install_guides_installing_openvino_pip.html"}},{pythonAPI:!0}).default(),new Pe({linksSet:{installation:"https://docs.openvino.ai/2023.3/openvino_docs_install_guides_installing_openvino_from_archive_macos.html"},downloadLink:"https://storage.openvinotoolkit.org/repositories/openvino/packages/2023.3/macos"}),new _e,new Ne,new rr({linksSet:{installation:"https://docs.openvino.ai/2023.3/openvino_docs_install_guides_installing_openvino_conda.html"}}),new nr({linksSet:{installation:"https://docs.openvino.ai/2023.3/openvino_docs_install_guides_installing_openvino_conan.html"}})]),jv=new Zr([new Ee({linksSet:{installation:"https://docs.openvino.ai/2023.3/openvino_docs_install_guides_installing_openvino_pip.html"}},{pythonAPI:!0}).default(),new Pe({linksSet:{installation:"https://docs.openvino.ai/2023.3/openvino_docs_install_guides_installing_openvino_from_archive_windows.html"},downloadLink:"https://storage.openvinotoolkit.org/repositories/openvino/packages/2023.3/windows"}).includesNPUPlugin(),new _e,new Ne,new ir({linksSet:{installation:"https://docs.openvino.ai/2023.3/openvino_docs_install_guides_installing_openvino_docker.html"},downloadLink:"https://docs.openvino.ai/2023.3/openvino_docs_install_guides_installing_openvino_docker.html"}),new rr({linksSet:{installation:"https://docs.openvino.ai/2023.3/openvino_docs_install_guides_installing_openvino_conda.html"}}),new nr({linksSet:{installation:"https://docs.openvino.ai/2023.3/openvino_docs_install_guides_installing_openvino_conan.html"}})]),Iv=new Xm([jv,Cv,Ev]),Lv=new ei([new Ee({linksSet:{installation:"https://docs.openvino.ai/2024/get-started/install-openvino/install-openvino-pip.html"}},{pythonAPI:!0}).includesNPUPlugin().default(),new Pe({linksSet:{installation:"https://docs.openvino.ai/2024/get-started/install-openvino/install-openvino-archive-linux.html"},downloadLink:"https://storage.openvinotoolkit.org/repositories/openvino/packages/2024.6/linux"}).includesNPUPlugin(),new Id({linksSet:{installation:"https://docs.openvino.ai/2024/get-started/install-openvino/install-openvino-apt.html"},os:[re.UBUNTU_20,re.UBUNTU_22,re.UBUNTU_24]}),new Td({linksSet:{installation:"https://docs.openvino.ai/2024/get-started/install-openvino/install-openvino-yum.html"}}),new _e,new Ne,new ir({linksSet:{installation:"https://docs.openvino.ai/2024/get-started/install-openvino/install-openvino-docker-linux.html"},downloadLink:"https://docs.openvino.ai/2024/get-started/install-openvino/install-openvino-docker-linux.html"}),new rr({linksSet:{installation:"https://docs.openvino.ai/2024/get-started/install-openvino/install-openvino-conda.html"}}),new Ld({linksSet:{installation:"https://docs.openvino.ai/2024/get-started/install-openvino/install-openvino-brew.html"}}),new la({linksSet:{installation:"https://docs.openvino.ai/2024/get-started/install-openvino/install-openvino-vcpkg.html"}}),new nr({linksSet:{installation:"https://docs.openvino.ai/2024/get-started/install-openvino/install-openvino-conan.html"}}),new sa({linksSet:{installation:"https://docs.openvino.ai/2024/get-started/install-openvino/install-openvino-npm.html"}}),new Sv({linksSet:{installation:"https://docs.openvino.ai/2024/get-started/install-openvino/install-openvino-zypper.html"}}),new yv({linksSet:{installation:"https://docs.openvino.ai/2024/openvino-workflow/deployment-locally/integrate-openvino-with-ubuntu-snap.html"},downloadLink:"https://docs.openvino.ai/2024/openvino-workflow/deployment-locally/integrate-openvino-with-ubuntu-snap.html"})]),Rv=new qr([new Ee({linksSet:{installation:"https://docs.openvino.ai/2024/get-started/install-openvino/install-openvino-pip.html"}},{pythonAPI:!0}).default(),new Pe({linksSet:{installation:"https://docs.openvino.ai/2024/get-started/install-openvino/install-openvino-archive-macos.html"},downloadLink:"https://storage.openvinotoolkit.org/repositories/openvino/packages/2024.6/macos"}),new _e,new Ne,new rr({linksSet:{installation:"https://docs.openvino.ai/2024/get-started/install-openvino/install-openvino-conda.html"}}),new Ld({linksSet:{installation:"https://docs.openvino.ai/2024/get-started/install-openvino/install-openvino-brew.html"}}),new la({linksSet:{installation:"https://docs.openvino.ai/2024/get-started/install-openvino/install-openvino-vcpkg.html"}}),new nr({linksSet:{installation:"https://docs.openvino.ai/2024/get-started/install-openvino/install-openvino-conan.html"}}),new sa({linksSet:{installation:"https://docs.openvino.ai/2024/get-started/install-openvino/install-openvino-npm.html"}})]),Tv=new Zr([new Ee({linksSet:{installation:"https://docs.openvino.ai/2024/get-started/install-openvino/install-openvino-pip.html"}},{pythonAPI:!0}).includesNPUPlugin().default(),new Pe({linksSet:{installation:"https://docs.openvino.ai/2024/get-started/install-openvino/install-openvino-archive-windows.html"},downloadLink:"https://storage.openvinotoolkit.org/repositories/openvino/packages/2024.6/windows"}).includesNPUPlugin(),new _e,new Ne,new ir({linksSet:{installation:"https://docs.openvino.ai/2024/get-started/install-openvino/install-openvino-docker-linux.html"},downloadLink:"https://docs.openvino.ai/2024/get-started/install-openvino/install-openvino-docker-linux.html"}),new rr({linksSet:{installation:"https://docs.openvino.ai/2024/get-started/install-openvino/install-openvino-conda.html"}}),new la({linksSet:{installation:"https://docs.openvino.ai/2024/get-started/install-openvino/install-openvino-vcpkg.html"}}),new nr({linksSet:{installation:"https://docs.openvino.ai/2024/get-started/install-openvino/install-openvino-conan.html"}}),new sa({linksSet:{installation:"https://docs.openvino.ai/2024/get-started/install-openvino/install-openvino-npm.html"}})]),Av=new jd([Tv,Rv,Lv]),Dv=new Gm([Av.default(),_v,Iv]),Uv=new ei([new Ee({linksSet:{installation:"https://docs.openvino.ai/nightly/get-started/install-openvino/install-openvino-genai.html#pypi-installation"}},{pythonAPI:!0}).includesNPUPlugin().default(),new Pe({linksSet:{installation:"https://docs.openvino.ai/nightly/get-started/install-openvino/install-openvino-genai.html#archive-installation"},downloadLink:"https://storage.openvinotoolkit.org/repositories/openvino_genai/packages/nightly/latest"}),new _e,new Ne]),Fv=new qr([new Ee({linksSet:{installation:"https://docs.openvino.ai/nightly/get-started/install-openvino/install-openvino-genai.html#pypi-installation"}},{pythonAPI:!0}).default(),new Pe({linksSet:{installation:"https://docs.openvino.ai/nightly/get-started/install-openvino/install-openvino-genai.html#archive-installation"},downloadLink:"https://storage.openvinotoolkit.org/repositories/openvino_genai/packages/nightly/latest"}),new _e,new Ne]),zv=new Zr([new Ee({linksSet:{installation:"https://docs.openvino.ai/nightly/get-started/install-openvino/install-openvino-genai.html#pypi-installation"}},{pythonAPI:!0}).includesNPUPlugin().default(),new Pe({linksSet:{installation:"https://docs.openvino.ai/nightly/get-started/install-openvino/install-openvino-genai.html#archive-installation"},downloadLink:"https://storage.openvinotoolkit.org/repositories/openvino_genai/packages/nightly/latest"}),new _e,new Ne]),Vv=new Cd([zv,Fv,Uv]),bv=new ei([new Ee({linksSet:{installation:"https://docs.openvino.ai/2024/get-started/install-openvino/install-openvino-genai.html"}},{pythonAPI:!0}).includesNPUPlugin().default(),new Pe({linksSet:{installation:"https://docs.openvino.ai/2024/get-started/install-openvino/install-openvino-genai.html"},downloadLink:"https://storage.openvinotoolkit.org/repositories/openvino_genai/packages/2024.6/linux"}).includesNPUPlugin(),new _e,new Ne,new ir({linksSet:{installation:"https://docs.openvino.ai/2024/get-started/install-openvino/install-openvino-docker-linux.html"},downloadLink:"https://docs.openvino.ai/2024/get-started/install-openvino/install-openvino-docker-linux.html"})]),$v=new qr([new Ee({linksSet:{installation:"https://docs.openvino.ai/2024/get-started/install-openvino/install-openvino-genai.html"}},{pythonAPI:!0}).default(),new Pe({linksSet:{installation:"https://docs.openvino.ai/2024/get-started/install-openvino/install-openvino-genai.html"},downloadLink:"https://storage.openvinotoolkit.org/repositories/openvino_genai/packages/2024.6/macos"}),new _e,new Ne]),Mv=new Zr([new Ee({linksSet:{installation:"https://docs.openvino.ai/2024/get-started/install-openvino/install-openvino-genai.html"}},{pythonAPI:!0}).includesNPUPlugin().default(),new Pe({linksSet:{installation:"https://docs.openvino.ai/2024/get-started/install-openvino/install-openvino-genai.html"},downloadLink:"https://storage.openvinotoolkit.org/repositories/openvino_genai/packages/2024.6/windows"}).includesNPUPlugin(),new _e,new Ne,new ir({linksSet:{installation:"https://docs.openvino.ai/2024/get-started/install-openvino/install-openvino-docker-linux.html"},downloadLink:"https://docs.openvino.ai/2024/get-started/install-openvino/install-openvino-docker-linux.html"})]),Bv=new jd([Mv,$v,bv]),Kv=new Wm([Bv.default(),Vv]),Hv=new Xr({level:T.ROOT,key:_d.ROOT,metadata:{title:"ROOT"}},[Dv.default(),Kv]).default();function Gv(e,t){var i,o;if(t.key===A.DOCKER||!t.footnoteLevel)return e;const n=(i=e[t.footnoteLevel])==null?void 0:i.selected,r=(o=e[t.footnoteLevel])==null?void 0:o.nodes;return!n||!r||((Array.isArray(n)?[...n,...r]:[n]).forEach(s=>s.hasFootnote=!0),r.forEach(s=>s.checked&&(s.hasFootnote=!0))),e}class Wv{constructor(){ze(this,"_root",Hv)}getState(){try{return this._getState()}catch(t){return console.error(t),this._selectDefaults(this._root),this._getState()}}_getState(){const t=this._root.children,n=this._get_selected(t),r=n.children,i=this._get_selected(r),{systems:o,system:s}=this._processVersion(i),l=s.children,a=this._get_selected(l),c={[T.PACKAGE]:{nodes:t.map(p=>p.toOption()),selected:n.toOption()},[T.VERSION]:{nodes:r.map(p=>p.toOption()),selected:i.toOption()},[T.OP_SYSTEM]:{nodes:o.map(p=>p.toOption()),selected:s.toOption()},[T.DISTRIBUTION]:{nodes:l.map(p=>p.toOption()),selected:a.toOption()}};return Gv(c,a)}_get_selected(t){t.some(({checked:r})=>r)||this._selectDefaultsForLevel(t[0].level);const n=t.find(({checked:r})=>r);if(!n)throw new Error("Not valid tree");return n}_processVersion(t){const n=t.children,r=this._get_selected(n);return{systems:n,system:r}}setState(t){this._setState(t)}_setState(t,n=this._root){if(!n.children.length)return;const r=n.children[0].level,i=Yv(t[r]);n.children.forEach(o=>o.checked=i.includes(o.key)),n.children.forEach(o=>this._setState(t,o))}select(t,n){return this._select(t,n),this.getState()}_select(t,n,r=this._root){var i;if(((i=r.children[0])==null?void 0:i.level)!==t){r.children.forEach(o=>this._select(t,n,o));return}if(r.childrenSelector){r.childrenSelector(r.children,n);return}r.children.forEach(o=>o.checked=o.key===n)}_selectDefaultsForLevel(t,n=this._root){if(n.children.length){if(n.children[0].level!==t){n.children.forEach(r=>this._selectDefaultsForLevel(t,r));return}this._selectDefaults(n)}}_selectDefaults(t){t.children.forEach(n=>{n.checked=n.isDefault,this._selectDefaults(n)})}}const _n=new Wv;function Yv(e){const t=[];return Array.isArray(e)?t.push(...e):e&&t.push(e),t}function Ad(e,{serializeVersion:t}={serializeVersion:!0}){const n=[[T.PACKAGE,e.PACKAGE.selected.key],[T.VERSION,t?e.VERSION.selected.key:null],[T.OP_SYSTEM,e.OP_SYSTEM.selected.key],[T.DISTRIBUTION,e.DISTRIBUTION.selected.key]],r=new URLSearchParams;for(const[i,o]of n)o&&r.set(i,o);return r}function Dd(e){function t(n,r){const i=e.get(n);if(!i)throw new Error(`Cannot extract value for: ${n}`);if(!r[i])throw new Error(`Bad node key for: ${n}`);return r[i]}try{return{[T.PACKAGE]:t(T.PACKAGE,Se),[T.VERSION]:e.has(T.VERSION)?t(T.VERSION,wn):null,[T.OP_SYSTEM]:t(T.OP_SYSTEM,Qe),[T.DISTRIBUTION]:t(T.DISTRIBUTION,A)}}catch(n){return console.log(`Cannot restore state from url due to error "${n}"`),null}}function Qv(){const e=window.parent;if(!e.location.search)return null;const t=new URLSearchParams(e.location.search);return Dd(t)}function Jv(e,t,n,{serializeVersion:r}={serializeVersion:!0}){F.useEffect(()=>{const i=window.parent,o=Ad(t,{serializeVersion:r}).toString(),s=new URL(i.location.toString());if(!s.search){s.search=o,i.history.replaceState(null,"",s);return}s.search.slice(1)!==o&&(s.search=o,i.history.pushState(null,"",s))}),parent.onpopstate=()=>{const i=window.parent,o=new URLSearchParams(i.location.search),s=Dd(o);s&&(e.setState(s),n(e.getState()))}}const os=function(e){let t,n=!1;return function(...r){return n||(t=e(r),n=!0),t}};function Xv(e){var t,n;return typeof((n=(t=e.wap_tms)==null?void 0:t.custom)==null?void 0:n.trackComponentClick)!="function"?null:e.wap_tms.custom.trackComponentClick.bind(e.wap_tms.custom)}class Zv{constructor(){ze(this,"_window");ze(this,"_consoleNotification",{notInitialized:os(()=>console.log("Adobe analytics is not initialized")),notFound:os(()=>console.log("Adobe analytics not found on a page")),devMode:os(()=>console.log("Analytics in dev mode"))});ze(this,"_send",t=>{if(!this._window){this._consoleNotification.notInitialized();return}const n=Ad(_n.getState()).toString(),r=Xv(this._window);if(!r){this._consoleNotification.notFound();return}try{r(t,n)}catch(i){console.error(i)}})}initialize(t){this._window=t}install(){this._send("install")}combinationView(){this._send("combination-view")}}const He=new Zv;function qv(){const e=Qv();e&&_n.setState(e);const t=F.createContext((r,i)=>{_n.select(r,i)});function n(){const[r,i]=F.useState(_n.getState());return Jv(_n,r,i),[r,(o,s)=>i(_n.select(o,s))]}return{SelectorContext:t,useSelector:n}}async function ey(e){e&&(navigator.clipboard?await navigator.clipboard.writeText(e):ty(e))}function ty(e){const t=ny(e);document.body.append(t),t.select(),document.execCommand("copy"),t.remove()}function ny(e){const t=document.createElement("textarea");t.style.fontSize="12pt",t.style.border="0",t.style.padding="0",t.style.margin="0",t.style.position="absolute",t.style.left="-9999px";const n=window.pageYOffset||document.documentElement.scrollTop;return t.style.top=`${n}px`,t.setAttribute("readonly",""),t.value=e,t}function ry(){return m.jsxs("svg",{version:"1.1",width:"24",height:"24",viewBox:"0 0 205 205",xmlns:"http://www.w3.org/2000/svg",className:"svg-icon",children:[m.jsx("path",{fill:"none",stroke:"currentColor",strokeWidth:"10",d:"M 50 145 a 15 15 0 0 1 -15 -15 v -90 a 15 15 0 0 1 15 -15 h 70 a 15 15 0 0 1 15 15 v 5"}),m.jsx("rect",{x:"65",y:"60",width:"100",height:"120",rx:"15",fill:"none",stroke:"currentColor",strokeWidth:"10"})]})}function iy(){return m.jsx("svg",{version:"1.1",width:"24",height:"24",viewBox:"0 0 200 200",xmlns:"http://www.w3.org/2000/svg",className:"svg-icon",children:m.jsx("path",{strokeLinejoin:"round",strokeLinecap:"round",fill:"none",stroke:"currentColor",strokeWidth:"15",d:"M 40 100 L 90 150 L 170 40"})})}const b=({comment:e,command:t,onCopy:n})=>{const[r,i]=F.useState(!1),o=async()=>{r||(await ey(t),i(!0),setTimeout(()=>i(!1),1500),n==null||n())};return m.jsxs("div",{className:"st-code-snippet","data-cy":"instructions-step",children:[e&&m.jsx(Ud,{children:e}),m.jsxs("div",{"data-cy":"command",children:[t&&m.jsx("code",{className:"st-code-snippet-content",children:t}),t&&m.jsx("button",{className:"copy-button",type:"button","aria-label":"Copy","data-cy":"copy",onClick:o,children:r?m.jsx(iy,{}):m.jsx(ry,{})})]})]})},Ud=({children:e})=>m.jsxs("pre",{className:"st-code-snippet-comment",children:["# ",e]}),oy=({comment:e,snippets:t})=>m.jsxs("div",{className:"st-code-snippet-multi-line","data-cy":"command",children:[e&&m.jsx(Ud,{children:e}),t.map(n=>m.jsx(b,{...n},n.command))]});function sy(e){return e.host==="docs.openvino.ai"}const ss="production.docs.en",Fd=(ss==null?void 0:ss.includes("idz"))||!1,ls={link:"spark-hyperlink spark-hyperlink-primary spark-hyperlink-standard spark-focus-visible spark-focus-visible-self spark-focus-visible-snap spark-focus-visible-background",button:"spark-button spark-button-action spark-button-size-m spark-focus-visible spark-focus-visible-self spark-focus-visible-snap",buttonContent:"spark-button-content"},we=({href:e,children:t,type:n="link",testId:r="link",onClick:i})=>{const o=!Fd&&sy(new URL(e))?"_parent":"_blank";return n==="link"?m.jsx("a",{href:e,className:ls.link,target:o,rel:"noreferrer noopener","data-cy":r,onClick:()=>i==null?void 0:i(),children:t}):m.jsx("span",{className:ls.button,children:m.jsx("span",{className:ls.buttonContent,children:m.jsx("a",{href:e,target:o,rel:"noreferrer noopener","data-cy":r,onClick:()=>i==null?void 0:i(),children:t})})})},ly={heading:"spark-heading spark-font-200"},De=({title:e,accent:t=!1,dashed:n=!1,children:r,testId:i})=>m.jsxs("div",{className:`st-section ${t?"st-section-accent":""} ${n?"st-section-dashed":""}`,"data-cy":i,children:[m.jsx("span",{className:`st-section-title ${ly.heading}`,children:e}),m.jsx("div",{className:"st-section-content",children:F.Children.map(r,o=>m.jsx(ay,{children:o}))})]}),ay=({children:e})=>m.jsx("div",{className:"st-section-content-row",children:e}),uy=({version:e,distribution:t})=>{const{t:n}=M("translation",{keyPrefix:"distributions.apt.steps"}),{t:r}=M("translation",{keyPrefix:"selectorForm.titles"}),{commands:i}=t.data,o={comment:m.jsxs(z,{ns:"translation",i18nKey:"distributions.apt.steps.addRepository",children:[m.jsx("b",{children:"Step 3:"})," Add the repository via the following command"]}),snippets:i.getAddRepositoryCommands(e,t.data.os).map(({ubuntuVersionNumber:l,command:a})=>({comment:`Ubuntu ${l}`,command:a}))},s={downloadKey:{comment:m.jsxs(z,{t:n,i18nKey:"download",values:{filename:i.keyFilename},children:[m.jsx("b",{children:"Step 1:"})," Download the ",m.jsx(we,{href:i.keyHref,children:i.keyFilename}),". You can also use the following command"]}),command:i.downloadKeyCommand},addKey:{comment:m.jsxs(z,{t:n,i18nKey:"addKey",children:[m.jsx("b",{children:"Step 2:"})," Add this key to the system keyring"]}),command:i.addKeyCommand},addRepository:o,updatePackages:{comment:m.jsxs(z,{t:n,i18nKey:"updateList",children:[m.jsx("b",{children:"Step 4:"})," Update the list of packages via the update command"]}),command:i.updatePackagesCommand},verifyAptCache:{comment:m.jsxs(z,{t:n,i18nKey:"verify",children:[m.jsx("b",{children:"Step 5:"})," Verify that the APT repository is properly set up. Run the apt-cache command to see a list of all available OpenVINO packages and components"]}),command:i.verifyAptCacheCommand},install:{comment:m.jsxs(z,{t:n,i18nKey:"install",children:[m.jsx("b",{children:"Step 6:"})," Install OpenVINO Runtime"]}),command:i.getInstallCommand(e),onCopy:()=>He.install()}};return m.jsxs(De,{title:r("install"),accent:!0,testId:"instructions",children:[m.jsx(b,{...s.downloadKey}),m.jsx(b,{...s.addKey}),m.jsx(oy,{...s.addRepository}),m.jsx(b,{...s.updatePackages}),m.jsx(b,{...s.verifyAptCache}),m.jsx(b,{...s.install})]})},cy=({distribution:e})=>{const{t}=M("translation",{keyPrefix:"distributions.brew.steps"}),{t:n}=M("translation",{keyPrefix:"selectorForm.titles"}),{commands:r}=e.data,i={install:{comment:m.jsx(z,{t,i18nKey:"install",children:"Download and install the package"}),command:r.install,onCopy:()=>He.install()}};return m.jsx(De,{title:n("install"),accent:!0,testId:"instructions",children:m.jsx(b,{...i.install})})},fy=({version:e,distribution:t})=>{const{t:n}=M("translation",{keyPrefix:"distributions.conan.steps"}),{t:r}=M("translation",{keyPrefix:"selectorForm.titles"}),{commands:i}=t.data,{txtFilename:o,cmakeFilename:s}=i,l={createConanFile:{comment:m.jsxs(z,{t:n,i18nKey:"createConanFile",values:{txtFilename:o},children:[m.jsx("b",{children:"Step 1:"})," Create a ",m.jsx("b",{children:o})," file for your OpenVINO project and add “openvino” dependency in there"]}),command:i.conanTXTContent(e)},install:{comment:m.jsxs(z,{t:n,i18nKey:"install",values:{cmakeFilename:s},children:[m.jsx("b",{children:"Step 2:"})," Run the command below to create ",m.jsx("b",{children:s})," file, which will be used to compile your project with OpenVINO"]}),command:i.install,onCopy:()=>He.install()},compile:{comment:m.jsxs(z,{t:n,i18nKey:"compile",children:[m.jsx("b",{children:"Step 3:"})," Configure and compile your project with OpenVINO"]}),command:i.compile}};return m.jsxs(De,{title:r("install"),accent:!0,testId:"instructions",children:[m.jsx(b,{...l.createConanFile}),m.jsx(b,{...l.install}),m.jsx(b,{...l.compile})]})},dy=({version:e,distribution:t})=>{const{t:n}=M("translation",{keyPrefix:"distributions.conda.steps"}),{t:r}=M("translation",{keyPrefix:"selectorForm.titles"}),{commands:i}=t.data,o={createEnv:{comment:m.jsxs(z,{t:n,i18nKey:"createEnv",children:[m.jsx("b",{children:"Step 1:"})," Create the Anaconda environment (Python 3.10 used as an example)"]}),command:i.createEnv},activateEnv:{comment:m.jsxs(z,{t:n,i18nKey:"activateEnv",children:[m.jsx("b",{children:"Step 2:"})," Activate the Anaconda environment"]}),command:i.activateEnv},upgradePip:{comment:m.jsxs(z,{t:n,i18nKey:"update",children:[m.jsx("b",{children:"Step 3:"})," Update the Anaconda to latest version"]}),command:i.update},install:{comment:m.jsxs(z,{t:n,i18nKey:"install",children:[m.jsx("b",{children:"Step 4:"})," Download and install the package"]}),command:i.getInstall(e),onCopy:()=>He.install()}};return m.jsxs(De,{title:r("install"),accent:!0,testId:"instructions",children:[m.jsx(b,{...o.createEnv}),m.jsx(b,{...o.activateEnv}),m.jsx(b,{...o.upgradePip}),m.jsx(b,{...o.install})]})},as=({ovPackage:e,distribution:t})=>{const{t:n}=M("translation",{keyPrefix:"distributions.download"}),{t:r}=M("translation",{keyPrefix:"selectorForm.titles"}),i={[A.ARCHIVE]:e.key===Se.OPENVINO_BASE?n("downloadArchives"):n("downloadArchivesGenAI"),[A.DOCKER]:n("gotoDocker"),[A.SNAP]:n("gotoInstallInstruction")}[t.key],o=m.jsxs(m.Fragment,{children:[n("useFollowingLink"),m.jsx("br",{}),m.jsx("b",{children:m.jsx(we,{href:t.data.downloadLink,testId:"download-button",onClick:()=>He.install(),children:i})})]});return m.jsx(De,{title:r("install"),accent:!0,testId:"instructions",children:m.jsx(b,{comment:o})})},py=({ovPackage:e,version:t,distribution:n})=>{const{t:r}=M("translation",{keyPrefix:"distributions.githubGitee"}),{t:i}=M("translation",{keyPrefix:"selectorForm.titles"}),o={clone:{comment:m.jsxs(z,{t:r,i18nKey:"steps.useGitClone",children:[m.jsx("b",{children:"Step 1:"})," Use Git to clone the OpenVINO toolkit repository"]}),command:n.data.commands.getCloneCommand(e,t),onCopy:()=>He.install()},build:{comment:m.jsxs(z,{t:r,i18nKey:"steps.buildInstructions",children:[m.jsx("b",{children:"Step 2:"})," Follow the ",m.jsx(we,{href:n.data.links.getBuildInstructionsLink(e,t),testId:"build-instructions-link",children:"instructions to build from source"})]})}};return m.jsxs(De,{title:i("install"),accent:!0,testId:"instructions",children:[m.jsx(b,{...o.clone}),m.jsx(b,{...o.build})]})},hy=({distribution:e,version:t})=>{const{t:n}=M("translation",{keyPrefix:"distributions.npm.steps"}),{t:r}=M("translation",{keyPrefix:"selectorForm.titles"}),{commands:i}=e.data,o={install:{comment:m.jsx(z,{t:n,i18nKey:"install",children:"Download and install the package"}),command:i.getInstall(t),onCopy:()=>He.install()}};return m.jsx(De,{title:r("install"),accent:!0,testId:"instructions",children:m.jsx(b,{...o.install})})},gy=({ovPackage:e,os:t,version:n,distribution:r})=>{const{t:i}=M("translation",{keyPrefix:"distributions.pip.steps"}),{t:o}=M("translation",{keyPrefix:"selectorForm.titles"}),{commands:s}=r.data,l=s.getCreateVenvCommand(t,n),a=s.getActivateVenvCommand(t,n),c=s.getInstallCommand({ovPackage:e,os:t,version:n}),p={createEnv:{comment:m.jsxs(z,{t:i,i18nKey:"createVenv",children:[m.jsx("b",{children:"Step 1:"})," Create virtual environment"]}),command:l},activateEnv:{comment:m.jsxs(z,{t:i,i18nKey:"activateVenv",children:[m.jsx("b",{children:"Step 2:"})," Activate virtual environment"]}),command:a},upgradePip:{comment:m.jsxs(z,{t:i,i18nKey:"upgradePip",children:[m.jsx("b",{children:"Step 3:"})," Upgrade pip to latest version"]}),command:s.upgradeCommand},install:{comment:m.jsxs(z,{t:i,i18nKey:"install",children:[m.jsx("b",{children:"Step 4:"})," Download and install the package"]}),command:c,onCopy:()=>He.install()}};return m.jsxs(De,{title:o("install"),accent:!0,testId:"instructions",children:[m.jsx(b,{...p.createEnv}),m.jsx(b,{...p.activateEnv}),m.jsx(b,{...p.upgradePip}),m.jsx(b,{...p.install})]})},my=({distribution:e})=>{const{t}=M("translation",{keyPrefix:"distributions.vcpkg.steps"}),{t:n}=M("translation",{keyPrefix:"selectorForm.titles"}),{commands:r}=e.data,i={install:{comment:m.jsx(z,{t,i18nKey:"install",children:"Download and install the package"}),command:r.install,onCopy:()=>He.install()}};return m.jsx(De,{title:n("install"),accent:!0,testId:"instructions",children:m.jsx(b,{...i.install})})},vy=({version:e,distribution:t})=>{const{t:n}=M("translation",{keyPrefix:"distributions.yum.steps"}),{t:r}=M("translation",{keyPrefix:"selectorForm.titles"}),{yumYear:i}=e.metadata,{commands:o}=t.data,s={createRepo:{comment:m.jsxs(z,{t:n,i18nKey:"createRepoFile",children:[m.jsx("b",{children:"Step 1:"})," Create the YUM repo file in the /tmp directory as a normal user"]}),command:o.getCreateRepoCommand(e)},moveRepoFile:{comment:m.jsxs(z,{t:n,i18nKey:"moveFile",values:{year:i,directory:o.directory},children:[m.jsx("b",{children:"Step 2:"})," Move the new openvino-",{year:i},".repo file to the YUM configuration directory ",m.jsx("b",{children:o.directory})]}),command:o.getMoveRepoFileCommand(e)},verifyRepo:{comment:m.jsxs(z,{t:n,i18nKey:"verify",children:[m.jsx("b",{children:"Step 3:"})," Verify that the new repo is properly setup by running the following command"]}),command:o.verifyRepoCommand},install:{comment:m.jsxs(z,{t:n,i18nKey:"install",children:[m.jsx("b",{children:"Step 4:"})," Install OpenVINO Runtime"]}),command:o.getInstallCommand(e),onCopy:()=>He.install()}};return m.jsxs(De,{title:r("install"),accent:!0,testId:"instructions",children:[m.jsx(b,{...s.createRepo}),m.jsx(b,{...s.moveRepoFile}),m.jsx(b,{...s.verifyRepo}),m.jsx(b,{...s.install})]})},yy=({version:e,distribution:t})=>{const{t:n}=M("translation",{keyPrefix:"distributions.zypper.steps"}),{t:r}=M("translation",{keyPrefix:"selectorForm.titles"}),{commands:i}=t.data,o={addRepo:{comment:m.jsxs(z,{t:n,i18nKey:"addRepo",children:[m.jsx("b",{children:"Step 1:"})," Create a ZYPPER repository file with the command below"]}),command:i.addRepo},refresh:{comment:m.jsxs(z,{t:n,i18nKey:"refresh",children:[m.jsx("b",{children:"Step 2:"})," Refresh repositories"]}),command:i.refresh},install:{comment:m.jsxs(z,{t:n,i18nKey:"install",children:[m.jsx("b",{children:"Step 3:"})," Install OpenVINO"]}),command:i.getInstallCommand(e),onCopy:()=>He.install()}};return m.jsxs(De,{title:r("install"),accent:!0,testId:"instructions",children:[m.jsx(b,{...o.addRepo}),m.jsx(b,{...o.refresh}),m.jsx(b,{...o.install})]})},wy=({state:e})=>{const t={ovPackage:e.PACKAGE.selected,os:e.OP_SYSTEM.selected,version:e.VERSION.selected,distribution:e.DISTRIBUTION.selected};if(t.distribution.key===A.PIP)return m.jsx(gy,{...t,distribution:t.distribution});if(t.distribution.key===A.ARCHIVE)return m.jsx(as,{...t,distribution:t.distribution});if(t.distribution.key===A.DOCKER)return m.jsx(as,{...t,distribution:t.distribution});if(t.distribution.key===A.GITHUB||t.distribution.key===A.GITEE)return m.jsx(py,{...t,distribution:t.distribution});if(t.distribution.key===A.APT)return m.jsx(uy,{...t,distribution:t.distribution});if(t.distribution.key===A.YUM)return m.jsx(vy,{...t,distribution:t.distribution});if(t.distribution.key===A.CONDA)return m.jsx(dy,{...t,distribution:t.distribution});if(t.distribution.key===A.BREW)return m.jsx(cy,{...t,distribution:t.distribution});if(t.distribution.key===A.VCPKG)return m.jsx(my,{...t,distribution:t.distribution});if(t.distribution.key===A.CONAN)return m.jsx(fy,{...t,distribution:t.distribution});if(t.distribution.key===A.NPM)return m.jsx(hy,{...t,distribution:t.distribution});if(t.distribution.key===A.ZYPPER)return m.jsx(yy,{...t,distribution:t.distribution});if(t.distribution.key===A.SNAP)return m.jsx(as,{...t,distribution:t.distribution});const n=t.distribution;throw new Error(`${n}`)};function ky(){const{t:e}=M("common",{keyPrefix:"relatedTools"}),{t}=M("translation");return m.jsx(De,{title:t("selectorForm.titles.relatedTools"),testId:"relatedTools",accent:!0,dashed:!0,children:m.jsxs("div",{className:"st-related-tools-links",children:[m.jsx(we,{href:"https://github.com/openvinotoolkit/openvino_notebooks",testId:"notebooks-link",children:e("OpenVINONotebooks")}),m.jsx(we,{href:"https://huggingface.co/docs/optimum/main/intel/openvino/inference",testId:"hf_optimum-link",children:"Hugging Face + Optimum Intel"}),m.jsx("div",{children:m.jsxs(z,{t:e,i18nKey:"tokenizers",children:[m.jsx(we,{href:"https://docs.openvino.ai/2024/learn-openvino/llm_inference_guide/ov-tokenizers.html",testId:"openvino_tokenizers-link",children:"OpenVINO Tokenizers"}),"to streamline tokenizer conversion"]})}),m.jsx("div",{children:m.jsxs(z,{t:e,i18nKey:"nncf",children:[m.jsx(we,{href:"https://docs.openvino.ai/2024/openvino-workflow/model-optimization-guide/compressing-models-during-training.html",testId:"nncf-link",children:"NNCF"}),"for implementing compression algorithms on models"]})}),m.jsx("div",{children:m.jsxs(z,{t:e,i18nKey:"ovms",children:[m.jsx(we,{href:"https://docs.openvino.ai/2024/ovms_what_is_openvino_model_server.html",testId:"ovms-link",children:"OVMS"}),"for serving models optimized for deployment"]})})]})})}function Sy({state:e}){const t=e.PACKAGE.selected,n=e.DISTRIBUTION.selected,r=e.VERSION.selected,{t:i}=M("translation",{keyPrefix:"selectorForm.titles"}),{t:o}=M("common",{keyPrefix:"resources"});let s=m.jsx(m.Fragment,{});if(A.GITHUB===n.key||A.GITEE===n.key){const l=n.key===A.GITHUB?t.key===Se.OPENVINO_BASE?o("githubRepository"):o("githubGenAIRepository"):t.key===Se.OPENVINO_BASE?o("giteeRepository"):o("giteeGenAIRepository");s=m.jsxs(m.Fragment,{children:[m.jsx(we,{href:n.data.links.getBuildInstructionsLink(t,r),testId:"install-instructions-link",children:o("installationInstructions")}),m.jsx(we,{href:n.data.links.getRepositoryLink(t,r),testId:"repository-link",children:l})]})}else s=m.jsx(we,{href:n.data.linksSet.installation,testId:"install-instructions-link",children:o("installationInstructions")});return m.jsx(De,{title:i("resources"),testId:"resources",accent:!0,children:m.jsxs("div",{className:"st-resources-links",children:[m.jsxs("div",{children:[s,m.jsx(we,{href:"https://github.com/openvinotoolkit/openvino/releases",testId:"previous-releases-link",children:o("prevReleases")}),m.jsx(we,{href:r.metadata.systemRequirementsLink,testId:"system-requirements-link",children:o("systemRequirements")})]}),m.jsxs("div",{children:[m.jsx(we,{href:r.metadata.getStartedLink,testId:"get-started-link",children:o("getStarted")}),m.jsx(we,{href:r.metadata.troubleshootingLink,testId:"troubleshooting-link",children:o("troubleshooting")})]})]})})}const sn={toggleButton:"spark-button spark-button-size-l spark-focus-visible spark-focus-visible-self spark-focus-visible-snap",toggleButtonGroup:"spark-button-group spark-button-group-orientation-horizontal spark-button-group-align-start spark-button-group-spacing-l",actionButton:"spark-button-action",secondaryButton:"spark-button-secondary",disabledButton:"spark-button-disabled",buttonContent:"spark-button-content",fontXs:"spark-font-25"},xy=({onClick:e,checked:t=!1,disabled:n=!1,title:r,subtitle:i,value:o})=>m.jsx("button",{className:`${sn.toggleButton} ${t?sn.actionButton:sn.secondaryButton} ${n&&sn.disabledButton}`,type:"button",role:"radio","aria-checked":t,onClick:()=>e==null?void 0:e(),"data-cy":o,"aria-label":r,children:m.jsxs("span",{className:sn.buttonContent,children:[m.jsx("span",{className:"title",children:r}),i&&m.jsx("span",{className:`${sn.fontXs} subtitle`,children:i})]})}),Oy=({children:e,className:t})=>m.jsx("div",{className:`option-button-group ${t||""} ${sn.toggleButtonGroup}`,children:e});function ki({title:e,options:t,level:n}){const r=F.useContext(zd),i=t.map(({level:o,key:s,checked:l,metadata:a})=>m.jsx(xy,{value:`${o}_${s}`,checked:l,title:a.title,subtitle:a.subtitle,onClick:()=>r(o,s)},s));return m.jsx(De,{title:e,testId:n,children:m.jsx(Oy,{children:i})})}function Py({state:e}){const t=e.PACKAGE.nodes,n=e.VERSION.nodes,r=e.OP_SYSTEM.nodes,i=e.DISTRIBUTION.nodes;F.useEffect(()=>He.combinationView(),[e]);const{t:o}=M("translation",{keyPrefix:"selectorForm.titles"});return m.jsxs(m.Fragment,{children:[m.jsx(ki,{title:o("package"),options:t,level:T.PACKAGE}),m.jsx(ki,{title:o("version"),options:n,level:T.VERSION}),m.jsx(ki,{title:o("os"),options:r,level:T.OP_SYSTEM}),m.jsx(ki,{title:o("distribution"),options:i,level:T.DISTRIBUTION})]})}const{SelectorContext:zd,useSelector:Ny}=qv();He.initialize(window.parent);function _y(){const[e,t]=Ny();return m.jsx("div",{className:`st-responsive-container ${Fd?"idz-page":""}`,children:m.jsxs(zd.Provider,{value:t,children:[m.jsx(Py,{state:e}),m.jsx(wy,{state:e}),m.jsx(Sy,{state:e}),m.jsx(ky,{})]})})}ds.createRoot(document.getElementById("root")).render(m.jsx(np.StrictMode,{children:m.jsx(_y,{})})); +EOF`,getMoveRepoFileCommand:e=>`sudo mv /tmp/openvino-${e.metadata.yumYear}.repo ${Zu}`,verifyRepoCommand:"yum repolist | grep -i openvino",getInstallCommand:e=>`sudo yum install openvino-${e.metadata.yumVersion}`};class Sv extends Ae{constructor(t){super({level:T.DISTRIBUTION,key:A.ZYPPER,metadata:{title:"ZYPPER",subtitle:de("distributions.CAPIOnly")}}),this._data=t}get data(){return{...this._data,commands:xv}}}const xv={addRepo:"sudo zypper addrepo https://download.opensuse.org/repositories/science/openSUSE_Tumbleweed/science.repo",refresh:"sudo zypper refresh",getInstallCommand:({metadata:e})=>`sudo zypper install openvino-devel-${e.zypperVersion} openvino-sample-${e.zypperVersion}`};class aa extends Xr{constructor(t,n,r){super({level:T.OP_SYSTEM,key:t,metadata:n},r),this._setDefaultOS()}_setDefaultOS(){const t=this._detectOS()||Qe.WINDOWS;this.key===t&&this.default()}_detectOS(){const{userAgent:t}=navigator,n={windows:/(Windows|Win)/g,macOS:/(Macintosh|Mac)/g,linux:/(Linux|X11)/g};return n.windows.test(t)?Qe.WINDOWS:n.macOS.test(t)?Qe.MACOS:n.linux.test(t)?Qe.LINUX:null}}class Zr extends aa{constructor(t){super(Qe.WINDOWS,Mm,t)}}class qr extends aa{constructor(t){super(Qe.MACOS,Bm,t)}}class ei extends aa{constructor(t){super(Qe.LINUX,Km,t)}}const Ov=new ei([new Ee({linksSet:{installation:"https://docs.openvino.ai/nightly/get-started/install-openvino/install-openvino-pip.html"}},{pythonAPI:!0}).includesNPUPlugin().default(),new Pe({linksSet:{installation:"https://docs.openvino.ai/nightly/get-started/install-openvino/install-openvino-archive-linux.html"},downloadLink:"https://storage.openvinotoolkit.org/repositories/openvino/packages/nightly/latest"}),new _e,new Ne]),Pv=new qr([new Ee({linksSet:{installation:"https://docs.openvino.ai/nightly/get-started/install-openvino/install-openvino-pip.html"}},{pythonAPI:!0}).default(),new Pe({linksSet:{installation:"https://docs.openvino.ai/nightly/get-started/install-openvino/install-openvino-archive-macos.html"},downloadLink:"https://storage.openvinotoolkit.org/repositories/openvino/packages/nightly/latest"}),new _e,new Ne]),Nv=new Zr([new Ee({linksSet:{installation:"https://docs.openvino.ai/nightly/get-started/install-openvino/install-openvino-pip.html"}},{pythonAPI:!0}).includesNPUPlugin().default(),new Pe({linksSet:{installation:"https://docs.openvino.ai/nightly/get-started/install-openvino/install-openvino-archive-windows.html"},downloadLink:"https://storage.openvinotoolkit.org/repositories/openvino/packages/nightly/latest"}),new _e,new Ne]),_v=new Cd([Nv,Pv,Ov]),Ev=new ei([new Ee({linksSet:{installation:"https://docs.openvino.ai/2023.3/openvino_docs_install_guides_installing_openvino_pip.html"}},{pythonAPI:!0}).default(),new Pe({linksSet:{installation:"https://docs.openvino.ai/2023.3/openvino_docs_install_guides_installing_openvino_from_archive_linux.html"},downloadLink:"https://storage.openvinotoolkit.org/repositories/openvino/packages/2023.3/linux"}).includesNPUPlugin(),new Id({linksSet:{installation:"https://docs.openvino.ai/2023.3/openvino_docs_install_guides_installing_openvino_apt.html"},os:[re.UBUNTU_18,re.UBUNTU_20,re.UBUNTU_22]}),new Td({linksSet:{installation:"https://docs.openvino.ai/2023.3/openvino_docs_install_guides_installing_openvino_yum.html"}}),new _e,new Ne,new ir({linksSet:{installation:"https://docs.openvino.ai/2023.3/openvino_docs_install_guides_installing_openvino_docker.html"},downloadLink:"https://docs.openvino.ai/2023.3/openvino_docs_install_guides_installing_openvino_docker.html"}),new rr({linksSet:{installation:"https://docs.openvino.ai/2023.3/openvino_docs_install_guides_installing_openvino_conda.html"}}),new nr({linksSet:{installation:"https://docs.openvino.ai/2023.3/openvino_docs_install_guides_installing_openvino_conan.html"}})]),Cv=new qr([new Ee({linksSet:{installation:"https://docs.openvino.ai/2023.3/openvino_docs_install_guides_installing_openvino_pip.html"}},{pythonAPI:!0}).default(),new Pe({linksSet:{installation:"https://docs.openvino.ai/2023.3/openvino_docs_install_guides_installing_openvino_from_archive_macos.html"},downloadLink:"https://storage.openvinotoolkit.org/repositories/openvino/packages/2023.3/macos"}),new _e,new Ne,new rr({linksSet:{installation:"https://docs.openvino.ai/2023.3/openvino_docs_install_guides_installing_openvino_conda.html"}}),new nr({linksSet:{installation:"https://docs.openvino.ai/2023.3/openvino_docs_install_guides_installing_openvino_conan.html"}})]),jv=new Zr([new Ee({linksSet:{installation:"https://docs.openvino.ai/2023.3/openvino_docs_install_guides_installing_openvino_pip.html"}},{pythonAPI:!0}).default(),new Pe({linksSet:{installation:"https://docs.openvino.ai/2023.3/openvino_docs_install_guides_installing_openvino_from_archive_windows.html"},downloadLink:"https://storage.openvinotoolkit.org/repositories/openvino/packages/2023.3/windows"}).includesNPUPlugin(),new _e,new Ne,new ir({linksSet:{installation:"https://docs.openvino.ai/2023.3/openvino_docs_install_guides_installing_openvino_docker.html"},downloadLink:"https://docs.openvino.ai/2023.3/openvino_docs_install_guides_installing_openvino_docker.html"}),new rr({linksSet:{installation:"https://docs.openvino.ai/2023.3/openvino_docs_install_guides_installing_openvino_conda.html"}}),new nr({linksSet:{installation:"https://docs.openvino.ai/2023.3/openvino_docs_install_guides_installing_openvino_conan.html"}})]),Iv=new Xm([jv,Cv,Ev]),Lv=new ei([new Ee({linksSet:{installation:"https://docs.openvino.ai/2024/get-started/install-openvino/install-openvino-pip.html"}},{pythonAPI:!0}).includesNPUPlugin().default(),new Pe({linksSet:{installation:"https://docs.openvino.ai/2024/get-started/install-openvino/install-openvino-archive-linux.html"},downloadLink:"https://storage.openvinotoolkit.org/repositories/openvino/packages/2024.6/linux"}).includesNPUPlugin(),new Id({linksSet:{installation:"https://docs.openvino.ai/2024/get-started/install-openvino/install-openvino-apt.html"},os:[re.UBUNTU_20,re.UBUNTU_22,re.UBUNTU_24]}),new Td({linksSet:{installation:"https://docs.openvino.ai/2024/get-started/install-openvino/install-openvino-yum.html"}}),new _e,new Ne,new ir({linksSet:{installation:"https://docs.openvino.ai/2024/get-started/install-openvino/install-openvino-docker-linux.html"},downloadLink:"https://docs.openvino.ai/2024/get-started/install-openvino/install-openvino-docker-linux.html"}),new rr({linksSet:{installation:"https://docs.openvino.ai/2024/get-started/install-openvino/install-openvino-conda.html"}}),new Ld({linksSet:{installation:"https://docs.openvino.ai/2024/get-started/install-openvino/install-openvino-brew.html"}}),new la({linksSet:{installation:"https://docs.openvino.ai/2024/get-started/install-openvino/install-openvino-vcpkg.html"}}),new nr({linksSet:{installation:"https://docs.openvino.ai/2024/get-started/install-openvino/install-openvino-conan.html"}}),new sa({linksSet:{installation:"https://docs.openvino.ai/2024/get-started/install-openvino/install-openvino-npm.html"}}),new Sv({linksSet:{installation:"https://docs.openvino.ai/2024/get-started/install-openvino/install-openvino-zypper.html"}}),new yv({linksSet:{installation:"https://docs.openvino.ai/2024/openvino-workflow/deployment-locally/integrate-openvino-with-ubuntu-snap.html"},downloadLink:"https://docs.openvino.ai/2024/openvino-workflow/deployment-locally/integrate-openvino-with-ubuntu-snap.html"})]),Rv=new qr([new Ee({linksSet:{installation:"https://docs.openvino.ai/2024/get-started/install-openvino/install-openvino-pip.html"}},{pythonAPI:!0}).default(),new Pe({linksSet:{installation:"https://docs.openvino.ai/2024/get-started/install-openvino/install-openvino-archive-macos.html"},downloadLink:"https://storage.openvinotoolkit.org/repositories/openvino/packages/2024.6/macos"}),new _e,new Ne,new rr({linksSet:{installation:"https://docs.openvino.ai/2024/get-started/install-openvino/install-openvino-conda.html"}}),new Ld({linksSet:{installation:"https://docs.openvino.ai/2024/get-started/install-openvino/install-openvino-brew.html"}}),new la({linksSet:{installation:"https://docs.openvino.ai/2024/get-started/install-openvino/install-openvino-vcpkg.html"}}),new nr({linksSet:{installation:"https://docs.openvino.ai/2024/get-started/install-openvino/install-openvino-conan.html"}}),new sa({linksSet:{installation:"https://docs.openvino.ai/2024/get-started/install-openvino/install-openvino-npm.html"}})]),Tv=new Zr([new Ee({linksSet:{installation:"https://docs.openvino.ai/2024/get-started/install-openvino/install-openvino-pip.html"}},{pythonAPI:!0}).includesNPUPlugin().default(),new Pe({linksSet:{installation:"https://docs.openvino.ai/2024/get-started/install-openvino/install-openvino-archive-windows.html"},downloadLink:"https://storage.openvinotoolkit.org/repositories/openvino/packages/2024.6/windows"}).includesNPUPlugin(),new _e,new Ne,new ir({linksSet:{installation:"https://docs.openvino.ai/2024/get-started/install-openvino/install-openvino-docker-linux.html"},downloadLink:"https://docs.openvino.ai/2024/get-started/install-openvino/install-openvino-docker-linux.html"}),new rr({linksSet:{installation:"https://docs.openvino.ai/2024/get-started/install-openvino/install-openvino-conda.html"}}),new la({linksSet:{installation:"https://docs.openvino.ai/2024/get-started/install-openvino/install-openvino-vcpkg.html"}}),new nr({linksSet:{installation:"https://docs.openvino.ai/2024/get-started/install-openvino/install-openvino-conan.html"}}),new sa({linksSet:{installation:"https://docs.openvino.ai/2024/get-started/install-openvino/install-openvino-npm.html"}})]),Av=new jd([Tv,Rv,Lv]),Dv=new Gm([Av.default(),_v,Iv]),Uv=new ei([new Ee({linksSet:{installation:"https://docs.openvino.ai/nightly/get-started/install-openvino/install-openvino-genai.html#pypi-installation"}},{pythonAPI:!0}).includesNPUPlugin().default(),new Pe({linksSet:{installation:"https://docs.openvino.ai/nightly/get-started/install-openvino/install-openvino-genai.html#archive-installation"},downloadLink:"https://storage.openvinotoolkit.org/repositories/openvino_genai/packages/nightly/latest"}),new _e,new Ne]),Fv=new qr([new Ee({linksSet:{installation:"https://docs.openvino.ai/nightly/get-started/install-openvino/install-openvino-genai.html#pypi-installation"}},{pythonAPI:!0}).default(),new Pe({linksSet:{installation:"https://docs.openvino.ai/nightly/get-started/install-openvino/install-openvino-genai.html#archive-installation"},downloadLink:"https://storage.openvinotoolkit.org/repositories/openvino_genai/packages/nightly/latest"}),new _e,new Ne]),zv=new Zr([new Ee({linksSet:{installation:"https://docs.openvino.ai/nightly/get-started/install-openvino/install-openvino-genai.html#pypi-installation"}},{pythonAPI:!0}).includesNPUPlugin().default(),new Pe({linksSet:{installation:"https://docs.openvino.ai/nightly/get-started/install-openvino/install-openvino-genai.html#archive-installation"},downloadLink:"https://storage.openvinotoolkit.org/repositories/openvino_genai/packages/nightly/latest"}),new _e,new Ne]),Vv=new Cd([zv,Fv,Uv]),bv=new ei([new Ee({linksSet:{installation:"https://docs.openvino.ai/2024/get-started/install-openvino/install-openvino-genai.html"}},{pythonAPI:!0}).includesNPUPlugin().default(),new Pe({linksSet:{installation:"https://docs.openvino.ai/2024/get-started/install-openvino/install-openvino-genai.html"},downloadLink:"https://storage.openvinotoolkit.org/repositories/openvino_genai/packages/2024.6/linux"}).includesNPUPlugin(),new _e,new Ne,new ir({linksSet:{installation:"https://docs.openvino.ai/2024/get-started/install-openvino/install-openvino-docker-linux.html"},downloadLink:"https://docs.openvino.ai/2024/get-started/install-openvino/install-openvino-docker-linux.html"})]),$v=new qr([new Ee({linksSet:{installation:"https://docs.openvino.ai/2024/get-started/install-openvino/install-openvino-genai.html"}},{pythonAPI:!0}).default(),new Pe({linksSet:{installation:"https://docs.openvino.ai/2024/get-started/install-openvino/install-openvino-genai.html"},downloadLink:"https://storage.openvinotoolkit.org/repositories/openvino_genai/packages/2024.6/macos"}),new _e,new Ne]),Mv=new Zr([new Ee({linksSet:{installation:"https://docs.openvino.ai/2024/get-started/install-openvino/install-openvino-genai.html"}},{pythonAPI:!0}).includesNPUPlugin().default(),new Pe({linksSet:{installation:"https://docs.openvino.ai/2024/get-started/install-openvino/install-openvino-genai.html"},downloadLink:"https://storage.openvinotoolkit.org/repositories/openvino_genai/packages/2024.6/windows"}).includesNPUPlugin(),new _e,new Ne,new ir({linksSet:{installation:"https://docs.openvino.ai/2024/get-started/install-openvino/install-openvino-docker-linux.html"},downloadLink:"https://docs.openvino.ai/2024/get-started/install-openvino/install-openvino-docker-linux.html"})]),Bv=new jd([Mv,$v,bv]),Kv=new Wm([Bv.default(),Vv]),Hv=new Xr({level:T.ROOT,key:_d.ROOT,metadata:{title:"ROOT"}},[Dv.default(),Kv]).default();function Gv(e,t){var i,o;if(t.key===A.DOCKER||!t.footnoteLevel)return e;const n=(i=e[t.footnoteLevel])==null?void 0:i.selected,r=(o=e[t.footnoteLevel])==null?void 0:o.nodes;return!n||!r||((Array.isArray(n)?[...n,...r]:[n]).forEach(s=>s.hasFootnote=!0),r.forEach(s=>s.checked&&(s.hasFootnote=!0))),e}class Wv{constructor(){ze(this,"_root",Hv)}getState(){try{return this._getState()}catch(t){return console.error(t),this._selectDefaults(this._root),this._getState()}}_getState(){const t=this._root.children,n=this._get_selected(t),r=n.children,i=this._get_selected(r),{systems:o,system:s}=this._processVersion(i),l=s.children,a=this._get_selected(l),c={[T.PACKAGE]:{nodes:t.map(p=>p.toOption()),selected:n.toOption()},[T.VERSION]:{nodes:r.map(p=>p.toOption()),selected:i.toOption()},[T.OP_SYSTEM]:{nodes:o.map(p=>p.toOption()),selected:s.toOption()},[T.DISTRIBUTION]:{nodes:l.map(p=>p.toOption()),selected:a.toOption()}};return Gv(c,a)}_get_selected(t){t.some(({checked:r})=>r)||this._selectDefaultsForLevel(t[0].level);const n=t.find(({checked:r})=>r);if(!n)throw new Error("Not valid tree");return n}_processVersion(t){const n=t.children,r=this._get_selected(n);return{systems:n,system:r}}setState(t){this._setState(t)}_setState(t,n=this._root){if(!n.children.length)return;const r=n.children[0].level,i=Yv(t[r]);n.children.forEach(o=>o.checked=i.includes(o.key)),n.children.forEach(o=>this._setState(t,o))}select(t,n){return this._select(t,n),this.getState()}_select(t,n,r=this._root){var i;if(((i=r.children[0])==null?void 0:i.level)!==t){r.children.forEach(o=>this._select(t,n,o));return}if(r.childrenSelector){r.childrenSelector(r.children,n);return}r.children.forEach(o=>o.checked=o.key===n)}_selectDefaultsForLevel(t,n=this._root){if(n.children.length){if(n.children[0].level!==t){n.children.forEach(r=>this._selectDefaultsForLevel(t,r));return}this._selectDefaults(n)}}_selectDefaults(t){t.children.forEach(n=>{n.checked=n.isDefault,this._selectDefaults(n)})}}const _n=new Wv;function Yv(e){const t=[];return Array.isArray(e)?t.push(...e):e&&t.push(e),t}function Ad(e,{serializeVersion:t}={serializeVersion:!0}){const n=[[T.PACKAGE,e.PACKAGE.selected.key],[T.VERSION,t?e.VERSION.selected.key:null],[T.OP_SYSTEM,e.OP_SYSTEM.selected.key],[T.DISTRIBUTION,e.DISTRIBUTION.selected.key]],r=new URLSearchParams;for(const[i,o]of n)o&&r.set(i,o);return r}function Dd(e){function t(n,r){const i=e.get(n);if(!i)throw new Error(`Cannot extract value for: ${n}`);if(!r[i])throw new Error(`Bad node key for: ${n}`);return r[i]}try{return{[T.PACKAGE]:t(T.PACKAGE,Se),[T.VERSION]:e.has(T.VERSION)?t(T.VERSION,wn):null,[T.OP_SYSTEM]:t(T.OP_SYSTEM,Qe),[T.DISTRIBUTION]:t(T.DISTRIBUTION,A)}}catch(n){return console.log(`Cannot restore state from url due to error "${n}"`),null}}function Qv(){const e=window.parent;if(!e.location.search)return null;const t=new URLSearchParams(e.location.search);return Dd(t)}function Jv(e,t,n,{serializeVersion:r}={serializeVersion:!0}){F.useEffect(()=>{const i=window.parent,o=Ad(t,{serializeVersion:r}).toString(),s=new URL(i.location.toString());if(!s.search){s.search=o,i.history.replaceState(null,"",s);return}s.search.slice(1)!==o&&(s.search=o,i.history.pushState(null,"",s))}),parent.onpopstate=()=>{const i=window.parent,o=new URLSearchParams(i.location.search),s=Dd(o);s&&(e.setState(s),n(e.getState()))}}const os=function(e){let t,n=!1;return function(...r){return n||(t=e(r),n=!0),t}};function Xv(e){var t,n;return typeof((n=(t=e.wap_tms)==null?void 0:t.custom)==null?void 0:n.trackComponentClick)!="function"?null:e.wap_tms.custom.trackComponentClick.bind(e.wap_tms.custom)}class Zv{constructor(){ze(this,"_window");ze(this,"_consoleNotification",{notInitialized:os(()=>console.log("Adobe analytics is not initialized")),notFound:os(()=>console.log("Adobe analytics not found on a page")),devMode:os(()=>console.log("Analytics in dev mode"))});ze(this,"_send",t=>{if(!this._window){this._consoleNotification.notInitialized();return}const n=Ad(_n.getState()).toString(),r=Xv(this._window);if(!r){this._consoleNotification.notFound();return}try{r(t,n)}catch(i){console.error(i)}})}initialize(t){this._window=t}install(){this._send("install")}combinationView(){this._send("combination-view")}}const He=new Zv;function qv(){const e=Qv();e&&_n.setState(e);const t=F.createContext((r,i)=>{_n.select(r,i)});function n(){const[r,i]=F.useState(_n.getState());return Jv(_n,r,i),[r,(o,s)=>i(_n.select(o,s))]}return{SelectorContext:t,useSelector:n}}async function ey(e){e&&(navigator.clipboard?await navigator.clipboard.writeText(e):ty(e))}function ty(e){const t=ny(e);document.body.append(t),t.select(),document.execCommand("copy"),t.remove()}function ny(e){const t=document.createElement("textarea");t.style.fontSize="12pt",t.style.border="0",t.style.padding="0",t.style.margin="0",t.style.position="absolute",t.style.left="-9999px";const n=window.pageYOffset||document.documentElement.scrollTop;return t.style.top=`${n}px`,t.setAttribute("readonly",""),t.value=e,t}function ry(){return m.jsxs("svg",{version:"1.1",width:"24",height:"24",viewBox:"0 0 205 205",xmlns:"http://www.w3.org/2000/svg",className:"svg-icon",children:[m.jsx("path",{fill:"none",stroke:"currentColor",strokeWidth:"10",d:"M 50 145 a 15 15 0 0 1 -15 -15 v -90 a 15 15 0 0 1 15 -15 h 70 a 15 15 0 0 1 15 15 v 5"}),m.jsx("rect",{x:"65",y:"60",width:"100",height:"120",rx:"15",fill:"none",stroke:"currentColor",strokeWidth:"10"})]})}function iy(){return m.jsx("svg",{version:"1.1",width:"24",height:"24",viewBox:"0 0 200 200",xmlns:"http://www.w3.org/2000/svg",className:"svg-icon",children:m.jsx("path",{strokeLinejoin:"round",strokeLinecap:"round",fill:"none",stroke:"currentColor",strokeWidth:"15",d:"M 40 100 L 90 150 L 170 40"})})}const b=({comment:e,command:t,onCopy:n})=>{const[r,i]=F.useState(!1),o=async()=>{r||(await ey(t),i(!0),setTimeout(()=>i(!1),1500),n==null||n())};return m.jsxs("div",{className:"st-code-snippet","data-cy":"instructions-step",children:[e&&m.jsx(Ud,{children:e}),m.jsxs("div",{"data-cy":"command",children:[t&&m.jsx("code",{className:"st-code-snippet-content",children:t}),t&&m.jsx("button",{className:"copy-button",type:"button","aria-label":"Copy","data-cy":"copy",onClick:o,children:r?m.jsx(iy,{}):m.jsx(ry,{})})]})]})},Ud=({children:e})=>m.jsxs("pre",{className:"st-code-snippet-comment",children:["# ",e]}),oy=({comment:e,snippets:t})=>m.jsxs("div",{className:"st-code-snippet-multi-line","data-cy":"command",children:[e&&m.jsx(Ud,{children:e}),t.map(n=>m.jsx(b,{...n},n.command))]});function sy(e){return e.host==="docs.openvino.ai"}const ss="production.docs.en",Fd=(ss==null?void 0:ss.includes("idz"))||!1,ls={link:"spark-hyperlink spark-hyperlink-primary spark-hyperlink-standard spark-focus-visible spark-focus-visible-self spark-focus-visible-snap spark-focus-visible-background",button:"spark-button spark-button-action spark-button-size-m spark-focus-visible spark-focus-visible-self spark-focus-visible-snap",buttonContent:"spark-button-content"},we=({href:e,children:t,type:n="link",testId:r="link",onClick:i})=>{const o=!Fd&&sy(new URL(e))?"_parent":"_blank";return n==="link"?m.jsx("a",{href:e,className:ls.link,target:o,rel:"noreferrer noopener","data-cy":r,onClick:()=>i==null?void 0:i(),children:t}):m.jsx("span",{className:ls.button,children:m.jsx("span",{className:ls.buttonContent,children:m.jsx("a",{href:e,target:o,rel:"noreferrer noopener","data-cy":r,onClick:()=>i==null?void 0:i(),children:t})})})},ly={heading:"spark-heading spark-font-200"},De=({title:e,accent:t=!1,dashed:n=!1,children:r,testId:i})=>m.jsxs("div",{className:`st-section ${t?"st-section-accent":""} ${n?"st-section-dashed":""}`,"data-cy":i,children:[m.jsx("span",{className:`st-section-title ${ly.heading}`,children:e}),m.jsx("div",{className:"st-section-content",children:F.Children.map(r,o=>m.jsx(ay,{children:o}))})]}),ay=({children:e})=>m.jsx("div",{className:"st-section-content-row",children:e}),uy=({version:e,distribution:t})=>{const{t:n}=M("translation",{keyPrefix:"distributions.apt.steps"}),{t:r}=M("translation",{keyPrefix:"selectorForm.titles"}),{commands:i}=t.data,o={comment:m.jsxs(z,{ns:"translation",i18nKey:"distributions.apt.steps.addRepository",children:[m.jsx("b",{children:"Step 3:"})," Add the repository via the following command"]}),snippets:i.getAddRepositoryCommands(e,t.data.os).map(({ubuntuVersionNumber:l,command:a})=>({comment:`Ubuntu ${l}`,command:a}))},s={downloadKey:{comment:m.jsxs(z,{t:n,i18nKey:"download",values:{filename:i.keyFilename},children:[m.jsx("b",{children:"Step 1:"})," Download the ",m.jsx(we,{href:i.keyHref,children:i.keyFilename}),". You can also use the following command"]}),command:i.downloadKeyCommand},addKey:{comment:m.jsxs(z,{t:n,i18nKey:"addKey",children:[m.jsx("b",{children:"Step 2:"})," Add this key to the system keyring"]}),command:i.addKeyCommand},addRepository:o,updatePackages:{comment:m.jsxs(z,{t:n,i18nKey:"updateList",children:[m.jsx("b",{children:"Step 4:"})," Update the list of packages via the update command"]}),command:i.updatePackagesCommand},verifyAptCache:{comment:m.jsxs(z,{t:n,i18nKey:"verify",children:[m.jsx("b",{children:"Step 5:"})," Verify that the APT repository is properly set up. Run the apt-cache command to see a list of all available OpenVINO packages and components"]}),command:i.verifyAptCacheCommand},install:{comment:m.jsxs(z,{t:n,i18nKey:"install",children:[m.jsx("b",{children:"Step 6:"})," Install OpenVINO Runtime"]}),command:i.getInstallCommand(e),onCopy:()=>He.install()}};return m.jsxs(De,{title:r("install"),accent:!0,testId:"instructions",children:[m.jsx(b,{...s.downloadKey}),m.jsx(b,{...s.addKey}),m.jsx(oy,{...s.addRepository}),m.jsx(b,{...s.updatePackages}),m.jsx(b,{...s.verifyAptCache}),m.jsx(b,{...s.install})]})},cy=({distribution:e})=>{const{t}=M("translation",{keyPrefix:"distributions.brew.steps"}),{t:n}=M("translation",{keyPrefix:"selectorForm.titles"}),{commands:r}=e.data,i={install:{comment:m.jsx(z,{t,i18nKey:"install",children:"Download and install the package"}),command:r.install,onCopy:()=>He.install()}};return m.jsx(De,{title:n("install"),accent:!0,testId:"instructions",children:m.jsx(b,{...i.install})})},fy=({version:e,distribution:t})=>{const{t:n}=M("translation",{keyPrefix:"distributions.conan.steps"}),{t:r}=M("translation",{keyPrefix:"selectorForm.titles"}),{commands:i}=t.data,{txtFilename:o,cmakeFilename:s}=i,l={createConanFile:{comment:m.jsxs(z,{t:n,i18nKey:"createConanFile",values:{txtFilename:o},children:[m.jsx("b",{children:"Step 1:"})," Create a ",m.jsx("b",{children:o})," file for your OpenVINO project and add “openvino” dependency in there"]}),command:i.conanTXTContent(e)},install:{comment:m.jsxs(z,{t:n,i18nKey:"install",values:{cmakeFilename:s},children:[m.jsx("b",{children:"Step 2:"})," Run the command below to create ",m.jsx("b",{children:s})," file, which will be used to compile your project with OpenVINO"]}),command:i.install,onCopy:()=>He.install()},compile:{comment:m.jsxs(z,{t:n,i18nKey:"compile",children:[m.jsx("b",{children:"Step 3:"})," Configure and compile your project with OpenVINO"]}),command:i.compile}};return m.jsxs(De,{title:r("install"),accent:!0,testId:"instructions",children:[m.jsx(b,{...l.createConanFile}),m.jsx(b,{...l.install}),m.jsx(b,{...l.compile})]})},dy=({version:e,distribution:t})=>{const{t:n}=M("translation",{keyPrefix:"distributions.conda.steps"}),{t:r}=M("translation",{keyPrefix:"selectorForm.titles"}),{commands:i}=t.data,o={createEnv:{comment:m.jsxs(z,{t:n,i18nKey:"createEnv",children:[m.jsx("b",{children:"Step 1:"})," Create the Anaconda environment (Python 3.10 used as an example)"]}),command:i.createEnv},activateEnv:{comment:m.jsxs(z,{t:n,i18nKey:"activateEnv",children:[m.jsx("b",{children:"Step 2:"})," Activate the Anaconda environment"]}),command:i.activateEnv},upgradePip:{comment:m.jsxs(z,{t:n,i18nKey:"update",children:[m.jsx("b",{children:"Step 3:"})," Update the Anaconda to latest version"]}),command:i.update},install:{comment:m.jsxs(z,{t:n,i18nKey:"install",children:[m.jsx("b",{children:"Step 4:"})," Download and install the package"]}),command:i.getInstall(e),onCopy:()=>He.install()}};return m.jsxs(De,{title:r("install"),accent:!0,testId:"instructions",children:[m.jsx(b,{...o.createEnv}),m.jsx(b,{...o.activateEnv}),m.jsx(b,{...o.upgradePip}),m.jsx(b,{...o.install})]})},as=({ovPackage:e,distribution:t})=>{const{t:n}=M("translation",{keyPrefix:"distributions.download"}),{t:r}=M("translation",{keyPrefix:"selectorForm.titles"}),i={[A.ARCHIVE]:e.key===Se.OPENVINO_BASE?n("downloadArchives"):n("downloadArchivesGenAI"),[A.DOCKER]:n("gotoDocker"),[A.SNAP]:n("gotoInstallInstruction")}[t.key],o=m.jsxs(m.Fragment,{children:[n("useFollowingLink"),m.jsx("br",{}),m.jsx("b",{children:m.jsx(we,{href:t.data.downloadLink,testId:"download-button",onClick:()=>He.install(),children:i})})]});return m.jsx(De,{title:r("install"),accent:!0,testId:"instructions",children:m.jsx(b,{comment:o})})},py=({ovPackage:e,version:t,distribution:n})=>{const{t:r}=M("translation",{keyPrefix:"distributions.githubGitee"}),{t:i}=M("translation",{keyPrefix:"selectorForm.titles"}),o={clone:{comment:m.jsxs(z,{t:r,i18nKey:"steps.useGitClone",children:[m.jsx("b",{children:"Step 1:"})," Use Git to clone the OpenVINO toolkit repository"]}),command:n.data.commands.getCloneCommand(e,t),onCopy:()=>He.install()},build:{comment:m.jsxs(z,{t:r,i18nKey:"steps.buildInstructions",children:[m.jsx("b",{children:"Step 2:"})," Follow the ",m.jsx(we,{href:n.data.links.getBuildInstructionsLink(e,t),testId:"build-instructions-link",children:"instructions to build from source"})]})}};return m.jsxs(De,{title:i("install"),accent:!0,testId:"instructions",children:[m.jsx(b,{...o.clone}),m.jsx(b,{...o.build})]})},hy=({distribution:e,version:t})=>{const{t:n}=M("translation",{keyPrefix:"distributions.npm.steps"}),{t:r}=M("translation",{keyPrefix:"selectorForm.titles"}),{commands:i}=e.data,o={install:{comment:m.jsx(z,{t:n,i18nKey:"install",children:"Download and install the package"}),command:i.getInstall(t),onCopy:()=>He.install()}};return m.jsx(De,{title:r("install"),accent:!0,testId:"instructions",children:m.jsx(b,{...o.install})})},gy=({ovPackage:e,os:t,version:n,distribution:r})=>{const{t:i}=M("translation",{keyPrefix:"distributions.pip.steps"}),{t:o}=M("translation",{keyPrefix:"selectorForm.titles"}),{commands:s}=r.data,l=s.getCreateVenvCommand(t,n),a=s.getActivateVenvCommand(t,n),c=s.getInstallCommand({ovPackage:e,os:t,version:n}),p={createEnv:{comment:m.jsxs(z,{t:i,i18nKey:"createVenv",children:[m.jsx("b",{children:"Step 1:"})," Create virtual environment"]}),command:l},activateEnv:{comment:m.jsxs(z,{t:i,i18nKey:"activateVenv",children:[m.jsx("b",{children:"Step 2:"})," Activate virtual environment"]}),command:a},upgradePip:{comment:m.jsxs(z,{t:i,i18nKey:"upgradePip",children:[m.jsx("b",{children:"Step 3:"})," Upgrade pip to latest version"]}),command:s.upgradeCommand},install:{comment:m.jsxs(z,{t:i,i18nKey:"install",children:[m.jsx("b",{children:"Step 4:"})," Download and install the package"]}),command:c,onCopy:()=>He.install()}};return m.jsxs(De,{title:o("install"),accent:!0,testId:"instructions",children:[m.jsx(b,{...p.createEnv}),m.jsx(b,{...p.activateEnv}),m.jsx(b,{...p.upgradePip}),m.jsx(b,{...p.install})]})},my=({distribution:e})=>{const{t}=M("translation",{keyPrefix:"distributions.vcpkg.steps"}),{t:n}=M("translation",{keyPrefix:"selectorForm.titles"}),{commands:r}=e.data,i={install:{comment:m.jsx(z,{t,i18nKey:"install",children:"Download and install the package"}),command:r.install,onCopy:()=>He.install()}};return m.jsx(De,{title:n("install"),accent:!0,testId:"instructions",children:m.jsx(b,{...i.install})})},vy=({version:e,distribution:t})=>{const{t:n}=M("translation",{keyPrefix:"distributions.yum.steps"}),{t:r}=M("translation",{keyPrefix:"selectorForm.titles"}),{yumYear:i}=e.metadata,{commands:o}=t.data,s={createRepo:{comment:m.jsxs(z,{t:n,i18nKey:"createRepoFile",children:[m.jsx("b",{children:"Step 1:"})," Create the YUM repo file in the /tmp directory as a normal user"]}),command:o.getCreateRepoCommand(e)},moveRepoFile:{comment:m.jsxs(z,{t:n,i18nKey:"moveFile",values:{year:i,directory:o.directory},children:[m.jsx("b",{children:"Step 2:"})," Move the new openvino-",{year:i},".repo file to the YUM configuration directory ",m.jsx("b",{children:o.directory})]}),command:o.getMoveRepoFileCommand(e)},verifyRepo:{comment:m.jsxs(z,{t:n,i18nKey:"verify",children:[m.jsx("b",{children:"Step 3:"})," Verify that the new repo is properly setup by running the following command"]}),command:o.verifyRepoCommand},install:{comment:m.jsxs(z,{t:n,i18nKey:"install",children:[m.jsx("b",{children:"Step 4:"})," Install OpenVINO Runtime"]}),command:o.getInstallCommand(e),onCopy:()=>He.install()}};return m.jsxs(De,{title:r("install"),accent:!0,testId:"instructions",children:[m.jsx(b,{...s.createRepo}),m.jsx(b,{...s.moveRepoFile}),m.jsx(b,{...s.verifyRepo}),m.jsx(b,{...s.install})]})},yy=({version:e,distribution:t})=>{const{t:n}=M("translation",{keyPrefix:"distributions.zypper.steps"}),{t:r}=M("translation",{keyPrefix:"selectorForm.titles"}),{commands:i}=t.data,o={addRepo:{comment:m.jsxs(z,{t:n,i18nKey:"addRepo",children:[m.jsx("b",{children:"Step 1:"})," Create a ZYPPER repository file with the command below"]}),command:i.addRepo},refresh:{comment:m.jsxs(z,{t:n,i18nKey:"refresh",children:[m.jsx("b",{children:"Step 2:"})," Refresh repositories"]}),command:i.refresh},install:{comment:m.jsxs(z,{t:n,i18nKey:"install",children:[m.jsx("b",{children:"Step 3:"})," Install OpenVINO"]}),command:i.getInstallCommand(e),onCopy:()=>He.install()}};return m.jsxs(De,{title:r("install"),accent:!0,testId:"instructions",children:[m.jsx(b,{...o.addRepo}),m.jsx(b,{...o.refresh}),m.jsx(b,{...o.install})]})},wy=({state:e})=>{const t={ovPackage:e.PACKAGE.selected,os:e.OP_SYSTEM.selected,version:e.VERSION.selected,distribution:e.DISTRIBUTION.selected};if(t.distribution.key===A.PIP)return m.jsx(gy,{...t,distribution:t.distribution});if(t.distribution.key===A.ARCHIVE)return m.jsx(as,{...t,distribution:t.distribution});if(t.distribution.key===A.DOCKER)return m.jsx(as,{...t,distribution:t.distribution});if(t.distribution.key===A.GITHUB||t.distribution.key===A.GITEE)return m.jsx(py,{...t,distribution:t.distribution});if(t.distribution.key===A.APT)return m.jsx(uy,{...t,distribution:t.distribution});if(t.distribution.key===A.YUM)return m.jsx(vy,{...t,distribution:t.distribution});if(t.distribution.key===A.CONDA)return m.jsx(dy,{...t,distribution:t.distribution});if(t.distribution.key===A.BREW)return m.jsx(cy,{...t,distribution:t.distribution});if(t.distribution.key===A.VCPKG)return m.jsx(my,{...t,distribution:t.distribution});if(t.distribution.key===A.CONAN)return m.jsx(fy,{...t,distribution:t.distribution});if(t.distribution.key===A.NPM)return m.jsx(hy,{...t,distribution:t.distribution});if(t.distribution.key===A.ZYPPER)return m.jsx(yy,{...t,distribution:t.distribution});if(t.distribution.key===A.SNAP)return m.jsx(as,{...t,distribution:t.distribution});const n=t.distribution;throw new Error(`${n}`)};function ky(){const{t:e}=M("common",{keyPrefix:"relatedTools"}),{t}=M("translation");return m.jsx(De,{title:t("selectorForm.titles.relatedTools"),testId:"relatedTools",accent:!0,dashed:!0,children:m.jsxs("div",{className:"st-related-tools-links",children:[m.jsx(we,{href:"https://github.com/openvinotoolkit/openvino_notebooks",testId:"notebooks-link",children:e("OpenVINONotebooks")}),m.jsx(we,{href:"https://huggingface.co/docs/optimum/main/intel/openvino/inference",testId:"hf_optimum-link",children:"Hugging Face + Optimum Intel"}),m.jsx("div",{children:m.jsxs(z,{t:e,i18nKey:"tokenizers",children:[m.jsx(we,{href:"https://docs.openvino.ai/2024/openvino-workflow-generative/ov-tokenizers.html",testId:"openvino_tokenizers-link",children:"OpenVINO Tokenizers"}),"to streamline tokenizer conversion"]})}),m.jsx("div",{children:m.jsxs(z,{t:e,i18nKey:"nncf",children:[m.jsx(we,{href:"https://docs.openvino.ai/2024/openvino-workflow/model-optimization-guide/compressing-models-during-training.html",testId:"nncf-link",children:"NNCF"}),"for implementing compression algorithms on models"]})}),m.jsx("div",{children:m.jsxs(z,{t:e,i18nKey:"ovms",children:[m.jsx(we,{href:"https://docs.openvino.ai/2024/ovms_what_is_openvino_model_server.html",testId:"ovms-link",children:"OVMS"}),"for serving models optimized for deployment"]})})]})})}function Sy({state:e}){const t=e.PACKAGE.selected,n=e.DISTRIBUTION.selected,r=e.VERSION.selected,{t:i}=M("translation",{keyPrefix:"selectorForm.titles"}),{t:o}=M("common",{keyPrefix:"resources"});let s=m.jsx(m.Fragment,{});if(A.GITHUB===n.key||A.GITEE===n.key){const l=n.key===A.GITHUB?t.key===Se.OPENVINO_BASE?o("githubRepository"):o("githubGenAIRepository"):t.key===Se.OPENVINO_BASE?o("giteeRepository"):o("giteeGenAIRepository");s=m.jsxs(m.Fragment,{children:[m.jsx(we,{href:n.data.links.getBuildInstructionsLink(t,r),testId:"install-instructions-link",children:o("installationInstructions")}),m.jsx(we,{href:n.data.links.getRepositoryLink(t,r),testId:"repository-link",children:l})]})}else s=m.jsx(we,{href:n.data.linksSet.installation,testId:"install-instructions-link",children:o("installationInstructions")});return m.jsx(De,{title:i("resources"),testId:"resources",accent:!0,children:m.jsxs("div",{className:"st-resources-links",children:[m.jsxs("div",{children:[s,m.jsx(we,{href:"https://github.com/openvinotoolkit/openvino/releases",testId:"previous-releases-link",children:o("prevReleases")}),m.jsx(we,{href:r.metadata.systemRequirementsLink,testId:"system-requirements-link",children:o("systemRequirements")})]}),m.jsxs("div",{children:[m.jsx(we,{href:r.metadata.getStartedLink,testId:"get-started-link",children:o("getStarted")}),m.jsx(we,{href:r.metadata.troubleshootingLink,testId:"troubleshooting-link",children:o("troubleshooting")})]})]})})}const sn={toggleButton:"spark-button spark-button-size-l spark-focus-visible spark-focus-visible-self spark-focus-visible-snap",toggleButtonGroup:"spark-button-group spark-button-group-orientation-horizontal spark-button-group-align-start spark-button-group-spacing-l",actionButton:"spark-button-action",secondaryButton:"spark-button-secondary",disabledButton:"spark-button-disabled",buttonContent:"spark-button-content",fontXs:"spark-font-25"},xy=({onClick:e,checked:t=!1,disabled:n=!1,title:r,subtitle:i,value:o})=>m.jsx("button",{className:`${sn.toggleButton} ${t?sn.actionButton:sn.secondaryButton} ${n&&sn.disabledButton}`,type:"button",role:"radio","aria-checked":t,onClick:()=>e==null?void 0:e(),"data-cy":o,"aria-label":r,children:m.jsxs("span",{className:sn.buttonContent,children:[m.jsx("span",{className:"title",children:r}),i&&m.jsx("span",{className:`${sn.fontXs} subtitle`,children:i})]})}),Oy=({children:e,className:t})=>m.jsx("div",{className:`option-button-group ${t||""} ${sn.toggleButtonGroup}`,children:e});function ki({title:e,options:t,level:n}){const r=F.useContext(zd),i=t.map(({level:o,key:s,checked:l,metadata:a})=>m.jsx(xy,{value:`${o}_${s}`,checked:l,title:a.title,subtitle:a.subtitle,onClick:()=>r(o,s)},s));return m.jsx(De,{title:e,testId:n,children:m.jsx(Oy,{children:i})})}function Py({state:e}){const t=e.PACKAGE.nodes,n=e.VERSION.nodes,r=e.OP_SYSTEM.nodes,i=e.DISTRIBUTION.nodes;F.useEffect(()=>He.combinationView(),[e]);const{t:o}=M("translation",{keyPrefix:"selectorForm.titles"});return m.jsxs(m.Fragment,{children:[m.jsx(ki,{title:o("package"),options:t,level:T.PACKAGE}),m.jsx(ki,{title:o("version"),options:n,level:T.VERSION}),m.jsx(ki,{title:o("os"),options:r,level:T.OP_SYSTEM}),m.jsx(ki,{title:o("distribution"),options:i,level:T.DISTRIBUTION})]})}const{SelectorContext:zd,useSelector:Ny}=qv();He.initialize(window.parent);function _y(){const[e,t]=Ny();return m.jsx("div",{className:`st-responsive-container ${Fd?"idz-page":""}`,children:m.jsxs(zd.Provider,{value:t,children:[m.jsx(Py,{state:e}),m.jsx(wy,{state:e}),m.jsx(Sy,{state:e}),m.jsx(ky,{})]})})}ds.createRoot(document.getElementById("root")).render(m.jsx(np.StrictMode,{children:m.jsx(_y,{})})); diff --git a/docs/sphinx_setup/api/nodejs_api/openvino-node/interfaces/Tensor.rst b/docs/sphinx_setup/api/nodejs_api/openvino-node/interfaces/Tensor.rst index 9b0e19b559cdf8..8e51702aa1baca 100644 --- a/docs/sphinx_setup/api/nodejs_api/openvino-node/interfaces/Tensor.rst +++ b/docs/sphinx_setup/api/nodejs_api/openvino-node/interfaces/Tensor.rst @@ -9,6 +9,7 @@ Interface Tensor getData(): SupportedTypedArray; getShape(): number[]; getSize(): number; + isContinuous(): boolean; } @@ -116,3 +117,19 @@ Methods * **Defined in:** `addon.ts:421 `__ + +.. rubric:: isContinuous + +* + + .. code-block:: ts + + isContinuous(): boolean; + + Reports whether the tensor is continuous or not. + + * **Returns:** boolean + + * **Defined in:** + `addon.ts:425 `__ + \ No newline at end of file diff --git a/docs/sphinx_setup/index.rst b/docs/sphinx_setup/index.rst index 94c0332790663a..b4e1039248f3a0 100644 --- a/docs/sphinx_setup/index.rst +++ b/docs/sphinx_setup/index.rst @@ -1,5 +1,5 @@ ============================ -OpenVINO 2024.6 +OpenVINO 2025.0 ============================ .. meta:: @@ -28,7 +28,7 @@ hardware and environments, on-premises and on-device, in the browser or in the c
  • New GenAI API

    Generative AI in only a few lines of code!

    - Check out our guide + Check out our guide
  • OpenVINO models on Hugging Face!

    @@ -194,6 +194,7 @@ Key Features GET STARTED LEARN OPENVINO - OPENVINO WORKFLOW + HOW TO USE - MAIN WORKFLOW + HOW TO USE - GENERATIVE AI WORKFLOW DOCUMENTATION ABOUT OPENVINO \ No newline at end of file diff --git a/samples/cpp/benchmark/sync_benchmark/README.md b/samples/cpp/benchmark/sync_benchmark/README.md index b1eb079216064d..7cbc0f26624fa6 100644 --- a/samples/cpp/benchmark/sync_benchmark/README.md +++ b/samples/cpp/benchmark/sync_benchmark/README.md @@ -1,6 +1,6 @@ # Sync Benchmark C++ Sample -This sample demonstrates how to estimate performance of a model using Synchronous Inference Request API. It makes sense to use synchronous inference only in latency oriented scenarios. Models with static input shapes are supported. Unlike [demos](https://docs.openvino.ai/2024/omz_demos.html) this sample doesn't have other configurable command line arguments. Feel free to modify sample's source code to try out different options. +This sample demonstrates how to estimate performance of a model using Synchronous Inference Request API. It makes sense to use synchronous inference only in latency oriented scenarios. Models with static input shapes are supported. Unlike [demos](https://github.com/openvinotoolkit/open_model_zoo/tree/master/demos) this sample doesn't have other configurable command line arguments. Feel free to modify sample's source code to try out different options. For more detailed information on how this sample works, check the dedicated [article](https://docs.openvino.ai/2024/learn-openvino/openvino-samples/sync-benchmark.html) @@ -8,8 +8,8 @@ For more detailed information on how this sample works, check the dedicated [art | Options | Values | | -------------------------------| -------------------------------------------------------------------------------------------------------------------------| -| Validated Models | [yolo-v3-tf](https://docs.openvino.ai/2024/omz_models_model_yolo_v3_tf.html), | -| | [face-detection-0200](https://docs.openvino.ai/2024/omz_models_model_face_detection_0200.html) | +| Validated Models | [yolo-v3-tf](https://github.com/openvinotoolkit/open_model_zoo/tree/master/models/public/yolo-v3-tf), | +| | [face-detection-0200](https://github.com/openvinotoolkit/open_model_zoo/tree/master/models/intel/face-detection-0200) | | Model Format | OpenVINO™ toolkit Intermediate Representation | | | (\*.xml + \*.bin), ONNX (\*.onnx) | | Supported devices | [All](https://docs.openvino.ai/2024/about-openvino/compatibility-and-support/supported-devices.html) | diff --git a/samples/cpp/benchmark/throughput_benchmark/README.md b/samples/cpp/benchmark/throughput_benchmark/README.md index 43633498321c1e..bf8e7e6c8b6291 100644 --- a/samples/cpp/benchmark/throughput_benchmark/README.md +++ b/samples/cpp/benchmark/throughput_benchmark/README.md @@ -1,6 +1,6 @@ # Throughput Benchmark C++ Sample -This sample demonstrates how to estimate performance of a model using Asynchronous Inference Request API in throughput mode. Unlike [demos](https://docs.openvino.ai/2024/omz_demos.html) this sample doesn't have other configurable command line arguments. Feel free to modify sample's source code to try out different options. +This sample demonstrates how to estimate performance of a model using Asynchronous Inference Request API in throughput mode. Unlike [demos](https://github.com/openvinotoolkit/open_model_zoo/tree/master/demos) this sample doesn't have other configurable command line arguments. Feel free to modify sample's source code to try out different options. The reported results may deviate from what [benchmark_app](https://docs.openvino.ai/2024/learn-openvino/openvino-samples/benchmark-tool.html) reports. One example is model input precision for computer vision tasks. benchmark_app sets ``uint8``, while the sample uses default model precision which is usually ``float32``. @@ -10,8 +10,8 @@ For more detailed information on how this sample works, check the dedicated [art | Options | Values | | ----------------------------| -------------------------------------------------------------------------------------------------------------------------------| -| Validated Models | [yolo-v3-tf](https://docs.openvino.ai/2024/omz_models_model_yolo_v3_tf.html), | -| | [face-detection-](https://docs.openvino.ai/2024/omz_models_model_face_detection_0200.html) | +| Validated Models | [yolo-v3-tf](https://github.com/openvinotoolkit/open_model_zoo/tree/master/models/public/yolo-v3-tf), | +| | [face-detection-](https://github.com/openvinotoolkit/open_model_zoo/tree/master/models/intel/face-detection-0200) | | Model Format | OpenVINO™ toolkit Intermediate Representation | | | (\*.xml + \*.bin), ONNX (\*.onnx) | | Supported devices | [All](https://docs.openvino.ai/2024/about-openvino/compatibility-and-support/supported-devices.html) | diff --git a/samples/cpp/benchmark_app/main.cpp b/samples/cpp/benchmark_app/main.cpp index 2b51b6f1f87251..4050f54f867969 100644 --- a/samples/cpp/benchmark_app/main.cpp +++ b/samples/cpp/benchmark_app/main.cpp @@ -523,9 +523,7 @@ int main(int argc, char* argv[]) { } } auto result = std::find_if(config.begin(), config.end(), [&](const std::pair& item) { - if (device_name.find(item.first) == 0) - return true; - return false; + return device_name.find(item.first) == 0; }); ov::AnyMap device_config = {}; if (result != config.end()) @@ -548,6 +546,11 @@ int main(int argc, char* argv[]) { } bool isDynamicNetwork = false; + auto areNetworkInputsDynamic = [](const benchmark_app::InputsInfo& input_info) { + return std::any_of(input_info.begin(), input_info.end(), [](const auto& info) { + return info.second.partialShape.is_dynamic(); + }); + }; if (FLAGS_load_from_file && !isNetworkCompiled) { if (!FLAGS_mean_values.empty() || !FLAGS_scale_values.empty()) { @@ -722,12 +725,7 @@ int main(int argc, char* argv[]) { model = preproc.build(); // Check if network has dynamic shapes - auto input_info = app_inputs_info[0]; - isDynamicNetwork = std::any_of(input_info.begin(), - input_info.end(), - [](const std::pair& i) { - return i.second.partialShape.is_dynamic(); - }); + isDynamicNetwork = areNetworkInputsDynamic(app_inputs_info.at(0)); topology_name = model->get_friendly_name(); @@ -789,6 +787,7 @@ int main(int argc, char* argv[]) { FLAGS_scale_values, FLAGS_mean_values, compiledModel.inputs()); + isDynamicNetwork = areNetworkInputsDynamic(app_inputs_info.at(0)); batchSize = get_batch_size(app_inputs_info.at(0)); warn_if_no_batch(app_inputs_info.at(0)); diff --git a/samples/cpp/hello_reshape_ssd/README.md b/samples/cpp/hello_reshape_ssd/README.md index bc346e850cf5ba..1359b07fdf27b5 100644 --- a/samples/cpp/hello_reshape_ssd/README.md +++ b/samples/cpp/hello_reshape_ssd/README.md @@ -9,7 +9,7 @@ For more detailed information on how this sample works, check the dedicated [art | Options | Values | | ----------------------------| -----------------------------------------------------------------------------------------------------------------------------------------| -| Validated Models | [person-detection-retail-0013](https://docs.openvino.ai/2024/omz_models_model_person_detection_retail_0013.html) | +| Validated Models | [person-detection-retail-0013](https://github.com/openvinotoolkit/open_model_zoo/tree/master/models/intel/person-detection-retail-0013) | | Model Format | OpenVINO™ toolkit Intermediate Representation (\*.xml + \*.bin), ONNX (\*.onnx) | | Supported devices | [All](https://docs.openvino.ai/2024/about-openvino/compatibility-and-support/supported-devices.html) | | Other language realization | [Python](https://docs.openvino.ai/2024/learn-openvino/openvino-samples/hello-reshape-ssd.html) | diff --git a/samples/js/node/notebooks/hello-detection.nnb b/samples/js/node/notebooks/hello-detection.nnb index 60640b3bd042ea..e5c6f43f92a550 100644 --- a/samples/js/node/notebooks/hello-detection.nnb +++ b/samples/js/node/notebooks/hello-detection.nnb @@ -3,7 +3,7 @@ { "language": "markdown", "source": [ - "# Hello Object Detection\n\nA very basic introduction to using object detection models with OpenVINO™.\n\nThe [horizontal-text-detection-0001](https://docs.openvino.ai/2023.0/omz_models_model_horizontal_text_detection_0001.html) model from [Open Model Zoo](https://github.com/openvinotoolkit/open_model_zoo/) is used. It detects horizontal text in images and returns a blob of data in the shape of `[100, 5]`. Each detected text box is stored in the `[x_min, y_min, x_max, y_max, conf]` format, where the\n`(x_min, y_min)` are the coordinates of the top left bounding box corner, `(x_max, y_max)` are the coordinates of the bottom right bounding box corner and `conf` is the confidence for the predicted class." + "# Hello Object Detection\n\nA very basic introduction to using object detection models with OpenVINO™.\n\nThe [horizontal-text-detection-0001](https://github.com/openvinotoolkit/open_model_zoo/tree/master/models/intel/horizontal-text-detection-0001) model from [Open Model Zoo](https://github.com/openvinotoolkit/open_model_zoo/) is used. It detects horizontal text in images and returns a blob of data in the shape of `[100, 5]`. Each detected text box is stored in the `[x_min, y_min, x_max, y_max, conf]` format, where the\n`(x_min, y_min)` are the coordinates of the top left bounding box corner, `(x_max, y_max)` are the coordinates of the bottom right bounding box corner and `conf` is the confidence for the predicted class." ], "outputs": [] }, diff --git a/samples/js/node/notebooks/hello-segmentation.nnb b/samples/js/node/notebooks/hello-segmentation.nnb index a7da34a2799edf..31873f1e1528df 100644 --- a/samples/js/node/notebooks/hello-segmentation.nnb +++ b/samples/js/node/notebooks/hello-segmentation.nnb @@ -3,7 +3,7 @@ { "language": "markdown", "source": [ - "# Hello Image Segmentation\n\nA very basic introduction to using segmentation models with OpenVINO™.\nIn this tutorial, a pre-trained [road-segmentation-adas-0001](https://docs.openvino.ai/2023.0/omz_models_model_road_segmentation_adas_0001.html) model from the [Open Model Zoo](https://github.com/openvinotoolkit/open_model_zoo/) is used. ADAS stands for Advanced Driver Assistance Services. The model recognizes four classes: background, road, curb and mark.\n" + "# Hello Image Segmentation\n\nA very basic introduction to using segmentation models with OpenVINO™.\nIn this tutorial, a pre-trained [road-segmentation-adas-0001](https://github.com/openvinotoolkit/open_model_zoo/tree/master/models/intel/road-segmentation-adas-0001) model from the [Open Model Zoo](https://github.com/openvinotoolkit/open_model_zoo/) is used. ADAS stands for Advanced Driver Assistance Services. The model recognizes four classes: background, road, curb and mark.\n" ], "outputs": [] }, diff --git a/samples/js/node/notebooks/hello-world.nnb b/samples/js/node/notebooks/hello-world.nnb index 83d4ca8bec29f5..4da8eb3b4b334c 100644 --- a/samples/js/node/notebooks/hello-world.nnb +++ b/samples/js/node/notebooks/hello-world.nnb @@ -3,7 +3,7 @@ { "language": "markdown", "source": [ - "# Hello Image Classification\n\nThis basic introduction to OpenVINO™ shows how to do inference with an image classification model.\n\n A pre-trained [MobileNetV3 model](https://docs.openvino.ai/2023.0/omz_models_model_mobilenet_v3_small_1_0_224_tf.html) from [Open Model Zoo](https://github.com/openvinotoolkit/open_model_zoo/) is used in this tutorial. For more information about how OpenVINO IR models are created, refer to the [TensorFlow to OpenVINO](../tensorflow-to-openvino/tensorflow-to-openvino.ipynb) tutorial.\n " + "# Hello Image Classification\n\nThis basic introduction to OpenVINO™ shows how to do inference with an image classification model.\n\n A pre-trained [MobileNetV3 model](https://github.com/openvinotoolkit/open_model_zoo/tree/master/models/public/mobilenet-v3-small-1.0-224-tf) from [Open Model Zoo](https://github.com/openvinotoolkit/open_model_zoo/) is used in this tutorial. For more information about how OpenVINO IR models are created, refer to the [TensorFlow to OpenVINO](../tensorflow-to-openvino/tensorflow-to-openvino.ipynb) tutorial.\n " ], "outputs": [] }, diff --git a/samples/python/benchmark/bert_benchmark/README.md b/samples/python/benchmark/bert_benchmark/README.md index 84ddcba1e598a4..2894c5f33d633b 100644 --- a/samples/python/benchmark/bert_benchmark/README.md +++ b/samples/python/benchmark/bert_benchmark/README.md @@ -1,6 +1,6 @@ # Bert Benchmark Python Sample -This sample demonstrates how to estimate performance of a Bert model using Asynchronous Inference Request API. Unlike [demos](https://docs.openvino.ai/2024/omz_demos.html) this sample doesn't have configurable command line arguments. Feel free to modify sample's source code to try out different options. +This sample demonstrates how to estimate performance of a Bert model using Asynchronous Inference Request API. Unlike [demos](https://github.com/openvinotoolkit/open_model_zoo/tree/master/demos) this sample doesn't have configurable command line arguments. Feel free to modify sample's source code to try out different options. For more detailed information on how this sample works, check the dedicated [article](https://docs.openvino.ai/2024/learn-openvino/openvino-samples/bert-benchmark.html) diff --git a/samples/python/benchmark/sync_benchmark/README.md b/samples/python/benchmark/sync_benchmark/README.md index 4ce1329277b5b8..c7604386625572 100644 --- a/samples/python/benchmark/sync_benchmark/README.md +++ b/samples/python/benchmark/sync_benchmark/README.md @@ -1,19 +1,19 @@ # Sync Benchmark Python Sample -This sample demonstrates how to estimate performance of a model using Synchronous Inference Request API. It makes sense to use synchronous inference only in latency oriented scenarios. Models with static input shapes are supported. Unlike [demos](https://docs.openvino.ai/2024/omz_demos.html) this sample doesn't have other configurable command line arguments. Feel free to modify sample's source code to try out different options. +This sample demonstrates how to estimate performance of a model using Synchronous Inference Request API. It makes sense to use synchronous inference only in latency oriented scenarios. Models with static input shapes are supported. Unlike [demos](https://github.com/openvinotoolkit/open_model_zoo/tree/master/demos) this sample doesn't have other configurable command line arguments. Feel free to modify sample's source code to try out different options. For more detailed information on how this sample works, check the dedicated [article](https://docs.openvino.ai/2024/learn-openvino/openvino-samples/sync-benchmark.html) ## Requirements -| Options | Values | -| ----------------------------| -----------------------------------------------------------------------------------------------------| -| Validated Models | [yolo-v3-tf](https://docs.openvino.ai/2024/omz_models_model_yolo_v3_tf.html), | -| | [face-detection-0200](https://docs.openvino.ai/2024/omz_models_model_face_detection_0200.html) | -| Model Format | OpenVINO™ toolkit Intermediate Representation | -| | (\*.xml + \*.bin), ONNX (\*.onnx) | -| Supported devices | [All](https://docs.openvino.ai/2024/about-openvino/compatibility-and-support/supported-devices.html) | -| Other language realization | [C++](https://docs.openvino.ai/2024/learn-openvino/openvino-samples/sync-benchmark.html) | +| Options | Values | +| ----------------------------| ----------------------------------------------------------------------------------------------------------------------| +| Validated Models | [yolo-v3-tf](https://github.com/openvinotoolkit/open_model_zoo/tree/master/models/public/yolo-v3-tf), | +| | [face-detection-0200](https://github.com/openvinotoolkit/open_model_zoo/tree/master/models/intel/face-detection-0200) | +| Model Format | OpenVINO™ toolkit Intermediate Representation | +| | (\*.xml + \*.bin), ONNX (\*.onnx) | +| Supported devices | [All](https://docs.openvino.ai/2024/about-openvino/compatibility-and-support/supported-devices.html) | +| Other language realization | [C++](https://docs.openvino.ai/2024/learn-openvino/openvino-samples/sync-benchmark.html) | The following Python API is used in the application: diff --git a/samples/python/benchmark/throughput_benchmark/README.md b/samples/python/benchmark/throughput_benchmark/README.md index 1ff02319ade062..5214c1190bb5e9 100644 --- a/samples/python/benchmark/throughput_benchmark/README.md +++ b/samples/python/benchmark/throughput_benchmark/README.md @@ -1,6 +1,6 @@ # Throughput Benchmark Python Sample -This sample demonstrates how to estimate performance of a model using Asynchronous Inference Request API in throughput mode. Unlike [demos](https://docs.openvino.ai/2024/omz_demos.html) this sample doesn't have other configurable command line arguments. Feel free to modify sample's source code to try out different options. +This sample demonstrates how to estimate performance of a model using Asynchronous Inference Request API in throughput mode. Unlike [demos](https://github.com/openvinotoolkit/open_model_zoo/tree/master/demos) this sample doesn't have other configurable command line arguments. Feel free to modify sample's source code to try out different options. The reported results may deviate from what [benchmark_app](https://docs.openvino.ai/2024/learn-openvino/openvino-samples/benchmark-tool.html) reports. One example is model input precision for computer vision tasks. benchmark_app sets uint8, while the sample uses default model precision which is usually float32. @@ -8,14 +8,14 @@ For more detailed information on how this sample works, check the dedicated [art ## Requirements -| Options | Values | -| -------------------------------| -----------------------------------------------------------------------------------------------------| -| Validated Models | [yolo-v3-tf](https://docs.openvino.ai/2024/omz_models_model_yolo_v3_tf.html) | -| | [face-detection-0200](https://docs.openvino.ai/2024/omz_models_model_face_detection_0200.html) | -| Model Format | OpenVINO™ toolkit Intermediate Representation | -| | (\*.xml + \*.bin), ONNX (\*.onnx) | -| Supported devices | [All](https://docs.openvino.ai/2024/about-openvino/compatibility-and-support/supported-devices.html) | -| Other language realization | [C++](https://docs.openvino.ai/2024/learn-openvino/openvino-samples/sync-benchmark.html) | +| Options | Values | +| -------------------------------| -----------------------------------------------------------------------------------------------------------------------| +| Validated Models | [yolo-v3-tf](https://github.com/openvinotoolkit/open_model_zoo/tree/master/models/public/yolo-v3-tf) | +| | [face-detection-0200](https://github.com/openvinotoolkit/open_model_zoo/tree/master/models/intel/face-detection-0200) | +| Model Format | OpenVINO™ toolkit Intermediate Representation | +| | (\*.xml + \*.bin), ONNX (\*.onnx) | +| Supported devices | [All](https://docs.openvino.ai/2024/about-openvino/compatibility-and-support/supported-devices.html) | +| Other language realization | [C++](https://docs.openvino.ai/2024/learn-openvino/openvino-samples/sync-benchmark.html) | The following Python API is used in the application: diff --git a/src/bindings/c/include/openvino/c/ov_remote_context.h b/src/bindings/c/include/openvino/c/ov_remote_context.h index 07ce1cfbe1fd73..b3dbb57f62a886 100644 --- a/src/bindings/c/include/openvino/c/ov_remote_context.h +++ b/src/bindings/c/include/openvino/c/ov_remote_context.h @@ -1,4 +1,4 @@ -// Copyright (C) 2018-2022 Intel Corporation +// Copyright (C) 2018-2025 Intel Corporation // SPDX-License-Identifier: Apache-2.0 // diff --git a/src/bindings/c/src/ov_remote_context.cpp b/src/bindings/c/src/ov_remote_context.cpp index f1b9d7cbd6aacf..069802346d9cf9 100644 --- a/src/bindings/c/src/ov_remote_context.cpp +++ b/src/bindings/c/src/ov_remote_context.cpp @@ -1,4 +1,4 @@ -// Copyright (C) 2018-2022 Intel Corporation +// Copyright (C) 2018-2025 Intel Corporation // SPDX-License-Identifier: Apache-2.0 // #include "openvino/c/ov_remote_context.h" diff --git a/src/bindings/c/tests/ov_remote_context_test.cpp b/src/bindings/c/tests/ov_remote_context_test.cpp index d0d278acef94aa..4f13fe3fcebb6c 100644 --- a/src/bindings/c/tests/ov_remote_context_test.cpp +++ b/src/bindings/c/tests/ov_remote_context_test.cpp @@ -1,4 +1,4 @@ -// Copyright (C) 2018-2022 Intel Corporation +// Copyright (C) 2018-2025 Intel Corporation // SPDX-License-Identifier: Apache-2.0 // diff --git a/src/bindings/python/src/openvino/frontend/pytorch/ts_decoder.py b/src/bindings/python/src/openvino/frontend/pytorch/ts_decoder.py index 13b79b1cb5afc0..a9aec8f8aa98c9 100644 --- a/src/bindings/python/src/openvino/frontend/pytorch/ts_decoder.py +++ b/src/bindings/python/src/openvino/frontend/pytorch/ts_decoder.py @@ -449,6 +449,9 @@ def as_constant(self): return ivalue_to_constant(pt_value.toIValue(), shared_memory=self._shared_memory) if isinstance(pt_type, torch.ListType): return self._as_constant_list(pt_value) + if isinstance(pt_type, torch._C.Type) and pt_type.annotation_str == "Generator": + gen = pt_value.toIValue() + return ivalue_to_constant(gen.initial_seed(), shared_memory=self._shared_memory) const = ivalue_to_constant( pt_value.toIValue(), shared_memory=self._shared_memory) if len(const) > 0: diff --git a/src/bindings/python/src/pyopenvino/graph/op_extension.cpp b/src/bindings/python/src/pyopenvino/graph/op_extension.cpp index 9922493efdf28d..70834f313264db 100644 --- a/src/bindings/python/src/pyopenvino/graph/op_extension.cpp +++ b/src/bindings/python/src/pyopenvino/graph/op_extension.cpp @@ -1,4 +1,4 @@ -// Copyright (C) 2018-2024 Intel Corporation +// Copyright (C) 2018-2025 Intel Corporation // SPDX-License-Identifier: Apache-2.0 // diff --git a/src/bindings/python/src/pyopenvino/graph/op_extension.hpp b/src/bindings/python/src/pyopenvino/graph/op_extension.hpp index 1f5f0e42d0c702..5fd0117218bb6c 100644 --- a/src/bindings/python/src/pyopenvino/graph/op_extension.hpp +++ b/src/bindings/python/src/pyopenvino/graph/op_extension.hpp @@ -1,4 +1,4 @@ -// Copyright (C) 2018-2024 Intel Corporation +// Copyright (C) 2018-2025 Intel Corporation // SPDX-License-Identifier: Apache-2.0 // diff --git a/src/bindings/python/wheel/CMakeLists.txt b/src/bindings/python/wheel/CMakeLists.txt index 3f42940627d730..e598487753d0d8 100644 --- a/src/bindings/python/wheel/CMakeLists.txt +++ b/src/bindings/python/wheel/CMakeLists.txt @@ -132,23 +132,27 @@ add_custom_command(OUTPUT ${openvino_wheel_path} WORKING_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}" COMMENT "Building Python wheel ${openvino_wheel_name}" VERBATIM) +set(ie_wheel_deps ${openvino_wheel_path}) + +if(NOT CMAKE_HOST_WIN32) + set(fdupes_report ${CMAKE_CURRENT_BINARY_DIR}/fdupes_report.txt) + add_custom_command(OUTPUT "${fdupes_report}" + COMMAND ${CMAKE_COMMAND} + -D Python3_EXECUTABLE=${Python3_EXECUTABLE} + -D WORKING_DIRECTORY=${CMAKE_CURRENT_BINARY_DIR} + -D WHEEL_VERSION=${WHEEL_VERSION} + -D PACKAGE_FILE=${openvino_wheel_path} + -D REPORT_FILE=${fdupes_report} + -D CMAKE_SHARED_LIBRARY_SUFFIX=${CMAKE_SHARED_LIBRARY_SUFFIX} + -P "${CMAKE_CURRENT_SOURCE_DIR}/fdupes_check.cmake" + DEPENDS "${openvino_wheel_path}" + WORKING_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}" + COMMENT "Run 'fdupes' checks for wheel ${openvino_wheel_name}" + VERBATIM) + list(APPEND ie_wheel_deps ${fdupes_report}) +endif() -set(fdupes_report ${CMAKE_CURRENT_BINARY_DIR}/fdupes_report.txt) -add_custom_command(OUTPUT "${fdupes_report}" - COMMAND ${CMAKE_COMMAND} - -D Python3_EXECUTABLE=${Python3_EXECUTABLE} - -D WORKING_DIRECTORY=${CMAKE_CURRENT_BINARY_DIR} - -D WHEEL_VERSION=${WHEEL_VERSION} - -D PACKAGE_FILE=${openvino_wheel_path} - -D REPORT_FILE=${fdupes_report} - -D CMAKE_SHARED_LIBRARY_SUFFIX=${CMAKE_SHARED_LIBRARY_SUFFIX} - -P "${CMAKE_CURRENT_SOURCE_DIR}/fdupes_check.cmake" - DEPENDS "${openvino_wheel_path}" - WORKING_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}" - COMMENT "Run 'fdupes' checks for wheel ${openvino_wheel_name}" - VERBATIM) - -add_custom_target(ie_wheel ALL DEPENDS ${openvino_wheel_path} ${fdupes_report}) +add_custom_target(ie_wheel ALL DEPENDS ${ie_wheel_deps}) add_custom_command( TARGET ie_wheel diff --git a/src/bindings/python/wheel/fdupes_check.cmake b/src/bindings/python/wheel/fdupes_check.cmake index 9f2a7860b3b769..d7cbec3343d8b4 100644 --- a/src/bindings/python/wheel/fdupes_check.cmake +++ b/src/bindings/python/wheel/fdupes_check.cmake @@ -12,7 +12,13 @@ endforeach() find_program(fdupes_PROGRAM NAMES fdupes DOC "Path to fdupes") if(NOT fdupes_PROGRAM) - message(WARNING "Failed to find 'fdupes' tool, use 'sudo apt-get install fdupes' to install it") + set(fdupes_install_msg "refer to your platform's package manager or install it manually.") + if(CMAKE_HOST_LINUX) + set(fdupes_install_msg "sudo apt-get install fdupes") + elseif(CMAKE_HOST_APPLE) + set(fdupes_install_msg "brew install fdupes") + endif() + message(WARNING "Failed to find 'fdupes' tool. Install it using: ${fdupes_install_msg}") return() endif() diff --git a/src/bindings/python/wheel/setup.py b/src/bindings/python/wheel/setup.py index 50f0066313d4cd..620ce30f33dbca 100644 --- a/src/bindings/python/wheel/setup.py +++ b/src/bindings/python/wheel/setup.py @@ -66,9 +66,9 @@ "rpath": LIBS_RPATH, "binary_dir": OPENVINO_BINARY_DIR, }, - "ie_libs_с": { + "ie_libs_c": { "name": "core_c", - "prefix": f"{BUILD_BASE}/libs.core_с", + "prefix": f"{BUILD_BASE}/libs.core_c", "install_dir": OV_RUNTIME_LIBS_DIR, "rpath": LIBS_RPATH, "binary_dir": OPENVINO_BINARY_DIR, diff --git a/src/common/low_precision_transformations/include/low_precision/add.hpp b/src/common/low_precision_transformations/include/low_precision/add.hpp index 2c97087696d2f7..55efbf940e94b7 100644 --- a/src/common/low_precision_transformations/include/low_precision/add.hpp +++ b/src/common/low_precision_transformations/include/low_precision/add.hpp @@ -24,8 +24,8 @@ class LP_TRANSFORMATIONS_API AddTransformation : public EltwiseBaseTransformatio public: OPENVINO_RTTI("AddTransformation", "0", EltwiseBaseTransformation); AddTransformation(const Params& params = Params()); - bool transform(TransformationContext& context, ov::pass::pattern::Matcher &m) override; - bool canBeTransformed(const TransformationContext& context, std::shared_ptr layer) const override; + bool transform(ov::pass::pattern::Matcher &m) override; + bool canBeTransformed(const std::shared_ptr& layer) const override; }; } // namespace low_precision diff --git a/src/common/low_precision_transformations/include/low_precision/assign_and_read_value.hpp b/src/common/low_precision_transformations/include/low_precision/assign_and_read_value.hpp index edef4d63aa134a..9134293d5512dd 100644 --- a/src/common/low_precision_transformations/include/low_precision/assign_and_read_value.hpp +++ b/src/common/low_precision_transformations/include/low_precision/assign_and_read_value.hpp @@ -15,8 +15,8 @@ class LP_TRANSFORMATIONS_API AssignAndReadValueTransformation : public LayerTran public: OPENVINO_RTTI("AssignAndReadValueTransformation", "0", LayerTransformation); AssignAndReadValueTransformation(const std::shared_ptr model, const Params& params = Params()); - bool transform(TransformationContext& context, ov::pass::pattern::Matcher& m) override; - bool canBeTransformed(const TransformationContext& context, std::shared_ptr op) const override; + bool transform(ov::pass::pattern::Matcher& m) override; + bool canBeTransformed(const std::shared_ptr& op) const override; bool isPrecisionPreserved(std::shared_ptr layer) const noexcept override; private: std::shared_ptr model; diff --git a/src/common/low_precision_transformations/include/low_precision/avg_pool.hpp b/src/common/low_precision_transformations/include/low_precision/avg_pool.hpp index ac8b91aeb57504..7dfac41beffb06 100644 --- a/src/common/low_precision_transformations/include/low_precision/avg_pool.hpp +++ b/src/common/low_precision_transformations/include/low_precision/avg_pool.hpp @@ -23,9 +23,9 @@ class LP_TRANSFORMATIONS_API AvgPoolTransformation : public LayerTransformation public: OPENVINO_RTTI("AvgPoolTransformation", "0", LayerTransformation); AvgPoolTransformation(const Params& params = Params()); - bool transform(TransformationContext& context, ov::pass::pattern::Matcher &m) override; + bool transform(ov::pass::pattern::Matcher &m) override; bool isPrecisionPreserved(std::shared_ptr layer) const override; - bool canBeTransformed(const TransformationContext& context, std::shared_ptr layer) const override; + bool canBeTransformed(const std::shared_ptr& layer) const override; }; } // namespace low_precision diff --git a/src/common/low_precision_transformations/include/low_precision/batch_to_space.hpp b/src/common/low_precision_transformations/include/low_precision/batch_to_space.hpp index 7859a29ec3a046..b729eb1fc956d3 100644 --- a/src/common/low_precision_transformations/include/low_precision/batch_to_space.hpp +++ b/src/common/low_precision_transformations/include/low_precision/batch_to_space.hpp @@ -24,8 +24,8 @@ class LP_TRANSFORMATIONS_API BatchToSpaceTransformation : public LayerTransforma public: OPENVINO_RTTI("BatchToSpaceTransformation", "0", LayerTransformation); BatchToSpaceTransformation(const Params& params = Params()); - bool canBeTransformed(const TransformationContext& context, std::shared_ptr op) const override; - bool transform(TransformationContext& context, ov::pass::pattern::Matcher &m) override; + bool canBeTransformed(const std::shared_ptr& op) const override; + bool transform(ov::pass::pattern::Matcher &m) override; bool isPrecisionPreserved(std::shared_ptr layer) const noexcept override; }; diff --git a/src/common/low_precision_transformations/include/low_precision/broadcast.hpp b/src/common/low_precision_transformations/include/low_precision/broadcast.hpp index 05f7cadb88e888..75096e322a6571 100644 --- a/src/common/low_precision_transformations/include/low_precision/broadcast.hpp +++ b/src/common/low_precision_transformations/include/low_precision/broadcast.hpp @@ -22,7 +22,7 @@ class LP_TRANSFORMATIONS_API BroadcastTransformation : public TransparentBaseTra public: OPENVINO_RTTI("BroadcastTransformation", "0", TransparentBaseTransformation); BroadcastTransformation(const Params& params = Params()); - bool canBeTransformed(const TransformationContext& context, std::shared_ptr layer) const override; + bool canBeTransformed(const std::shared_ptr& layer) const override; }; } // namespace low_precision diff --git a/src/common/low_precision_transformations/include/low_precision/clamp.hpp b/src/common/low_precision_transformations/include/low_precision/clamp.hpp index d79a6ad159e21b..c41d80939bca8f 100644 --- a/src/common/low_precision_transformations/include/low_precision/clamp.hpp +++ b/src/common/low_precision_transformations/include/low_precision/clamp.hpp @@ -24,8 +24,8 @@ class LP_TRANSFORMATIONS_API ClampTransformation : public LayerTransformation { public: OPENVINO_RTTI("ClampTransformation", "0", LayerTransformation); ClampTransformation(const Params& params = Params()); - bool transform(TransformationContext& context, ov::pass::pattern::Matcher& m) override; - bool canBeTransformed(const TransformationContext& context, std::shared_ptr op) const override; + bool transform(ov::pass::pattern::Matcher& m) override; + bool canBeTransformed(const std::shared_ptr& op) const override; bool isPrecisionPreserved(std::shared_ptr layer) const noexcept override; }; diff --git a/src/common/low_precision_transformations/include/low_precision/cleanup_transformation.hpp b/src/common/low_precision_transformations/include/low_precision/cleanup_transformation.hpp index 503c519ea60f22..dd321c3a922557 100644 --- a/src/common/low_precision_transformations/include/low_precision/cleanup_transformation.hpp +++ b/src/common/low_precision_transformations/include/low_precision/cleanup_transformation.hpp @@ -17,9 +17,8 @@ namespace low_precision { class LP_TRANSFORMATIONS_API CleanupTransformation : public LayerTransformation { public: CleanupTransformation(const Params& params); - virtual ~CleanupTransformation() = default; - bool canBeTransformed(const TransformationContext& context, std::shared_ptr layer) const override; + bool canBeTransformed(const std::shared_ptr& layer) const override; static bool canBeTransformedStatic( const std::shared_ptr& layer, const std::vector& defaultPrecisions = precision_set::get_int8_support()); diff --git a/src/common/low_precision_transformations/include/low_precision/common/fake_quantize_dequantization.hpp b/src/common/low_precision_transformations/include/low_precision/common/fake_quantize_dequantization.hpp index 1035e88ed1d0f0..0d16dbba891b61 100644 --- a/src/common/low_precision_transformations/include/low_precision/common/fake_quantize_dequantization.hpp +++ b/src/common/low_precision_transformations/include/low_precision/common/fake_quantize_dequantization.hpp @@ -50,7 +50,8 @@ class LP_TRANSFORMATIONS_API FakeQuantizeDequantization { const std::shared_ptr& elementwise, std::shared_ptr& constant); - size_t channelDimIndex; + // for most node with layout NC, NCHW, NCDWH, index of channel dimension is 1 + size_t channelDimIndex = 1ul; Output data; std::shared_ptr convert; std::shared_ptr subtract; diff --git a/src/common/low_precision_transformations/include/low_precision/concat.hpp b/src/common/low_precision_transformations/include/low_precision/concat.hpp index c082e30dfa1ecd..a4511ef0f7c099 100644 --- a/src/common/low_precision_transformations/include/low_precision/concat.hpp +++ b/src/common/low_precision_transformations/include/low_precision/concat.hpp @@ -31,9 +31,9 @@ class LP_TRANSFORMATIONS_API ConcatTransformation : public LayerTransformation { public: OPENVINO_RTTI("ConcatTransformation", "0", LayerTransformation); ConcatTransformation(const Params& params = Params()); - bool transform(TransformationContext& context, ov::pass::pattern::Matcher &m) override; + bool transform(ov::pass::pattern::Matcher &m) override; bool isPrecisionPreserved(std::shared_ptr layer) const noexcept override; - bool canBeTransformed(const TransformationContext& context, std::shared_ptr layer) const override; + bool canBeTransformed(const std::shared_ptr& layer) const override; static bool isQuantizedStatic(const std::shared_ptr& layer); }; diff --git a/src/common/low_precision_transformations/include/low_precision/convert.hpp b/src/common/low_precision_transformations/include/low_precision/convert.hpp index 7cbd79be03bb2b..edfb58076c9d20 100644 --- a/src/common/low_precision_transformations/include/low_precision/convert.hpp +++ b/src/common/low_precision_transformations/include/low_precision/convert.hpp @@ -15,7 +15,7 @@ class LP_TRANSFORMATIONS_API ConvertTransformation : public LayerTransformation public: OPENVINO_RTTI("ConvertTransformation", "0", LayerTransformation); ConvertTransformation(const Params& params = Params()); - bool transform(TransformationContext& context, ov::pass::pattern::Matcher &m) override; + bool transform(ov::pass::pattern::Matcher &m) override; bool isPrecisionPreserved(std::shared_ptr layer) const noexcept override; }; diff --git a/src/common/low_precision_transformations/include/low_precision/convolution.hpp b/src/common/low_precision_transformations/include/low_precision/convolution.hpp index 428a8adf00ca17..74a61817c15b18 100644 --- a/src/common/low_precision_transformations/include/low_precision/convolution.hpp +++ b/src/common/low_precision_transformations/include/low_precision/convolution.hpp @@ -22,7 +22,7 @@ class LP_TRANSFORMATIONS_API ConvolutionTransformation : public WeightableLayerT public: OPENVINO_RTTI("ConvolutionTransformation", "0", WeightableLayerTransformation); ConvolutionTransformation(const Params& params = Params()); - bool transform(TransformationContext& context, ov::pass::pattern::Matcher &m) override; + bool transform(ov::pass::pattern::Matcher &m) override; bool isQuantized(const std::shared_ptr& layer, const std::vector&defaultPrecisions) const override; static bool isQuantizedStatic(const std::shared_ptr& layer, diff --git a/src/common/low_precision_transformations/include/low_precision/convolution_backprop_data.hpp b/src/common/low_precision_transformations/include/low_precision/convolution_backprop_data.hpp index 6221a75aca5fb2..9b1e2580e59193 100644 --- a/src/common/low_precision_transformations/include/low_precision/convolution_backprop_data.hpp +++ b/src/common/low_precision_transformations/include/low_precision/convolution_backprop_data.hpp @@ -21,8 +21,8 @@ namespace low_precision { class LP_TRANSFORMATIONS_API ConvolutionBackpropDataTransformation : public WeightableLayerTransformation { public: ConvolutionBackpropDataTransformation(const Params& params = Params()); - bool transform(TransformationContext& context, ov::pass::pattern::Matcher &m) override; - bool canBeTransformed(const TransformationContext& context, std::shared_ptr op) const override; + bool transform(ov::pass::pattern::Matcher &m) override; + bool canBeTransformed(const std::shared_ptr& op) const override; bool isQuantized(const std::shared_ptr& layer, const std::vector&defaultPrecisions) const override; static bool isQuantizedStatic(const std::shared_ptr& layer, diff --git a/src/common/low_precision_transformations/include/low_precision/depth_to_space.hpp b/src/common/low_precision_transformations/include/low_precision/depth_to_space.hpp index e86a2de2941b3c..1ace395ac8331d 100644 --- a/src/common/low_precision_transformations/include/low_precision/depth_to_space.hpp +++ b/src/common/low_precision_transformations/include/low_precision/depth_to_space.hpp @@ -22,7 +22,7 @@ class LP_TRANSFORMATIONS_API DepthToSpaceTransformation : public TransparentBase public: OPENVINO_RTTI("DepthToSpaceTransformation", "0", TransparentBaseTransformation); DepthToSpaceTransformation(const Params& params = Params()); - bool canBeTransformed(const TransformationContext& context, std::shared_ptr layer) const override; + bool canBeTransformed(const std::shared_ptr& layer) const override; }; } // namespace low_precision diff --git a/src/common/low_precision_transformations/include/low_precision/eliminate_fake_quantize.hpp b/src/common/low_precision_transformations/include/low_precision/eliminate_fake_quantize.hpp index bfaa0c3b3a2b1b..190d146a741151 100644 --- a/src/common/low_precision_transformations/include/low_precision/eliminate_fake_quantize.hpp +++ b/src/common/low_precision_transformations/include/low_precision/eliminate_fake_quantize.hpp @@ -24,8 +24,8 @@ class LP_TRANSFORMATIONS_API EliminateFakeQuantizeTransformation : public Cleanu public: OPENVINO_RTTI("EliminateFakeQuantizeTransformation", "0", CleanupTransformation); EliminateFakeQuantizeTransformation(const Params& params = Params()); - bool transform(TransformationContext& context, ov::pass::pattern::Matcher &m) override; - bool canBeTransformed(const TransformationContext& context, std::shared_ptr layer) const override; + bool transform(ov::pass::pattern::Matcher &m) override; + bool canBeTransformed(const std::shared_ptr& layer) const override; bool isPrecisionPreserved(std::shared_ptr layer) const noexcept override; }; diff --git a/src/common/low_precision_transformations/include/low_precision/eltwise_base_transformation.hpp b/src/common/low_precision_transformations/include/low_precision/eltwise_base_transformation.hpp index 5d3361e7283eb9..9c3c5d1c3b2a5d 100644 --- a/src/common/low_precision_transformations/include/low_precision/eltwise_base_transformation.hpp +++ b/src/common/low_precision_transformations/include/low_precision/eltwise_base_transformation.hpp @@ -19,7 +19,7 @@ namespace low_precision { class LP_TRANSFORMATIONS_API EltwiseBaseTransformation : public LayerTransformation { public: EltwiseBaseTransformation(const Params& params) : LayerTransformation(params) {} - bool canBeTransformed(const TransformationContext& context, std::shared_ptr layer) const override; + bool canBeTransformed(const std::shared_ptr& layer) const override; bool isPrecisionPreserved(std::shared_ptr layer) const noexcept override; static bool isBroadcasted(const PartialShape& shape); diff --git a/src/common/low_precision_transformations/include/low_precision/fake_quantize.hpp b/src/common/low_precision_transformations/include/low_precision/fake_quantize.hpp index 640814dc15cabb..8f5c67dbc0bcc4 100644 --- a/src/common/low_precision_transformations/include/low_precision/fake_quantize.hpp +++ b/src/common/low_precision_transformations/include/low_precision/fake_quantize.hpp @@ -23,16 +23,15 @@ class LP_TRANSFORMATIONS_API FakeQuantizeTransformation : public LayerTransforma public: OPENVINO_RTTI("FakeQuantizeTransformation", "0", LayerTransformation); FakeQuantizeTransformation(const Params& params = Params()); - bool transform(TransformationContext& context, ov::pass::pattern::Matcher &m) override; + bool transform(ov::pass::pattern::Matcher &m) override; bool isPrecisionPreserved(std::shared_ptr layer) const noexcept override; static bool checkElementwise(const std::shared_ptr& eltwise); static std::shared_ptr fuseElementwise( - TransformationContext& context, - MatcherPass* matcherPass, - const std::shared_ptr& fakeQuantize, - const bool updatePrecisions); + MatcherPass* matcherPass, + const std::shared_ptr& fakeQuantize, + const bool updatePrecisions); }; } // namespace low_precision diff --git a/src/common/low_precision_transformations/include/low_precision/fake_quantize_decomposition.hpp b/src/common/low_precision_transformations/include/low_precision/fake_quantize_decomposition.hpp index 4d2ee8d88fadaf..8289a9ea5493f7 100644 --- a/src/common/low_precision_transformations/include/low_precision/fake_quantize_decomposition.hpp +++ b/src/common/low_precision_transformations/include/low_precision/fake_quantize_decomposition.hpp @@ -25,7 +25,7 @@ class LP_TRANSFORMATIONS_API FakeQuantizeDecompositionTransformation : public La public: OPENVINO_RTTI("FakeQuantizeDecompositionTransformation", "0", LayerTransformation); FakeQuantizeDecompositionTransformation(const Params& params = Params()); - bool transform(TransformationContext& context, ov::pass::pattern::Matcher &m) override; + bool transform(ov::pass::pattern::Matcher &m) override; bool isPrecisionPreserved(std::shared_ptr layer) const noexcept override; }; diff --git a/src/common/low_precision_transformations/include/low_precision/fold_convert.hpp b/src/common/low_precision_transformations/include/low_precision/fold_convert.hpp index bc5342b5cca4f1..d0d864835c8f98 100644 --- a/src/common/low_precision_transformations/include/low_precision/fold_convert.hpp +++ b/src/common/low_precision_transformations/include/low_precision/fold_convert.hpp @@ -25,8 +25,8 @@ class LP_TRANSFORMATIONS_API FoldConvertTransformation : public CleanupTransform public: OPENVINO_RTTI("FoldConvertTransformation", "0", CleanupTransformation); FoldConvertTransformation(const Params& params = Params()); - bool transform(TransformationContext& context, ov::pass::pattern::Matcher &m) override; - bool canBeTransformed(const TransformationContext& context, std::shared_ptr layer) const override; + bool transform(ov::pass::pattern::Matcher &m) override; + bool canBeTransformed(const std::shared_ptr& layer) const override; bool isPrecisionPreserved(std::shared_ptr layer) const noexcept override; }; diff --git a/src/common/low_precision_transformations/include/low_precision/fold_fake_quantize.hpp b/src/common/low_precision_transformations/include/low_precision/fold_fake_quantize.hpp index c47c39a78ef081..b345ce5edbd80a 100644 --- a/src/common/low_precision_transformations/include/low_precision/fold_fake_quantize.hpp +++ b/src/common/low_precision_transformations/include/low_precision/fold_fake_quantize.hpp @@ -23,8 +23,8 @@ class LP_TRANSFORMATIONS_API FoldFakeQuantizeTransformation : public LayerTransf public: OPENVINO_RTTI("FoldFakeQuantizeTransformation", "0", LayerTransformation); FoldFakeQuantizeTransformation(const Params& params = Params()); - bool transform(TransformationContext& context, ov::pass::pattern::Matcher &m) override; - bool canBeTransformed(const TransformationContext& context, std::shared_ptr layer) const override; + bool transform(ov::pass::pattern::Matcher &m) override; + bool canBeTransformed(const std::shared_ptr& layer) const override; bool isPrecisionPreserved(std::shared_ptr layer) const noexcept override; bool isConstantOutput(std::shared_ptr op) const; }; diff --git a/src/common/low_precision_transformations/include/low_precision/fuse_convert.hpp b/src/common/low_precision_transformations/include/low_precision/fuse_convert.hpp index 0ff0dc60821486..06d252961e2c26 100644 --- a/src/common/low_precision_transformations/include/low_precision/fuse_convert.hpp +++ b/src/common/low_precision_transformations/include/low_precision/fuse_convert.hpp @@ -22,8 +22,8 @@ class LP_TRANSFORMATIONS_API FuseConvertTransformation : public CleanupTransform public: OPENVINO_RTTI("FuseConvertTransformation", "0", CleanupTransformation); FuseConvertTransformation(const Params& params = Params()); - bool transform(TransformationContext& context, ov::pass::pattern::Matcher &m) override; - bool canBeTransformed(const TransformationContext& context, std::shared_ptr layer) const override; + bool transform(ov::pass::pattern::Matcher &m) override; + bool canBeTransformed(const std::shared_ptr& layer) const override; bool isPrecisionPreserved(std::shared_ptr layer) const noexcept override; }; diff --git a/src/common/low_precision_transformations/include/low_precision/fuse_elementwise_to_fake_quantize.hpp b/src/common/low_precision_transformations/include/low_precision/fuse_elementwise_to_fake_quantize.hpp index ab1a589845aa10..a9fed138b41b0d 100644 --- a/src/common/low_precision_transformations/include/low_precision/fuse_elementwise_to_fake_quantize.hpp +++ b/src/common/low_precision_transformations/include/low_precision/fuse_elementwise_to_fake_quantize.hpp @@ -19,9 +19,8 @@ namespace low_precision { class LP_TRANSFORMATIONS_API FuseElementwiseToFakeQuantizeTransformation : public CleanupTransformation { public: FuseElementwiseToFakeQuantizeTransformation(const Params& params); - virtual ~FuseElementwiseToFakeQuantizeTransformation() = default; - bool canBeTransformed(const TransformationContext& context, std::shared_ptr layer) const override; + bool canBeTransformed(const std::shared_ptr& layer) const override; }; } // namespace low_precision diff --git a/src/common/low_precision_transformations/include/low_precision/fuse_multiply_to_fake_quantize.hpp b/src/common/low_precision_transformations/include/low_precision/fuse_multiply_to_fake_quantize.hpp index 67471a56a4a6b8..1933a07bbb881b 100644 --- a/src/common/low_precision_transformations/include/low_precision/fuse_multiply_to_fake_quantize.hpp +++ b/src/common/low_precision_transformations/include/low_precision/fuse_multiply_to_fake_quantize.hpp @@ -24,7 +24,7 @@ class LP_TRANSFORMATIONS_API FuseMultiplyToFakeQuantizeTransformation : public F public: OPENVINO_RTTI("FuseMultiplyToFakeQuantizeTransformation", "0", FuseElementwiseToFakeQuantizeTransformation); FuseMultiplyToFakeQuantizeTransformation(const Params& params = Params()); - bool transform(TransformationContext& context, ov::pass::pattern::Matcher &m) override; + bool transform(ov::pass::pattern::Matcher &m) override; bool isPrecisionPreserved(std::shared_ptr layer) const noexcept override; }; diff --git a/src/common/low_precision_transformations/include/low_precision/fuse_subtract_to_fake_quantize.hpp b/src/common/low_precision_transformations/include/low_precision/fuse_subtract_to_fake_quantize.hpp index c5dd8994e2a512..644aafb740d8ff 100644 --- a/src/common/low_precision_transformations/include/low_precision/fuse_subtract_to_fake_quantize.hpp +++ b/src/common/low_precision_transformations/include/low_precision/fuse_subtract_to_fake_quantize.hpp @@ -24,7 +24,7 @@ class LP_TRANSFORMATIONS_API FuseSubtractToFakeQuantizeTransformation : public F public: OPENVINO_RTTI("FuseSubtractToFakeQuantizeTransformation", "0", FuseElementwiseToFakeQuantizeTransformation); FuseSubtractToFakeQuantizeTransformation(const Params& params = Params()); - bool transform(TransformationContext& context, ov::pass::pattern::Matcher &m) override; + bool transform(ov::pass::pattern::Matcher &m) override; bool isPrecisionPreserved(std::shared_ptr layer) const noexcept override; }; diff --git a/src/common/low_precision_transformations/include/low_precision/gather.hpp b/src/common/low_precision_transformations/include/low_precision/gather.hpp index 6aebd3fb094e0a..73be6a880a80ae 100644 --- a/src/common/low_precision_transformations/include/low_precision/gather.hpp +++ b/src/common/low_precision_transformations/include/low_precision/gather.hpp @@ -1,4 +1,4 @@ -// Copyright (C) 2018-2022 Intel Corporation +// Copyright (C) 2018-2025 Intel Corporation // SPDX-License-Identifier: Apache-2.0 // @@ -15,9 +15,9 @@ class LP_TRANSFORMATIONS_API GatherTransformation : public LayerTransformation { public: OPENVINO_RTTI("GatherTransformation", "0", LayerTransformation); GatherTransformation(const Params& params = Params()); - bool transform(TransformationContext& context, ov::pass::pattern::Matcher &m) override; + bool transform(ov::pass::pattern::Matcher &m) override; bool isPrecisionPreserved(std::shared_ptr layer) const override; - bool canBeTransformed(const TransformationContext& context, std::shared_ptr layer) const override; + bool canBeTransformed(const std::shared_ptr& layer) const override; }; } // namespace low_precision diff --git a/src/common/low_precision_transformations/include/low_precision/group_convolution.hpp b/src/common/low_precision_transformations/include/low_precision/group_convolution.hpp index 6551a929339830..f1e0bb44bddad8 100644 --- a/src/common/low_precision_transformations/include/low_precision/group_convolution.hpp +++ b/src/common/low_precision_transformations/include/low_precision/group_convolution.hpp @@ -23,7 +23,7 @@ class LP_TRANSFORMATIONS_API GroupConvolutionTransformation : public Convolution public: OPENVINO_RTTI("GroupConvolutionTransformation", "0", ConvolutionTransformation); GroupConvolutionTransformation(const Params& params = Params()); - bool transform(TransformationContext& context, ov::pass::pattern::Matcher &m) override; + bool transform(ov::pass::pattern::Matcher &m) override; bool isQuantized(const std::shared_ptr& layer, const std::vector& defaultPrecisions) const override; static bool isQuantizedStatic(const std::shared_ptr& layer, diff --git a/src/common/low_precision_transformations/include/low_precision/interpolate.hpp b/src/common/low_precision_transformations/include/low_precision/interpolate.hpp index 634d422dc2b09b..d715a24cc73e5d 100644 --- a/src/common/low_precision_transformations/include/low_precision/interpolate.hpp +++ b/src/common/low_precision_transformations/include/low_precision/interpolate.hpp @@ -22,9 +22,9 @@ class LP_TRANSFORMATIONS_API InterpolateTransformation : public LayerTransformat public: OPENVINO_RTTI("InterpolateTransformation", "0", LayerTransformation); InterpolateTransformation(const Params& params = Params()); - bool transform(TransformationContext &context, ov::pass::pattern::Matcher &m) override; + bool transform(ov::pass::pattern::Matcher &m) override; bool isPrecisionPreserved(std::shared_ptr layer) const noexcept override; - bool canBeTransformed(const TransformationContext& context, std::shared_ptr layer) const override; + bool canBeTransformed(const std::shared_ptr& layer) const override; }; } // namespace low_precision diff --git a/src/common/low_precision_transformations/include/low_precision/layer_transformation.hpp b/src/common/low_precision_transformations/include/low_precision/layer_transformation.hpp index c675ade19b516b..8b046de904f1e6 100644 --- a/src/common/low_precision_transformations/include/low_precision/layer_transformation.hpp +++ b/src/common/low_precision_transformations/include/low_precision/layer_transformation.hpp @@ -12,27 +12,15 @@ #include #include "openvino/pass/matcher_pass.hpp" -#include "transformation_context.hpp" #include "quantization_details.hpp" #include "low_precision/common/ie_lpt_exception.hpp" #include "common/fake_quantize_dequantization.hpp" /***************************************************** * Debug capability - * - ORIGINAL_MODEL_PATH : Specify with existing folder name - * to serialize original model into it (XML & BIN extensions were added) - * - TRANSFORMED_MODEL_PATH : Specify with existing folder name - * to serialize original model into it (XML & BIN extensions were added) - * - LPT_PRINT_DEQUANTIZATION_INFO : Define it to enable - * dequantization layers printing - * - LPT_DISPLAY_PRECISION : Define it to to display precision info - * during low precision transformations - * + * - LPT_PRINT_DEQUANTIZATION_INFO : Define it to enable dequantization info printing: scales, shifts, etc. *****************************************************/ -// #define LPT_ORIGINAL_MODEL_PATH "/localdisk/orig.model" -// #define LPT_TRANSFORMED_MODEL_PATH "/localdisk/transformed.model" // #define LPT_PRINT_DEQUANTIZATION_INFO -// #define LPT_DISPLAY_PRECISION namespace ov { namespace pass { @@ -300,16 +288,9 @@ class LP_TRANSFORMATIONS_API LayerTransformation : public ov::pass::MatcherPass }; LayerTransformation(const Params& params); - virtual ~LayerTransformation() = default; - virtual bool transform(TransformationContext& context, ov::pass::pattern::Matcher &m) = 0; + virtual bool transform(ov::pass::pattern::Matcher &m) = 0; - void setContext(TransformationContext* context) noexcept; - - void setUpdatePrecisions(const bool updatePrecisions); - - void setDefaultPrecisions(const std::vector& defaultPrecisions); - - virtual bool canBeTransformed(const TransformationContext& context, std::shared_ptr layer) const; + virtual bool canBeTransformed(const std::shared_ptr& layer) const; static bool canBeTransformedStatic(const std::shared_ptr& layer, const std::vector& defaultPrecisions = precision_set::get_int8_support()); @@ -352,59 +333,32 @@ class LP_TRANSFORMATIONS_API LayerTransformation : public ov::pass::MatcherPass const std::vector& dequantizationShifts); #endif - bool updatePrecisions; - element::Type deqPrecision; - std::vector defaultPrecisions; - bool reshapeIgnorePerTensorQuantizationCheck; - bool scalingMode; + const bool updatePrecisions; + const element::Type deqPrecision; + const std::vector defaultPrecisions; + const bool reshapeIgnorePerTensorQuantizationCheck; + const bool scalingMode; static constexpr char originalLayerPostfix[] = "_original"; - TransformationContext* context; protected: std::shared_ptr moveDequantizationAfter( - TransformationContext &context, const std::shared_ptr& operation, const FakeQuantizeDequantization& dequantization, const bool updateOutputPrecision = true, const bool moveSubtract = true) const; std::shared_ptr moveDequantizationBefore( - TransformationContext& context, const std::shared_ptr& operation, const FakeQuantizeDequantization& dequantization, const bool moveSubtract = true) const; - bool updateOutput( - TransformationContext &context, - std::shared_ptr lastNode, - std::shared_ptr originalNode) const; - - void updateOutput( - TransformationContext& context, - std::shared_ptr lastNode, - std::string originalName) const; - - void addPattern(ov::pass::GraphRewrite& pass, TransformationContext& context, std::shared_ptr patternRoot); - - //TODO: replace with canBeTransformed when quantization by special dimension is supported for all transformations - bool canBeTransformedSpatialDimension(const TransformationContext& context, std::shared_ptr layer) const; + bool updateOutput(const std::shared_ptr& lastNode, const std::shared_ptr& originalNode) const; - template - void addSingleNodePattern(ov::pass::GraphRewrite& pass, TransformationContext& context) const { - using namespace ov; - - auto is_op_type = [](std::shared_ptr n) { - return !!as_type_ptr(n); - }; - auto p_node = std::make_shared(element::f32, Shape{}, is_op_type); - - addPattern(pass, context, p_node); - } + // TODO: replace with canBeTransformed when quantization by special dimension is supported for all transformations + bool canBeTransformedSpatialDimension(const std::shared_ptr& layer) const; }; -typedef std::shared_ptr LayerTransformationPtr; - } // namespace low_precision } // namespace pass } // namespace ov diff --git a/src/common/low_precision_transformations/include/low_precision/mat_mul.hpp b/src/common/low_precision_transformations/include/low_precision/mat_mul.hpp index 0b6115e9345b0e..910154fe0e16e0 100644 --- a/src/common/low_precision_transformations/include/low_precision/mat_mul.hpp +++ b/src/common/low_precision_transformations/include/low_precision/mat_mul.hpp @@ -23,9 +23,9 @@ class LP_TRANSFORMATIONS_API MatMulTransformation : public LayerTransformation { public: OPENVINO_RTTI("MatMulTransformation", "0", LayerTransformation); MatMulTransformation(const Params& params = Params()); - bool transform(TransformationContext &context, ov::pass::pattern::Matcher &m) override; + bool transform(ov::pass::pattern::Matcher &m) override; bool isPrecisionPreserved(std::shared_ptr layer) const noexcept override; - bool canBeTransformed(const TransformationContext& context, std::shared_ptr layer) const override; + bool canBeTransformed(const std::shared_ptr& layer) const override; }; } // namespace low_precision diff --git a/src/common/low_precision_transformations/include/low_precision/max_pool.hpp b/src/common/low_precision_transformations/include/low_precision/max_pool.hpp index 7d499c9ec254f3..f6307ed69cbfbe 100644 --- a/src/common/low_precision_transformations/include/low_precision/max_pool.hpp +++ b/src/common/low_precision_transformations/include/low_precision/max_pool.hpp @@ -24,8 +24,8 @@ class LP_TRANSFORMATIONS_API MaxPoolTransformation : public LayerTransformation public: OPENVINO_RTTI("MaxPoolTransformation", "0", LayerTransformation); MaxPoolTransformation(const Params& params = Params()); - bool canBeTransformed(const TransformationContext& context, std::shared_ptr op) const override; - bool transform(TransformationContext& context, ov::pass::pattern::Matcher &m) override; + bool canBeTransformed(const std::shared_ptr& op) const override; + bool transform(ov::pass::pattern::Matcher &m) override; bool isPrecisionPreserved(std::shared_ptr layer) const noexcept override; }; diff --git a/src/common/low_precision_transformations/include/low_precision/move_fake_quantize.hpp b/src/common/low_precision_transformations/include/low_precision/move_fake_quantize.hpp index 628c88b38992e4..96a344cc4620fe 100644 --- a/src/common/low_precision_transformations/include/low_precision/move_fake_quantize.hpp +++ b/src/common/low_precision_transformations/include/low_precision/move_fake_quantize.hpp @@ -16,8 +16,8 @@ class LP_TRANSFORMATIONS_API MoveFakeQuantize : public LayerTransformation { public: OPENVINO_RTTI("MoveFakeQuantize", "0", LayerTransformation); MoveFakeQuantize(const Params& params = Params()); - bool transform(TransformationContext& context, ov::pass::pattern::Matcher &m) override; - bool canBeTransformed(const TransformationContext& context, std::shared_ptr layer) const override; + bool transform(ov::pass::pattern::Matcher &m) override; + bool canBeTransformed(const std::shared_ptr& layer) const override; bool isPrecisionPreserved(std::shared_ptr layer) const noexcept override; }; diff --git a/src/common/low_precision_transformations/include/low_precision/multiply.hpp b/src/common/low_precision_transformations/include/low_precision/multiply.hpp index fd51b8cac07f35..5658a5bf71bedf 100644 --- a/src/common/low_precision_transformations/include/low_precision/multiply.hpp +++ b/src/common/low_precision_transformations/include/low_precision/multiply.hpp @@ -23,7 +23,7 @@ class LP_TRANSFORMATIONS_API MultiplyTransformation : public WeightableLayerTran public: OPENVINO_RTTI("MultiplyTransformation", "0", WeightableLayerTransformation); MultiplyTransformation(const Params& params = Params()); - bool transform(TransformationContext& context, ov::pass::pattern::Matcher &m) override; + bool transform(ov::pass::pattern::Matcher &m) override; protected: size_t getInputChannels(const std::shared_ptr op) const override; diff --git a/src/common/low_precision_transformations/include/low_precision/multiply_partial.hpp b/src/common/low_precision_transformations/include/low_precision/multiply_partial.hpp index 3bee03cfb1a265..7f05baeaf3b12e 100644 --- a/src/common/low_precision_transformations/include/low_precision/multiply_partial.hpp +++ b/src/common/low_precision_transformations/include/low_precision/multiply_partial.hpp @@ -23,8 +23,8 @@ class LP_TRANSFORMATIONS_API MultiplyPartialTransformation : public EltwiseBaseT public: OPENVINO_RTTI("MultiplyPartialTransformation", "0", EltwiseBaseTransformation); MultiplyPartialTransformation(const Params& params = Params()); - bool transform(TransformationContext& context, ov::pass::pattern::Matcher &m) override; - bool canBeTransformed(const TransformationContext& context, std::shared_ptr layer) const override; + bool transform(ov::pass::pattern::Matcher &m) override; + bool canBeTransformed(const std::shared_ptr& layer) const override; }; } // namespace low_precision diff --git a/src/common/low_precision_transformations/include/low_precision/multiply_to_group_convolution.hpp b/src/common/low_precision_transformations/include/low_precision/multiply_to_group_convolution.hpp index 45252777252fc6..3d6fc228331b13 100644 --- a/src/common/low_precision_transformations/include/low_precision/multiply_to_group_convolution.hpp +++ b/src/common/low_precision_transformations/include/low_precision/multiply_to_group_convolution.hpp @@ -27,8 +27,8 @@ class LP_TRANSFORMATIONS_API MultiplyToGroupConvolutionTransformation : public C const Params& params = Params(), const PrecisionsRestriction::PrecisionsByPorts& restrictions = {}); ~MultiplyToGroupConvolutionTransformation() override {} - bool transform(TransformationContext& context, ov::pass::pattern::Matcher &m) override; - bool canBeTransformed(const TransformationContext& context, std::shared_ptr layer) const override; + bool transform(ov::pass::pattern::Matcher &m) override; + bool canBeTransformed(const std::shared_ptr& layer) const override; bool isPrecisionPreserved(std::shared_ptr layer) const noexcept override; bool isQuantized(const std::shared_ptr& layer, const std::vector& defaultPrecisions) const override; diff --git a/src/common/low_precision_transformations/include/low_precision/mvn.hpp b/src/common/low_precision_transformations/include/low_precision/mvn.hpp index cd73075ad5740b..061cca9917c43f 100644 --- a/src/common/low_precision_transformations/include/low_precision/mvn.hpp +++ b/src/common/low_precision_transformations/include/low_precision/mvn.hpp @@ -22,8 +22,8 @@ class LP_TRANSFORMATIONS_API MVNTransformation : public LayerTransformation { public: OPENVINO_RTTI("MVNTransformation", "0", LayerTransformation); MVNTransformation(const Params& params = Params()); - bool transform(TransformationContext &context, ov::pass::pattern::Matcher &m) override; - bool canBeTransformed(const TransformationContext& context, std::shared_ptr layer) const override; + bool transform(ov::pass::pattern::Matcher &m) override; + bool canBeTransformed(const std::shared_ptr& layer) const override; bool isPrecisionPreserved(std::shared_ptr layer) const noexcept override; }; diff --git a/src/common/low_precision_transformations/include/low_precision/network_helper.hpp b/src/common/low_precision_transformations/include/low_precision/network_helper.hpp index 40f2973b0701df..d4a3ba6d429044 100644 --- a/src/common/low_precision_transformations/include/low_precision/network_helper.hpp +++ b/src/common/low_precision_transformations/include/low_precision/network_helper.hpp @@ -16,7 +16,6 @@ #include "rt_info/precisions_attribute.hpp" #include "rt_info/quantization_granularity_attribute.hpp" #include "rt_info/intervals_alignment_attribute.hpp" -#include "transformation_context.hpp" #include "quantization_details.hpp" #include "transformations/utils/utils.hpp" #include "common/fake_quantize_dequantization.hpp" diff --git a/src/common/low_precision_transformations/include/low_precision/normalize_l2.hpp b/src/common/low_precision_transformations/include/low_precision/normalize_l2.hpp index c2777ca0652a07..8d16867982e5fe 100644 --- a/src/common/low_precision_transformations/include/low_precision/normalize_l2.hpp +++ b/src/common/low_precision_transformations/include/low_precision/normalize_l2.hpp @@ -22,8 +22,8 @@ class LP_TRANSFORMATIONS_API NormalizeL2Transformation : public LayerTransformat public: OPENVINO_RTTI("NormalizeL2Transformation", "0", LayerTransformation); NormalizeL2Transformation(const Params& params = Params()); - bool transform(TransformationContext &context, ov::pass::pattern::Matcher &m) override; - bool canBeTransformed(const TransformationContext& context, std::shared_ptr layer) const override; + bool transform(ov::pass::pattern::Matcher &m) override; + bool canBeTransformed(const std::shared_ptr& layer) const override; bool isPrecisionPreserved(std::shared_ptr layer) const noexcept override; }; diff --git a/src/common/low_precision_transformations/include/low_precision/pad.hpp b/src/common/low_precision_transformations/include/low_precision/pad.hpp index 49012e19a604e8..595d7b02dbd77e 100644 --- a/src/common/low_precision_transformations/include/low_precision/pad.hpp +++ b/src/common/low_precision_transformations/include/low_precision/pad.hpp @@ -24,8 +24,8 @@ class LP_TRANSFORMATIONS_API PadTransformation : public LayerTransformation { public: OPENVINO_RTTI("PadTransformation", "0", LayerTransformation); PadTransformation(const Params& params = Params()); - bool transform(TransformationContext& context, pattern::Matcher& m) override; - bool canBeTransformed(const TransformationContext& context, std::shared_ptr op) const override; + bool transform(pattern::Matcher& m) override; + bool canBeTransformed(const std::shared_ptr& op) const override; bool isPrecisionPreserved(std::shared_ptr layer) const noexcept override; }; diff --git a/src/common/low_precision_transformations/include/low_precision/prelu.hpp b/src/common/low_precision_transformations/include/low_precision/prelu.hpp index df64677b861dbb..12af2f536b28f2 100644 --- a/src/common/low_precision_transformations/include/low_precision/prelu.hpp +++ b/src/common/low_precision_transformations/include/low_precision/prelu.hpp @@ -24,9 +24,9 @@ class LP_TRANSFORMATIONS_API PReluTransformation : public LayerTransformation { public: OPENVINO_RTTI("PReluTransformation", "0", LayerTransformation); PReluTransformation(const Params& params = Params()); - bool transform(TransformationContext& context, ov::pass::pattern::Matcher &m) override; + bool transform(ov::pass::pattern::Matcher &m) override; bool isPrecisionPreserved(std::shared_ptr layer) const noexcept override; - bool canBeTransformed(const TransformationContext& context, std::shared_ptr op) const override; + bool canBeTransformed(const std::shared_ptr& op) const override; }; } // namespace low_precision diff --git a/src/common/low_precision_transformations/include/low_precision/recurrent_cell.hpp b/src/common/low_precision_transformations/include/low_precision/recurrent_cell.hpp index fc0401b08dd74e..9cb8ed91c4b70b 100644 --- a/src/common/low_precision_transformations/include/low_precision/recurrent_cell.hpp +++ b/src/common/low_precision_transformations/include/low_precision/recurrent_cell.hpp @@ -16,8 +16,8 @@ class LP_TRANSFORMATIONS_API RecurrentCellTransformation : public LayerTransform public: OPENVINO_RTTI("RecurrentCellTransformation", "0", LayerTransformation); RecurrentCellTransformation(const Params& params = Params()); - bool transform(TransformationContext& context, ov::pass::pattern::Matcher &m) override; - bool canBeTransformed(const TransformationContext& context, std::shared_ptr layer) const override; + bool transform(ov::pass::pattern::Matcher &m) override; + bool canBeTransformed(const std::shared_ptr& layer) const override; bool isPrecisionPreserved(std::shared_ptr layer) const noexcept override; void propagateSkipCleanupAttribute(std::shared_ptr dequantization_multiply); static std::shared_ptr wrap_fake_quantize(const std::shared_ptr parameter); @@ -25,7 +25,7 @@ class LP_TRANSFORMATIONS_API RecurrentCellTransformation : public LayerTransform static std::shared_ptr wrap_dequantization(const std::shared_ptr parameter, const bool with_subtract); private: - void propagate(TransformationContext& context, const std::shared_ptr node); + void propagate(const std::shared_ptr node); }; } // namespace low_precision diff --git a/src/common/low_precision_transformations/include/low_precision/reduce_base_transformation.hpp b/src/common/low_precision_transformations/include/low_precision/reduce_base_transformation.hpp index 4a42edd60d80c8..c91a8364f71c08 100644 --- a/src/common/low_precision_transformations/include/low_precision/reduce_base_transformation.hpp +++ b/src/common/low_precision_transformations/include/low_precision/reduce_base_transformation.hpp @@ -22,8 +22,8 @@ namespace low_precision { class LP_TRANSFORMATIONS_API ReduceBaseTransformation : public LayerTransformation { public: ReduceBaseTransformation(const Params& params = Params()); - bool transform(TransformationContext& context, ov::pass::pattern::Matcher& m) override; - bool canBeTransformed(const TransformationContext& context, std::shared_ptr reduce) const override; + bool transform(ov::pass::pattern::Matcher& m) override; + bool canBeTransformed(const std::shared_ptr& reduce) const override; protected: virtual void changeDequantizationValues( diff --git a/src/common/low_precision_transformations/include/low_precision/reduce_max.hpp b/src/common/low_precision_transformations/include/low_precision/reduce_max.hpp index 33f685ba8ca74c..f4e824a43fdec7 100644 --- a/src/common/low_precision_transformations/include/low_precision/reduce_max.hpp +++ b/src/common/low_precision_transformations/include/low_precision/reduce_max.hpp @@ -27,7 +27,7 @@ class LP_TRANSFORMATIONS_API ReduceMaxTransformation : public ReduceBaseTransfor OPENVINO_RTTI("ReduceMaxTransformation", "0", ReduceBaseTransformation); ReduceMaxTransformation(const Params& params = Params()); bool isPrecisionPreserved(std::shared_ptr reduce) const noexcept override; - bool canBeTransformed(const TransformationContext& context, std::shared_ptr reduce) const override; + bool canBeTransformed(const std::shared_ptr& reduce) const override; protected: bool getUpdatePrecision(const std::shared_ptr& reduce) const override; diff --git a/src/common/low_precision_transformations/include/low_precision/reduce_mean.hpp b/src/common/low_precision_transformations/include/low_precision/reduce_mean.hpp index c5f9d7d0a5e239..4a689cc4007317 100644 --- a/src/common/low_precision_transformations/include/low_precision/reduce_mean.hpp +++ b/src/common/low_precision_transformations/include/low_precision/reduce_mean.hpp @@ -27,7 +27,7 @@ class LP_TRANSFORMATIONS_API ReduceMeanTransformation : public ReduceBaseTransfo OPENVINO_RTTI("ReduceMeanTransformation", "0", ReduceBaseTransformation); ReduceMeanTransformation(const Params& params = Params()); bool isPrecisionPreserved(std::shared_ptr reduce) const noexcept override; - bool canBeTransformed(const TransformationContext& context, std::shared_ptr reduce) const override; + bool canBeTransformed(const std::shared_ptr& reduce) const override; protected: bool getUpdatePrecision(const std::shared_ptr& reduce) const override; diff --git a/src/common/low_precision_transformations/include/low_precision/reduce_min.hpp b/src/common/low_precision_transformations/include/low_precision/reduce_min.hpp index a229b441b8b6da..f41630989de361 100644 --- a/src/common/low_precision_transformations/include/low_precision/reduce_min.hpp +++ b/src/common/low_precision_transformations/include/low_precision/reduce_min.hpp @@ -27,7 +27,7 @@ class LP_TRANSFORMATIONS_API ReduceMinTransformation : public ReduceBaseTransfor OPENVINO_RTTI("ReduceMinTransformation", "0", ReduceBaseTransformation); ReduceMinTransformation(const Params& params = Params()); bool isPrecisionPreserved(std::shared_ptr reduce) const noexcept override; - bool canBeTransformed(const TransformationContext& context, std::shared_ptr reduce) const override; + bool canBeTransformed(const std::shared_ptr& reduce) const override; protected: bool getUpdatePrecision(const std::shared_ptr& reduce) const override; diff --git a/src/common/low_precision_transformations/include/low_precision/reduce_sum.hpp b/src/common/low_precision_transformations/include/low_precision/reduce_sum.hpp index aba35e0f793c83..0efd79b2472624 100644 --- a/src/common/low_precision_transformations/include/low_precision/reduce_sum.hpp +++ b/src/common/low_precision_transformations/include/low_precision/reduce_sum.hpp @@ -27,7 +27,7 @@ class LP_TRANSFORMATIONS_API ReduceSumTransformation : public ReduceBaseTransfor OPENVINO_RTTI("ReduceSumTransformation", "0", ReduceBaseTransformation); ReduceSumTransformation(const Params& params = Params()); bool isPrecisionPreserved(std::shared_ptr reduce) const noexcept override; - bool canBeTransformed(const TransformationContext& context, std::shared_ptr reduce) const override; + bool canBeTransformed(const std::shared_ptr& reduce) const override; protected: void changeDequantizationValues( diff --git a/src/common/low_precision_transformations/include/low_precision/relu.hpp b/src/common/low_precision_transformations/include/low_precision/relu.hpp index 936d4f3f8fc9a8..cc92ea72c40f49 100644 --- a/src/common/low_precision_transformations/include/low_precision/relu.hpp +++ b/src/common/low_precision_transformations/include/low_precision/relu.hpp @@ -24,9 +24,9 @@ class LP_TRANSFORMATIONS_API ReluTransformation : public LayerTransformation { public: OPENVINO_RTTI("ReluTransformation", "0", LayerTransformation); ReluTransformation(const Params& params = Params()); - bool transform(TransformationContext& context, ov::pass::pattern::Matcher &m) override; + bool transform(ov::pass::pattern::Matcher &m) override; bool isPrecisionPreserved(std::shared_ptr layer) const noexcept override; - bool canBeTransformed(const TransformationContext& context, std::shared_ptr op) const override; + bool canBeTransformed(const std::shared_ptr& op) const override; }; } // namespace low_precision diff --git a/src/common/low_precision_transformations/include/low_precision/reshape.hpp b/src/common/low_precision_transformations/include/low_precision/reshape.hpp index 43858e67cce21a..b9857f6928a6aa 100644 --- a/src/common/low_precision_transformations/include/low_precision/reshape.hpp +++ b/src/common/low_precision_transformations/include/low_precision/reshape.hpp @@ -23,9 +23,9 @@ class LP_TRANSFORMATIONS_API ReshapeTransformation : public LayerTransformation public: OPENVINO_RTTI("ReshapeTransformation", "0", LayerTransformation); ReshapeTransformation(const Params& params = Params()); - bool transform(TransformationContext& context, ov::pass::pattern::Matcher &m) override; + bool transform(ov::pass::pattern::Matcher &m) override; bool isPrecisionPreserved(std::shared_ptr layer) const noexcept override; - bool canBeTransformed(const TransformationContext& context, std::shared_ptr op) const override; + bool canBeTransformed(const std::shared_ptr& op) const override; static bool canBeTransformed( const ov::Shape& subtractShape, diff --git a/src/common/low_precision_transformations/include/low_precision/rt_info/quantization_granularity_attribute.hpp b/src/common/low_precision_transformations/include/low_precision/rt_info/quantization_granularity_attribute.hpp index e74f601f4bd4de..c43d061fb455b3 100644 --- a/src/common/low_precision_transformations/include/low_precision/rt_info/quantization_granularity_attribute.hpp +++ b/src/common/low_precision_transformations/include/low_precision/rt_info/quantization_granularity_attribute.hpp @@ -27,7 +27,7 @@ class LP_TRANSFORMATIONS_API QuantizationGranularityAttribute : public ov::Runti }; QuantizationGranularityAttribute() : granularity(Granularity::PerChannel) {} - QuantizationGranularityAttribute(const Granularity granularity) : granularity(granularity) {} + QuantizationGranularityAttribute(const Granularity& granularity) : granularity(granularity) {} bool operator==(const QuantizationGranularityAttribute& attribute) const { return this->granularity == attribute.granularity; diff --git a/src/common/low_precision_transformations/include/low_precision/rt_info/shared_value_attribute.hpp b/src/common/low_precision_transformations/include/low_precision/rt_info/shared_value_attribute.hpp index 04eade094279a9..bf8f51b3077fae 100644 --- a/src/common/low_precision_transformations/include/low_precision/rt_info/shared_value_attribute.hpp +++ b/src/common/low_precision_transformations/include/low_precision/rt_info/shared_value_attribute.hpp @@ -15,8 +15,6 @@ template class LP_TRANSFORMATIONS_API SharedAttribute : public ov::RuntimeAttribute { public: - virtual ~SharedAttribute() = default; - /** * @ingroup ov_transformation_common_api * @brief SharedValueAttribute type for shared value attributes. diff --git a/src/common/low_precision_transformations/include/low_precision/shuffle_channels.hpp b/src/common/low_precision_transformations/include/low_precision/shuffle_channels.hpp index 12a60b128d707d..999c052a3108ad 100644 --- a/src/common/low_precision_transformations/include/low_precision/shuffle_channels.hpp +++ b/src/common/low_precision_transformations/include/low_precision/shuffle_channels.hpp @@ -23,9 +23,9 @@ class LP_TRANSFORMATIONS_API ShuffleChannelsTransformation : public LayerTransfo public: OPENVINO_RTTI("ShuffleChannelsTransformation", "0", LayerTransformation); ShuffleChannelsTransformation(const Params& params = Params()); - bool transform(TransformationContext& context, ov::pass::pattern::Matcher& m) override; + bool transform(ov::pass::pattern::Matcher& m) override; bool isPrecisionPreserved(std::shared_ptr layer) const noexcept override; - bool canBeTransformed(const TransformationContext& context, std::shared_ptr op) const override; + bool canBeTransformed(const std::shared_ptr& op) const override; }; } // namespace low_precision diff --git a/src/common/low_precision_transformations/include/low_precision/slice.hpp b/src/common/low_precision_transformations/include/low_precision/slice.hpp index c00028f0d71169..6b73536cf06c98 100644 --- a/src/common/low_precision_transformations/include/low_precision/slice.hpp +++ b/src/common/low_precision_transformations/include/low_precision/slice.hpp @@ -24,8 +24,8 @@ class LP_TRANSFORMATIONS_API SliceTransformation : public LayerTransformation { public: OPENVINO_RTTI("SliceTransformation", "0", LayerTransformation); SliceTransformation(const Params& params = Params()); - bool transform(TransformationContext& context, ov::pass::pattern::Matcher& m) override; - bool canBeTransformed(const TransformationContext& context, std::shared_ptr op) const override; + bool transform(ov::pass::pattern::Matcher& m) override; + bool canBeTransformed(const std::shared_ptr& op) const override; bool isPrecisionPreserved(std::shared_ptr layer) const noexcept override; }; diff --git a/src/common/low_precision_transformations/include/low_precision/space_to_batch.hpp b/src/common/low_precision_transformations/include/low_precision/space_to_batch.hpp index e05353aaf24d1c..48cda7b4c305fb 100644 --- a/src/common/low_precision_transformations/include/low_precision/space_to_batch.hpp +++ b/src/common/low_precision_transformations/include/low_precision/space_to_batch.hpp @@ -24,8 +24,8 @@ class LP_TRANSFORMATIONS_API SpaceToBatchTransformation : public LayerTransforma public: OPENVINO_RTTI("SpaceToBatchTransformation", "0", LayerTransformation); SpaceToBatchTransformation(const Params& params = Params()); - bool canBeTransformed(const TransformationContext& context, std::shared_ptr op) const override; - bool transform(TransformationContext& context, ov::pass::pattern::Matcher &m) override; + bool canBeTransformed(const std::shared_ptr& op) const override; + bool transform(ov::pass::pattern::Matcher &m) override; bool isPrecisionPreserved(std::shared_ptr layer) const noexcept override; }; diff --git a/src/common/low_precision_transformations/include/low_precision/split.hpp b/src/common/low_precision_transformations/include/low_precision/split.hpp index bd3294fba7e691..bb48628a832372 100644 --- a/src/common/low_precision_transformations/include/low_precision/split.hpp +++ b/src/common/low_precision_transformations/include/low_precision/split.hpp @@ -25,13 +25,10 @@ class LP_TRANSFORMATIONS_API SplitTransformation : public LayerTransformation { public: OPENVINO_RTTI("SplitTransformation", "0", LayerTransformation); SplitTransformation(const Params& params = Params()); - bool transform(TransformationContext& context, ov::pass::pattern::Matcher& m) override; + bool transform(ov::pass::pattern::Matcher& m) override; bool isPrecisionPreserved(std::shared_ptr layer) const noexcept override; - bool canBeTransformed(const TransformationContext& context, std::shared_ptr layer) const override; - void updateOutputs( - TransformationContext& context, - std::vector> lastNodes, - std::shared_ptr originalNode) const; + bool canBeTransformed(const std::shared_ptr& layer) const override; + void updateOutputs(std::vector> lastNodes, std::shared_ptr originalNode) const; }; } // namespace low_precision } // namespace pass diff --git a/src/common/low_precision_transformations/include/low_precision/squeeze.hpp b/src/common/low_precision_transformations/include/low_precision/squeeze.hpp index b19a676c6de1fd..599b9e2f2eadb3 100644 --- a/src/common/low_precision_transformations/include/low_precision/squeeze.hpp +++ b/src/common/low_precision_transformations/include/low_precision/squeeze.hpp @@ -23,9 +23,9 @@ class LP_TRANSFORMATIONS_API SqueezeTransformation : public LayerTransformation public: OPENVINO_RTTI("SqueezeTransformation", "0", LayerTransformation); SqueezeTransformation(const Params& params = Params()); - bool transform(TransformationContext& context, ov::pass::pattern::Matcher &m) override; + bool transform(ov::pass::pattern::Matcher &m) override; bool isPrecisionPreserved(std::shared_ptr layer) const noexcept override; - bool canBeTransformed(const TransformationContext& context, std::shared_ptr layer) const override; + bool canBeTransformed(const std::shared_ptr& layer) const override; }; } // namespace low_precision diff --git a/src/common/low_precision_transformations/include/low_precision/strided_slice.hpp b/src/common/low_precision_transformations/include/low_precision/strided_slice.hpp index 5081903c751dfb..a5bbaf983e0b07 100644 --- a/src/common/low_precision_transformations/include/low_precision/strided_slice.hpp +++ b/src/common/low_precision_transformations/include/low_precision/strided_slice.hpp @@ -24,8 +24,8 @@ class LP_TRANSFORMATIONS_API StridedSliceTransformation : public LayerTransforma public: OPENVINO_RTTI("StridedSliceTransformation", "0", LayerTransformation); StridedSliceTransformation(const Params& params = Params()); - bool transform(TransformationContext& context, ov::pass::pattern::Matcher& m) override; - bool canBeTransformed(const TransformationContext& context, std::shared_ptr op) const override; + bool transform(ov::pass::pattern::Matcher& m) override; + bool canBeTransformed(const std::shared_ptr& op) const override; bool isPrecisionPreserved(std::shared_ptr layer) const noexcept override; }; diff --git a/src/common/low_precision_transformations/include/low_precision/subtract.hpp b/src/common/low_precision_transformations/include/low_precision/subtract.hpp index a7c6bfbe888ca7..c020480c1e314d 100644 --- a/src/common/low_precision_transformations/include/low_precision/subtract.hpp +++ b/src/common/low_precision_transformations/include/low_precision/subtract.hpp @@ -23,7 +23,7 @@ class LP_TRANSFORMATIONS_API SubtractTransformation : public LayerTransformation public: OPENVINO_RTTI("SubtractTransformation", "0", LayerTransformation); SubtractTransformation(const Params& params); - bool transform(TransformationContext& context, ov::pass::pattern::Matcher &m) override; + bool transform(ov::pass::pattern::Matcher &m) override; }; } // namespace low_precision diff --git a/src/common/low_precision_transformations/include/low_precision/transformation_context.hpp b/src/common/low_precision_transformations/include/low_precision/transformation_context.hpp deleted file mode 100644 index ec46224f8d88ae..00000000000000 --- a/src/common/low_precision_transformations/include/low_precision/transformation_context.hpp +++ /dev/null @@ -1,39 +0,0 @@ -// Copyright (C) 2018-2025 Intel Corporation -// SPDX-License-Identifier: Apache-2.0 -// - -#pragma once - -#include -#include -#include "low_precision/quantization_details.hpp" - -namespace ov { -namespace pass { -namespace low_precision { - -/** - * @ingroup ov_transformation_common_api - * @brief TransformationContext instance is used to pass model transformation context data between transformations. - */ -class LP_TRANSFORMATIONS_API TransformationContext { -public: - TransformationContext(); - explicit TransformationContext(std::shared_ptr model); - std::shared_ptr model; - - // Used to store handled FakeQuantize operations. - // ConcatTransformation and FakeQuantizeTransformation handle FakeQuantize operations. ConcatTransformation handles FakeQuantize operation first. - // If updatePrecision transformation option is set to False then there are no FakeQuantize operation attributes to identify that the operation - // have been handled by ConcatTransformation already: - // - output precision is original (FP32), - // - intervals are changed but not equal to precision boundaries, - // - quantization level can be or can be not changed. - // To avoid FakeQuantize operation double handling by FakeQuantizeTransformation after ConcatTransformation, FakeQuantizeTransformation - // has to use this member. - std::unordered_set quantizedFakeQuantizeNames; -}; - -} // namespace low_precision -} // namespace pass -} // namespace ov diff --git a/src/common/low_precision_transformations/include/low_precision/transparent_base_transformation.hpp b/src/common/low_precision_transformations/include/low_precision/transparent_base_transformation.hpp index 792c749f525b53..c0350fe186942a 100644 --- a/src/common/low_precision_transformations/include/low_precision/transparent_base_transformation.hpp +++ b/src/common/low_precision_transformations/include/low_precision/transparent_base_transformation.hpp @@ -20,8 +20,8 @@ class LP_TRANSFORMATIONS_API TransparentBaseTransformation : public LayerTransfo public: TransparentBaseTransformation(const Params& params) : LayerTransformation(params) {} ~TransparentBaseTransformation() override {}; - bool transform(TransformationContext& context, ov::pass::pattern::Matcher &m) override; - bool canBeTransformed(const TransformationContext& context, std::shared_ptr layer) const override; + bool transform(ov::pass::pattern::Matcher &m) override; + bool canBeTransformed(const std::shared_ptr& layer) const override; bool isPrecisionPreserved(std::shared_ptr layer) const noexcept override; }; diff --git a/src/common/low_precision_transformations/include/low_precision/transpose.hpp b/src/common/low_precision_transformations/include/low_precision/transpose.hpp index f2cedb31e2e5a7..a2fc1d4fa58598 100644 --- a/src/common/low_precision_transformations/include/low_precision/transpose.hpp +++ b/src/common/low_precision_transformations/include/low_precision/transpose.hpp @@ -24,9 +24,9 @@ class LP_TRANSFORMATIONS_API TransposeTransformation : public LayerTransformatio public: OPENVINO_RTTI("TransposeTransformation", "0", LayerTransformation); TransposeTransformation(const Params& params = Params()); - bool transform(TransformationContext& context, ov::pass::pattern::Matcher &m) override; + bool transform(ov::pass::pattern::Matcher &m) override; bool isPrecisionPreserved(std::shared_ptr layer) const noexcept override; - bool canBeTransformed(const TransformationContext& context, std::shared_ptr op) const override; + bool canBeTransformed(const std::shared_ptr& op) const override; }; } // namespace low_precision diff --git a/src/common/low_precision_transformations/include/low_precision/unsqueeze.hpp b/src/common/low_precision_transformations/include/low_precision/unsqueeze.hpp index 98152eaf919524..41728d1acf289e 100644 --- a/src/common/low_precision_transformations/include/low_precision/unsqueeze.hpp +++ b/src/common/low_precision_transformations/include/low_precision/unsqueeze.hpp @@ -23,9 +23,9 @@ class LP_TRANSFORMATIONS_API UnsqueezeTransformation : public LayerTransformatio public: OPENVINO_RTTI("UnsqueezeTransformation", "0", LayerTransformation); UnsqueezeTransformation(const Params& params = Params()); - bool transform(TransformationContext& context, ov::pass::pattern::Matcher &m) override; + bool transform(ov::pass::pattern::Matcher &m) override; bool isPrecisionPreserved(std::shared_ptr layer) const noexcept override; - bool canBeTransformed(const TransformationContext& context, std::shared_ptr layer) const override; + bool canBeTransformed(const std::shared_ptr& layer) const override; }; } // namespace low_precision diff --git a/src/common/low_precision_transformations/include/low_precision/weightable_layer_transformation.hpp b/src/common/low_precision_transformations/include/low_precision/weightable_layer_transformation.hpp index dfb75067ff426b..7b5c5b782d9a65 100644 --- a/src/common/low_precision_transformations/include/low_precision/weightable_layer_transformation.hpp +++ b/src/common/low_precision_transformations/include/low_precision/weightable_layer_transformation.hpp @@ -5,7 +5,6 @@ #pragma once #include -#include "transformation_context.hpp" #include "layer_transformation.hpp" #include "openvino/opsets/opset1.hpp" @@ -42,17 +41,11 @@ class LP_TRANSFORMATIONS_API WeightableLayerTransformation : public LayerTransfo WeightableLayerTransformation(const Params& params, const CanBeTransformedParams& canBeTransformedParams = {}); - bool canBeTransformed(const TransformationContext& context, std::shared_ptr layer) const override; - bool canConvolutionBeTransformed(const TransformationContext& context, std::shared_ptr layer, - const std::vector& defaultPrecisions) const; + bool canBeTransformed(const std::shared_ptr& layer) const override; + bool canConvolutionBeTransformed(const std::shared_ptr& layer, + const ov::element::TypeVector& defaultPrecisions) const; bool isPrecisionPreserved(std::shared_ptr layer) const noexcept override; - static bool checkPrecisionOnActivation( - const std::shared_ptr& node, - const std::vector& supportedPrecisionsOnActivations) { - return true; - } - static bool isQuantizedStatic(const std::shared_ptr& layer, const bool reshapeIsRequired, const std::vector& defaultPrecisions = precision_set::get_int8_support()); diff --git a/src/common/low_precision_transformations/src/add.cpp b/src/common/low_precision_transformations/src/add.cpp index b895d3325377de..e55577fda4ce3a 100644 --- a/src/common/low_precision_transformations/src/add.cpp +++ b/src/common/low_precision_transformations/src/add.cpp @@ -95,16 +95,16 @@ AddTransformation::AddTransformation(const Params& params) : EltwiseBaseTransfor if (transformation_callback(op)) { return false; } - return transform(*context, m); + return transform(m); }; auto m = std::make_shared(matcher, matcher_name); this->register_matcher(m, callback); } -bool AddTransformation::transform(TransformationContext& context, ov::pass::pattern::Matcher &m) { +bool AddTransformation::transform(ov::pass::pattern::Matcher &m) { std::shared_ptr op = ov::as_type_ptr(m.get_match_root()); - if ((op == nullptr) || (!canBeTransformed(context, op))) { + if ((op == nullptr) || (!canBeTransformed(op))) { return false; } @@ -229,7 +229,7 @@ bool AddTransformation::transform(TransformationContext& context, ov::pass::patt ov::copy_runtime_info({ add, newMultiply }, newMultiply); } - updateOutput(context, newMultiply, newAddOrSubtract); + updateOutput(newMultiply, newAddOrSubtract); if (fullPathIndex != -1) { std::shared_ptr node = add; @@ -240,7 +240,7 @@ bool AddTransformation::transform(TransformationContext& context, ov::pass::patt return true; } -bool AddTransformation::canBeTransformed(const TransformationContext& context, std::shared_ptr layer) const { +bool AddTransformation::canBeTransformed(const std::shared_ptr& layer) const { const FakeQuantizeDequantization dequantization1 = pass::low_precision::NetworkHelper::getDequantization(layer, defaultPrecisions, 0ul); if (dequantization1.multiplyHasZeroOrDenormal()) { return false; @@ -251,7 +251,7 @@ bool AddTransformation::canBeTransformed(const TransformationContext& context, s return false; } - return EltwiseBaseTransformation::canBeTransformed(context, layer); + return EltwiseBaseTransformation::canBeTransformed(layer); } } // namespace low_precision diff --git a/src/common/low_precision_transformations/src/assign_and_read_value.cpp b/src/common/low_precision_transformations/src/assign_and_read_value.cpp index 27b79e4d347102..0b3f775c57ad22 100644 --- a/src/common/low_precision_transformations/src/assign_and_read_value.cpp +++ b/src/common/low_precision_transformations/src/assign_and_read_value.cpp @@ -20,36 +20,27 @@ namespace low_precision { AssignAndReadValueTransformation::AssignAndReadValueTransformation(const std::shared_ptr model, const Params& params) : LayerTransformation(params), model(model) { MATCHER_SCOPE(AssignAndReadValueTransformation); - auto assign3 = pattern::wrap_type({ pattern::wrap_type() }); - auto assign6 = pattern::wrap_type({ pattern::wrap_type() }); + auto assign_m = pattern::wrap_type({ pattern::wrap_type() }); ov::graph_rewrite_callback callback = [OV_CAPTURE_CPY_AND_THIS](pattern::Matcher& m) { - const auto& opsMap = m.get_pattern_value_map(); - auto op = m.get_match_root(); - auto assignIt = opsMap.find(assign3); - if (assignIt == opsMap.end()) { - assignIt = opsMap.find(assign6); - } - const auto assign = assignIt->second.get_node_shared_ptr(); + const auto assign = m.get_match_root(); // check that we have ReadValue as the first dependency if (assign->get_control_dependencies().empty()) { return false; } - if (transformation_callback(op)) { + if (transformation_callback(assign)) { return false; } - return transform(*context, m); + return transform(m); }; - auto m = std::make_shared( - std::make_shared(OutputVector{ assign3, assign6 }), - matcher_name); + auto m = std::make_shared(assign_m, matcher_name); this->register_matcher(m, callback); } -bool AssignAndReadValueTransformation::transform(TransformationContext& context, ov::pass::pattern::Matcher& m) { - if (!canBeTransformed(context, m.get_match_root())) { +bool AssignAndReadValueTransformation::transform(ov::pass::pattern::Matcher& m) { + if (!canBeTransformed(m.get_match_root())) { return false; } @@ -99,13 +90,13 @@ bool AssignAndReadValueTransformation::transform(TransformationContext& context, return true; } - FakeQuantizeTransformation::fuseElementwise(context, this, fakeQuantize, updatePrecisions); + FakeQuantizeTransformation::fuseElementwise(this, fakeQuantize, updatePrecisions); return true; } -bool AssignAndReadValueTransformation::canBeTransformed(const TransformationContext& context, std::shared_ptr op) const { - if (!LayerTransformation::canBeTransformed(context, op)) { +bool AssignAndReadValueTransformation::canBeTransformed(const std::shared_ptr& op) const { + if (!LayerTransformation::canBeTransformed(op)) { return false; } diff --git a/src/common/low_precision_transformations/src/avg_pool.cpp b/src/common/low_precision_transformations/src/avg_pool.cpp index c9bfa67cfc1cfb..7a38834efbdb0d 100644 --- a/src/common/low_precision_transformations/src/avg_pool.cpp +++ b/src/common/low_precision_transformations/src/avg_pool.cpp @@ -27,28 +27,28 @@ AvgPoolTransformation::AvgPoolTransformation(const Params& params) : LayerTransf if (transformation_callback(op)) { return false; } - return transform(*context, m); + return transform(m); }; auto m = std::make_shared(matcher, matcher_name); this->register_matcher(m, callback); } -bool AvgPoolTransformation::transform(TransformationContext& context, ov::pass::pattern::Matcher &m) { - if (!canBeTransformed(context, m.get_match_root())) { +bool AvgPoolTransformation::transform(ov::pass::pattern::Matcher &m) { + if (!canBeTransformed(m.get_match_root())) { return false; } const std::shared_ptr pooling = NetworkHelper::separateInStandaloneBranch(m.get_match_root(), defaultPrecisions); const bool updatePrecision = isPrecisionPreserved(pooling); - const auto newOperation = moveDequantizationAfter(context, pooling, NetworkHelper::getDequantization(pooling, defaultPrecisions), updatePrecision); + const auto newOperation = moveDequantizationAfter(pooling, NetworkHelper::getDequantization(pooling, defaultPrecisions), updatePrecision); OPENVINO_DEBUG("LPT: done: ", newOperation); return true; } -bool AvgPoolTransformation::canBeTransformed(const TransformationContext& context, std::shared_ptr operation) const { - if (!LayerTransformation::canBeTransformed(context, operation)) { +bool AvgPoolTransformation::canBeTransformed(const std::shared_ptr& operation) const { + if (!LayerTransformation::canBeTransformed(operation)) { return false; } diff --git a/src/common/low_precision_transformations/src/batch_to_space.cpp b/src/common/low_precision_transformations/src/batch_to_space.cpp index 6745227e848f7b..b231c7110d3d29 100644 --- a/src/common/low_precision_transformations/src/batch_to_space.cpp +++ b/src/common/low_precision_transformations/src/batch_to_space.cpp @@ -26,15 +26,15 @@ BatchToSpaceTransformation::BatchToSpaceTransformation(const Params& params) : L if (transformation_callback(op)) { return false; } - return transform(*context, m); + return transform(m); }; auto m = std::make_shared(matcher, matcher_name); this->register_matcher(m, callback); } -bool BatchToSpaceTransformation::canBeTransformed(const TransformationContext& context, std::shared_ptr op) const { - if (!LayerTransformation::canBeTransformed(context, op)) { +bool BatchToSpaceTransformation::canBeTransformed(const std::shared_ptr& op) const { + if (!LayerTransformation::canBeTransformed(op)) { return false; } @@ -46,13 +46,13 @@ bool BatchToSpaceTransformation::canBeTransformed(const TransformationContext& c return dequantization.isPerTensor(); } -bool BatchToSpaceTransformation::transform(TransformationContext& context, ov::pass::pattern::Matcher& m) { - if (!canBeTransformed(context, m.get_match_root())) { +bool BatchToSpaceTransformation::transform(ov::pass::pattern::Matcher& m) { + if (!canBeTransformed(m.get_match_root())) { return false; } const std::shared_ptr op = NetworkHelper::separateInStandaloneBranch(m.get_match_root(), defaultPrecisions); - const auto newOperation = moveDequantizationAfter(context, op, NetworkHelper::getDequantization(op, defaultPrecisions)); + const auto newOperation = moveDequantizationAfter(op, NetworkHelper::getDequantization(op, defaultPrecisions)); OPENVINO_DEBUG("LPT: done: ", newOperation); return true; diff --git a/src/common/low_precision_transformations/src/broadcast.cpp b/src/common/low_precision_transformations/src/broadcast.cpp index 5e78ca0ef50996..e59d9de3c3e5d9 100644 --- a/src/common/low_precision_transformations/src/broadcast.cpp +++ b/src/common/low_precision_transformations/src/broadcast.cpp @@ -35,15 +35,15 @@ BroadcastTransformation::BroadcastTransformation(const Params& params) : Transpa if (transformation_callback(op)) { return false; } - return transform(*context, m); + return transform(m); }; auto m = std::make_shared(matcher, matcher_name); this->register_matcher(m, callback); } -bool BroadcastTransformation::canBeTransformed(const TransformationContext& context, std::shared_ptr layer) const { - if (!LayerTransformation::canBeTransformed(context, layer)) { +bool BroadcastTransformation::canBeTransformed(const std::shared_ptr& layer) const { + if (!LayerTransformation::canBeTransformed(layer)) { return false; } diff --git a/src/common/low_precision_transformations/src/clamp.cpp b/src/common/low_precision_transformations/src/clamp.cpp index 80748f549bf1ba..440cee10adc3a3 100644 --- a/src/common/low_precision_transformations/src/clamp.cpp +++ b/src/common/low_precision_transformations/src/clamp.cpp @@ -24,15 +24,15 @@ ClampTransformation::ClampTransformation(const Params& params) : LayerTransforma if (transformation_callback(op)) { return false; } - return transform(*context, m); + return transform(m); }; auto m = std::make_shared(matcher, matcher_name); this->register_matcher(m, callback); } -bool ClampTransformation::transform(TransformationContext& context, ov::pass::pattern::Matcher& m) { - if (!canBeTransformed(context, m.get_match_root())) { +bool ClampTransformation::transform(ov::pass::pattern::Matcher& m) { + if (!canBeTransformed(m.get_match_root())) { return false; } @@ -45,7 +45,7 @@ bool ClampTransformation::transform(TransformationContext& context, ov::pass::pa return false; } - const auto newClamp = ov::as_type_ptr(moveDequantizationAfter(context, clamp, dequantization, false, moveSubtract)); + const auto newClamp = ov::as_type_ptr(moveDequantizationAfter(clamp, dequantization, false, moveSubtract)); std::shared_ptr replacement; { @@ -72,7 +72,8 @@ bool ClampTransformation::transform(TransformationContext& context, ov::pass::pa replace_node_update_name(newClamp, replacement); - element::Type outputClampType = dequantization.multiply ? + OPENVINO_ASSERT(dequantization.multiply != nullptr || dequantization.subtract != nullptr, "incorrect dequantization ops configuration"); + const auto outputClampType = dequantization.multiply ? dequantization.multiply->get_output_element_type(0) : dequantization.subtract->get_output_element_type(0); ov::pass::low_precision::NetworkHelper::setOutDataPrecision(replacement, outputClampType); @@ -81,8 +82,8 @@ bool ClampTransformation::transform(TransformationContext& context, ov::pass::pa return true; } -bool ClampTransformation::canBeTransformed(const TransformationContext& context, std::shared_ptr op) const { - if (!LayerTransformation::canBeTransformed(context, op)) { +bool ClampTransformation::canBeTransformed(const std::shared_ptr& op) const { + if (!LayerTransformation::canBeTransformed(op)) { return false; } diff --git a/src/common/low_precision_transformations/src/cleanup_transformation.cpp b/src/common/low_precision_transformations/src/cleanup_transformation.cpp index 3a7cb0da5d5c36..e3c363818013b5 100644 --- a/src/common/low_precision_transformations/src/cleanup_transformation.cpp +++ b/src/common/low_precision_transformations/src/cleanup_transformation.cpp @@ -13,7 +13,7 @@ namespace low_precision { CleanupTransformation::CleanupTransformation(const Params& params) : LayerTransformation(params) { } -bool CleanupTransformation::canBeTransformed(const TransformationContext& context, std::shared_ptr layer) const { +bool CleanupTransformation::canBeTransformed(const std::shared_ptr& layer) const { return canBeTransformedStatic(layer); } diff --git a/src/common/low_precision_transformations/src/concat.cpp b/src/common/low_precision_transformations/src/concat.cpp index 05b1aa940c9191..db77179a229cd6 100644 --- a/src/common/low_precision_transformations/src/concat.cpp +++ b/src/common/low_precision_transformations/src/concat.cpp @@ -32,15 +32,15 @@ ConcatTransformation::ConcatTransformation(const Params& params) : LayerTransfor return false; } - return transform(*context, m); + return transform(m); }; auto m = std::make_shared(matcher, matcher_name); this->register_matcher(m, callback); } -bool ConcatTransformation::transform(TransformationContext& context, ov::pass::pattern::Matcher &m) { - if (!canBeTransformed(context, m.get_match_root())) { +bool ConcatTransformation::transform(ov::pass::pattern::Matcher &m) { + if (!canBeTransformed(m.get_match_root())) { return false; } @@ -82,31 +82,42 @@ bool ConcatTransformation::transform(TransformationContext& context, ov::pass::p allDequantizationShiftConvertAreNotZero = false; } - // constant shape must be broadcastable to the shape on data. - auto broadcastElementWiseConst = [](std::shared_ptr operation, const Shape targetShape) { - auto targetShapeConst = std::make_shared(element::i64, Shape{ targetShape.size() }, targetShape); - auto broadcast = fold(operation, targetShapeConst); - return broadcast; + const auto& concat_out_shape = concat->get_output_partial_shape(0); + const auto axis = ov::util::try_normalize_axis(concat->get_axis(), concat_out_shape.rank(), *concat); + const bool scalar_equal_constants_requested = concat_out_shape[axis].is_dynamic(); + + auto adaptConstForConcatenation = [scalar_equal_constants_requested]( + const std::shared_ptr& constant, + const Shape& targetShape) { + if (scalar_equal_constants_requested) { + OPENVINO_ASSERT(targetShape.empty(), "scalar_equal_constants_requested implies targetShape is empty"); + return std::make_shared(*constant, ov::Shape{}); + } else { + auto targetShapeConst = std::make_shared(element::i64, Shape{ targetShape.size() }, targetShape); + auto bcastedConst = ov::as_type_ptr(fold(constant, targetShapeConst)); + OPENVINO_ASSERT(bcastedConst, "adaptConstForConcatenation must return constant"); + return bcastedConst; + } }; - bool someDqInLowPrecision = std::any_of( + const bool someDqInLowPrecision = std::any_of( layerDequantizations.begin(), layerDequantizations.end(), [](const FakeQuantizeDequantization& value) { return value.isLowPrecision(); }); - bool someDqInFpPrecision = std::any_of( + const bool someDqInFpPrecision = std::any_of( layerDequantizations.begin(), layerDequantizations.end(), [](const FakeQuantizeDequantization& value) { return !value.isLowPrecision(); }); - bool DqWithDifferentPrecision = someDqInLowPrecision && someDqInFpPrecision; - const auto axis = - ov::util::try_normalize_axis(concat->get_axis(), concat->get_output_partial_shape(0).rank(), *concat); + const bool DqWithDifferentPrecision = someDqInLowPrecision && someDqInFpPrecision; OutputVector dataNodes; NodeVector convertNodes; - NodeVector subConstants; - NodeVector mulConstants; + + using ConstVector = std::vector>; + ConstVector subConstants; + ConstVector mulConstants; std::shared_ptr subtractConvert = nullptr; for (size_t i = 0; i < layerDequantizations.size(); ++i) { const auto& dequantization = layerDequantizations[i]; @@ -121,8 +132,13 @@ bool ConcatTransformation::transform(TransformationContext& context, ov::pass::p convertNodes.push_back(dequantization.convert); } - Shape targetShape(concat->get_input_partial_shape(i).rank().get_length(), 1ul); - targetShape[axis] = concat->get_input_partial_shape(i)[axis].get_length(); + const auto targetShape = [&]() { + if (scalar_equal_constants_requested) + return ov::Shape{}; + Shape targetShape(concat->get_input_partial_shape(i).rank().get_length(), 1ul); + targetShape[axis] = concat->get_input_partial_shape(i)[axis].get_length(); + return targetShape; + }(); if (!allDequantizationShiftAreZero) { auto subtractInput = dequantization.subtract == nullptr ? @@ -132,13 +148,15 @@ bool ConcatTransformation::transform(TransformationContext& context, ov::pass::p deqPrecision), targetShape, std::vector({ 0.f })) : - broadcastElementWiseConst(dequantization.subtractConstant, targetShape); + adaptConstForConcatenation(dequantization.subtractConstant, targetShape); if (allDequantizationShiftConvertAreNotZero) { if (subtractConvert == nullptr && dequantization.subtractConvert != nullptr) { subtractConvert = dequantization.subtractConvert; } } else if (dequantization.subtractConvert != nullptr) { - subtractInput = foldConvert(subtractInput, dequantization.subtractConvert->get_convert_element_type()); + const auto& dstType = dequantization.subtractConvert->get_convert_element_type(); + subtractInput = ov::as_type_ptr(foldConvert(subtractInput, dstType)); + OPENVINO_ASSERT(subtractInput, "foldConvert must finish successfully for the concatenated subtract constant"); NetworkHelper::copyInfo(dequantization.subtractConvert, subtractInput); } subConstants.push_back(subtractInput); @@ -147,7 +165,7 @@ bool ConcatTransformation::transform(TransformationContext& context, ov::pass::p if (!allDequantizationMultiplyAreZero) { mulConstants.push_back(dequantization.multiply == nullptr ? std::make_shared(deqPrecision, targetShape, std::vector({ 1.0f })) : - broadcastElementWiseConst(dequantization.multiplyConstant, targetShape)); + adaptConstForConcatenation(dequantization.multiplyConstant, targetShape)); } } @@ -162,10 +180,31 @@ bool ConcatTransformation::transform(TransformationContext& context, ov::pass::p lastDequantization = convert; } + auto concat_constants_if_needed = [&](const ConstVector& constants) -> std::shared_ptr { + OPENVINO_ASSERT(!constants.empty(), "concat_constants_if_needed expects non empty constants vec"); + if (constants.size() == 1ul) { + return constants[0]; + } + if (scalar_equal_constants_requested) { + if (ov::shape_size(constants[0]->get_shape()) == 1) { + const auto ref_value = constants[0]->cast_vector(); + if (std::all_of(constants.cbegin() + 1, constants.cend(), [&ref_value](const auto& constant) { + return constant->template cast_vector() == ref_value; + })) { + return constants[0]; + } + } + OPENVINO_THROW("in case of dynamic concatenation dim all constants must be scalar and equal"); + } + ov::OutputVector concatInputs; + std::transform(constants.begin(), constants.end(), std::back_inserter(concatInputs), [](const auto& constant) { + return constant->output(0); + }); + return fold(concatInputs, axis); + }; + if (!subConstants.empty()) { - std::shared_ptr subtractNode = subConstants.size() == 1ul ? - subConstants[0] : - ov::pass::low_precision::fold(subConstants, axis); + auto subtractNode = concat_constants_if_needed(subConstants); if (subtractConvert != nullptr) subtractNode = subtractConvert->clone_with_new_inputs({subtractNode}); const auto subtract = std::make_shared( @@ -181,9 +220,7 @@ bool ConcatTransformation::transform(TransformationContext& context, ov::pass::p const auto multiply = std::make_shared>( opset1::Multiply( lastDequantization, - NetworkHelper::toScalarIfPossible(mulConstants.size() == 1ul ? - mulConstants[0] : - ov::pass::low_precision::fold(mulConstants, axis))), + NetworkHelper::toScalarIfPossible(concat_constants_if_needed(mulConstants))), layerDequantizations[0].multiply->get_output_element_type(0)); NetworkHelper::copyInfo({ concat, multiply }, multiply); @@ -193,7 +230,7 @@ bool ConcatTransformation::transform(TransformationContext& context, ov::pass::p NetworkHelper::insertDequantizationAfter(concat, lastDequantization, newConcat); NetworkHelper::copyInfo(concat, newConcat); - updateOutput(context, lastDequantization, newConcat); + updateOutput(lastDequantization, newConcat); OPENVINO_DEBUG("LPT: done: ", newConcat); return true; @@ -203,7 +240,7 @@ bool ConcatTransformation::isPrecisionPreserved(std::shared_ptr) const noe return true; } -bool ConcatTransformation::canBeTransformed(const TransformationContext& context, std::shared_ptr layer) const { +bool ConcatTransformation::canBeTransformed(const std::shared_ptr& layer) const { std::shared_ptr concat = ov::as_type_ptr(layer); if (concat == nullptr) { return false; @@ -216,9 +253,32 @@ bool ConcatTransformation::canBeTransformed(const TransformationContext& context return false; } + auto base_dq_check = [&](const FakeQuantizeDequantization& dequantization) { + return !dequantization.empty() && (!updatePrecisions || dequantization.isLowPrecision()); + }; + const size_t normalizedAxis = ov::util::try_normalize_axis(axis, outRank, *concat); if (outPShape[normalizedAxis].is_dynamic()) { - return false; + // in case of dynamic dimension we can propagate all dequantizations only if they are all scalar and equal, + // since DQ broadcast is impossible (requested shape is unknown), and only single scalar DQ after Concat can be set + const auto dequantization_ref = NetworkHelper::getDequantization(concat, defaultPrecisions, 0); + if (!base_dq_check(dequantization_ref) || !dequantization_ref.isPerTensor()) + return false; + + auto extract_values = [](const std::shared_ptr& constant) { + return constant ? constant->cast_vector() : std::vector(); + }; + const auto ref_shifts = extract_values(dequantization_ref.subtractConstant); + const auto ref_scales = extract_values(dequantization_ref.multiplyConstant); + + for (size_t i = 1ul; i < concat->get_input_size(); i++) { + const auto cur_dequantization = NetworkHelper::getDequantization(concat, defaultPrecisions, i); + if (!base_dq_check(dequantization_ref) || + ref_shifts != extract_values(cur_dequantization.subtractConstant) || + ref_scales != extract_values(cur_dequantization.multiplyConstant)) + return false; + } + return true; } auto checkConstShape = [&normalizedAxis, &outRank](const std::shared_ptr& constant) { @@ -235,7 +295,6 @@ bool ConcatTransformation::canBeTransformed(const TransformationContext& context }; const auto check_const_precision = []( - const FakeQuantizeDequantization& dequantization, const std::shared_ptr& constant, ov::element::Type& const_precision) { if (constant == nullptr) { @@ -253,9 +312,8 @@ bool ConcatTransformation::canBeTransformed(const TransformationContext& context for (size_t i = 0ul; i < concat->get_input_size(); i++) { const FakeQuantizeDequantization dequantization = NetworkHelper::getDequantization(concat, defaultPrecisions, i); - if (dequantization.empty() || (updatePrecisions && !dequantization.isLowPrecision())) { + if (!base_dq_check(dequantization)) return false; - } if (((dequantization.subtract != nullptr) && (!checkConstShape(dequantization.subtractConstant))) || ((dequantization.multiply != nullptr) && (!checkConstShape(dequantization.multiplyConstant)))) { @@ -268,9 +326,9 @@ bool ConcatTransformation::canBeTransformed(const TransformationContext& context return false; } - if (!check_const_precision(dequantization, dequantization.subtractConvert, const_precision) || - ((dequantization.subtractConvert == nullptr) && !check_const_precision(dequantization, dequantization.subtractConstant, const_precision)) || - !check_const_precision(dequantization, dequantization.multiplyConstant, const_precision)) { + if (!check_const_precision(dequantization.subtractConvert, const_precision) || + ((dequantization.subtractConvert == nullptr) && !check_const_precision(dequantization.subtractConstant, const_precision)) || + !check_const_precision(dequantization.multiplyConstant, const_precision)) { return false; } } diff --git a/src/common/low_precision_transformations/src/convert.cpp b/src/common/low_precision_transformations/src/convert.cpp index 4b773fc67c52c1..f1a7ae83e1dd73 100644 --- a/src/common/low_precision_transformations/src/convert.cpp +++ b/src/common/low_precision_transformations/src/convert.cpp @@ -31,20 +31,20 @@ ConvertTransformation::ConvertTransformation(const Params& params) : LayerTransf if (transformation_callback(op)) { return false; } - return transform(*context, m); + return transform(m); }; auto m = std::make_shared(matcher, matcher_name); this->register_matcher(m, callback); } -bool ConvertTransformation::transform(TransformationContext& context, ov::pass::pattern::Matcher &m) { +bool ConvertTransformation::transform(ov::pass::pattern::Matcher &m) { std::shared_ptr convert = ov::as_type_ptr(m.get_match_root()); if (!convert) { return false; } - if (!canBeTransformed(context, convert)) { + if (!canBeTransformed(convert)) { return false; } diff --git a/src/common/low_precision_transformations/src/convolution.cpp b/src/common/low_precision_transformations/src/convolution.cpp index ebf75e450f6384..ab9ed1e133d4b3 100644 --- a/src/common/low_precision_transformations/src/convolution.cpp +++ b/src/common/low_precision_transformations/src/convolution.cpp @@ -39,7 +39,7 @@ ConvolutionTransformation::ConvolutionTransformation(const Params& params) : Wei if (transformation_callback(op)) { return false; } - return transform(*context, m); + return transform(m); }; auto m = std::make_shared(matcher, matcher_name); @@ -62,10 +62,10 @@ size_t ConvolutionTransformation::getInputChannels(const std::shared_ptrget_input_node_shared_ptr(1); const auto reshapeFromWeights = ov::as_type_ptr(weightInput); FakeQuantizeDequantization dequantization = reshapeFromWeights == nullptr ? @@ -97,7 +97,7 @@ bool ConvolutionTransformation::transform(TransformationContext &context, ov::pa auto newFQ = std::get<1>(res_tuple); auto dequantize = std::get<2>(res_tuple); if (newFQ != nullptr && dequantize != nullptr) - updateOutput(context, dequantize, newFQ); + updateOutput(dequantize, newFQ); if (updatePrecisions && !fqOnWeightsWasDecomposed) { return false; @@ -338,7 +338,7 @@ bool ConvolutionTransformation::transform(TransformationContext &context, ov::pa const auto finalDequantization = NetworkHelper::optimizeMultipliesAfter(newMultiplyAfter); ov::copy_runtime_info({ convolution, finalDequantization }, finalDequantization); - updateOutput(context, finalDequantization, convolution); + updateOutput(finalDequantization, convolution); const auto onActiviation = convolution->get_input_node_shared_ptr(0); if (ov::is_type(onActiviation)) { diff --git a/src/common/low_precision_transformations/src/convolution_backprop_data.cpp b/src/common/low_precision_transformations/src/convolution_backprop_data.cpp index 25abd4061ca4d3..5017abd3486071 100644 --- a/src/common/low_precision_transformations/src/convolution_backprop_data.cpp +++ b/src/common/low_precision_transformations/src/convolution_backprop_data.cpp @@ -51,7 +51,7 @@ ConvolutionBackpropDataTransformation::ConvolutionBackpropDataTransformation(con if (transformation_callback(op)) { return false; } - return transform(*context, m); + return transform(m); }; auto m = std::make_shared(matcher, matcher_name); @@ -74,10 +74,10 @@ size_t ConvolutionBackpropDataTransformation::getInputChannels(const std::shared return channels.get_length(); } -bool ConvolutionBackpropDataTransformation::transform(TransformationContext &context, ov::pass::pattern::Matcher &m) { +bool ConvolutionBackpropDataTransformation::transform(ov::pass::pattern::Matcher &m) { auto convolutionBackpropData = m.get_match_root(); - if (!canBeTransformed(context, convolutionBackpropData)) { + if (!canBeTransformed(convolutionBackpropData)) { auto weightsInput = convolutionBackpropData->get_input_node_shared_ptr(1); std::shared_ptr reshapeFromWeights = ov::as_type_ptr(weightsInput); FakeQuantizeDequantization dequantization = reshapeFromWeights == nullptr ? @@ -149,7 +149,7 @@ bool ConvolutionBackpropDataTransformation::transform(TransformationContext &con auto newFQ = std::get<1>(res_tuple); auto dequantize = std::get<2>(res_tuple); if (newFQ != nullptr && dequantize != nullptr) - updateOutput(context, dequantize, newFQ); + updateOutput(dequantize, newFQ); dequantization = NetworkHelper::getDequantization(convolutionBackpropData, defaultPrecisions, 1ul); @@ -225,7 +225,7 @@ bool ConvolutionBackpropDataTransformation::transform(TransformationContext &con const auto finalDequantization = NetworkHelper::optimizeMultipliesAfter(newMultiplyAfter); ov::copy_runtime_info({ convolutionBackpropData, finalDequantization }, finalDequantization); - updateOutput(context, finalDequantization, convolutionBackpropData); + updateOutput(finalDequantization, convolutionBackpropData); const auto onActiviation = convolutionBackpropData->get_input_node_shared_ptr(0); if (ov::is_type(onActiviation)) { @@ -245,8 +245,8 @@ bool ConvolutionBackpropDataTransformation::transform(TransformationContext &con return true; } -bool ConvolutionBackpropDataTransformation::canBeTransformed(const TransformationContext& context, std::shared_ptr op) const { - return canConvolutionBeTransformed(context, op, defaultPrecisions); +bool ConvolutionBackpropDataTransformation::canBeTransformed(const std::shared_ptr& op) const { + return canConvolutionBeTransformed(op, defaultPrecisions); } } // namespace low_precision diff --git a/src/common/low_precision_transformations/src/depth_to_space.cpp b/src/common/low_precision_transformations/src/depth_to_space.cpp index eb518d62202840..941ac308c0b5b9 100644 --- a/src/common/low_precision_transformations/src/depth_to_space.cpp +++ b/src/common/low_precision_transformations/src/depth_to_space.cpp @@ -20,15 +20,15 @@ DepthToSpaceTransformation::DepthToSpaceTransformation(const Params& params) : T if (transformation_callback(op)) { return false; } - return transform(*context, m); + return transform(m); }; auto m = std::make_shared(matcher, matcher_name); this->register_matcher(m, callback); } -bool DepthToSpaceTransformation::canBeTransformed(const TransformationContext& context, std::shared_ptr layer) const { - if (!LayerTransformation::canBeTransformed(context, layer)) { +bool DepthToSpaceTransformation::canBeTransformed(const std::shared_ptr& layer) const { + if (!LayerTransformation::canBeTransformed(layer)) { return false; } diff --git a/src/common/low_precision_transformations/src/eliminate_fake_quantize.cpp b/src/common/low_precision_transformations/src/eliminate_fake_quantize.cpp index cb5d9270a43768..88e544aa238714 100644 --- a/src/common/low_precision_transformations/src/eliminate_fake_quantize.cpp +++ b/src/common/low_precision_transformations/src/eliminate_fake_quantize.cpp @@ -30,16 +30,16 @@ EliminateFakeQuantizeTransformation::EliminateFakeQuantizeTransformation(const P if (transformation_callback(op)) { return false; } - return transform(*context, m); + return transform(m); }; const auto m = std::make_shared(matcher, matcher_name); this->register_matcher(m, callback); } -bool EliminateFakeQuantizeTransformation::transform(TransformationContext& context, ov::pass::pattern::Matcher& m) { +bool EliminateFakeQuantizeTransformation::transform(ov::pass::pattern::Matcher& m) { const auto root = m.get_match_root(); - if (!canBeTransformed(context, root)) { + if (!canBeTransformed(root)) { return false; } @@ -51,7 +51,7 @@ bool check_interval(const std::shared_ptr& fq, const std::shared_ptr& constant, const float value, const float max_diff, - const bool exact_comparison) noexcept { + const bool exact_comparison) { bool need_to_check_intervals = false; const auto& constant_values = constant->cast_vector(); for (const auto constant_value : constant_values) { @@ -115,8 +115,8 @@ bool check_intervals(const std::shared_ptr& fakeQuanti } } // namespace -bool EliminateFakeQuantizeTransformation::canBeTransformed(const TransformationContext& context, std::shared_ptr operation) const { - if (!CleanupTransformation::canBeTransformed(context, operation)) { +bool EliminateFakeQuantizeTransformation::canBeTransformed(const std::shared_ptr& operation) const { + if (!CleanupTransformation::canBeTransformed(operation)) { return false; } diff --git a/src/common/low_precision_transformations/src/eltwise_base_transformation.cpp b/src/common/low_precision_transformations/src/eltwise_base_transformation.cpp index f7cf7033543b40..f5594fc9fcf8cb 100644 --- a/src/common/low_precision_transformations/src/eltwise_base_transformation.cpp +++ b/src/common/low_precision_transformations/src/eltwise_base_transformation.cpp @@ -33,8 +33,8 @@ bool EltwiseBaseTransformation::isBroadcasted(const PartialShape& shape) { return true; } -bool EltwiseBaseTransformation::canBeTransformed(const TransformationContext& context, std::shared_ptr operation) const { - if (!LayerTransformation::canBeTransformed(context, operation)) { +bool EltwiseBaseTransformation::canBeTransformed(const std::shared_ptr& operation) const { + if (!LayerTransformation::canBeTransformed(operation)) { return false; } diff --git a/src/common/low_precision_transformations/src/fake_quantize.cpp b/src/common/low_precision_transformations/src/fake_quantize.cpp index 8f3f8835ece8b0..4bfb24a57abd65 100644 --- a/src/common/low_precision_transformations/src/fake_quantize.cpp +++ b/src/common/low_precision_transformations/src/fake_quantize.cpp @@ -28,14 +28,14 @@ FakeQuantizeTransformation::FakeQuantizeTransformation(const Params& params) : L return false; } - return transform(*context, m); + return transform(m); }; auto m = std::make_shared(matcher, matcher_name); this->register_matcher(m, callback); } -bool FakeQuantizeTransformation::transform(TransformationContext& context, ov::pass::pattern::Matcher &m) { +bool FakeQuantizeTransformation::transform(ov::pass::pattern::Matcher &m) { const auto layer = ov::as_type_ptr(m.get_match_root()); if (!layer || !QuantizationDetails::outputLayoutIsSupported(layer)) { return false; @@ -44,7 +44,7 @@ bool FakeQuantizeTransformation::transform(TransformationContext& context, ov::p bool wasHandled = false; std::shared_ptr fakeQuantize = layer; do { - fakeQuantize = fuseElementwise(context, this, fakeQuantize, updatePrecisions); + fakeQuantize = fuseElementwise(this, fakeQuantize, updatePrecisions); wasHandled = wasHandled || (fakeQuantize != nullptr); } while (fakeQuantize != nullptr); @@ -158,7 +158,6 @@ bool FakeQuantizeTransformation::checkElementwise(const std::shared_ptr& e } std::shared_ptr FakeQuantizeTransformation::fuseElementwise( - TransformationContext& context, MatcherPass* matcherPass, const std::shared_ptr& fakeQuantize, const bool updatePrecisions) { diff --git a/src/common/low_precision_transformations/src/fake_quantize_decomposition.cpp b/src/common/low_precision_transformations/src/fake_quantize_decomposition.cpp index d4345aef1aaccd..32040b06f80fba 100644 --- a/src/common/low_precision_transformations/src/fake_quantize_decomposition.cpp +++ b/src/common/low_precision_transformations/src/fake_quantize_decomposition.cpp @@ -32,7 +32,7 @@ FakeQuantizeDecompositionTransformation::FakeQuantizeDecompositionTransformation return false; } - return transform(*context, m); + return transform(m); }; auto m = std::make_shared(matcher, matcher_name); @@ -276,7 +276,7 @@ std::tuple, std::shared_ptr> decomposeFakeQuantize( } // namespace } // namespace fq_decomposition -bool FakeQuantizeDecompositionTransformation::transform(TransformationContext& context, ov::pass::pattern::Matcher& m) { +bool FakeQuantizeDecompositionTransformation::transform(ov::pass::pattern::Matcher& m) { auto node = ov::as_type_ptr(m.get_match_root()); if (!node || !NetworkHelper::isQuantizeSupported(node)) { return false; @@ -427,7 +427,7 @@ bool FakeQuantizeDecompositionTransformation::transform(TransformationContext& c return rewritten; } - updateOutput(context, dequantize, newFakeQuantize); + updateOutput(dequantize, newFakeQuantize); if (precisionsAttribute.value().size() != 1ul) { precisionsAttribute.value() = { dataPrecision.precision }; diff --git a/src/common/low_precision_transformations/src/fake_quantize_dequantization.cpp b/src/common/low_precision_transformations/src/fake_quantize_dequantization.cpp index a96a5032b5fef9..7246c9869ce7d8 100644 --- a/src/common/low_precision_transformations/src/fake_quantize_dequantization.cpp +++ b/src/common/low_precision_transformations/src/fake_quantize_dequantization.cpp @@ -32,9 +32,6 @@ FakeQuantizeDequantization::FakeQuantizeDequantization( subtractConstant(subtractConstant), multiply(multiply), multiplyConstant(multiplyConstant) { - // for most node with layout NC, NCHW, NCDWH, index of channel dimension is 1 - channelDimIndex = 1ul; - const auto rank = data.get_partial_shape().rank(); if (rank.is_static()) { std::string data_src_type = data.get_node()->get_type_name(); diff --git a/src/common/low_precision_transformations/src/fold_convert.cpp b/src/common/low_precision_transformations/src/fold_convert.cpp index 2308bcc936e220..e5e3a361c2f483 100644 --- a/src/common/low_precision_transformations/src/fold_convert.cpp +++ b/src/common/low_precision_transformations/src/fold_convert.cpp @@ -24,15 +24,15 @@ FoldConvertTransformation::FoldConvertTransformation(const Params& params) : Cle if (transformation_callback(op)) { return false; } - return transform(*context, m); + return transform(m); }; this->register_matcher(matcher, callback); } -bool FoldConvertTransformation::transform(TransformationContext& context, ov::pass::pattern::Matcher &m) { +bool FoldConvertTransformation::transform(ov::pass::pattern::Matcher &m) { const auto subtract = m.get_match_root(); - if (!canBeTransformed(context, subtract)) { + if (!canBeTransformed(subtract)) { return false; } @@ -46,7 +46,7 @@ bool FoldConvertTransformation::transform(TransformationContext& context, ov::pa assert(ov::is_type(resultConstant)); replace_node(convert, resultConstant); - updateOutput(context, resultConstant, convert); + updateOutput(resultConstant, convert); }; foldConvert(0ul); @@ -55,9 +55,9 @@ bool FoldConvertTransformation::transform(TransformationContext& context, ov::pa return true; } -bool FoldConvertTransformation::canBeTransformed(const TransformationContext& context, std::shared_ptr operation) const { +bool FoldConvertTransformation::canBeTransformed(const std::shared_ptr& operation) const { return - CleanupTransformation::canBeTransformed(context, operation) && + CleanupTransformation::canBeTransformed(operation) && ((ov::is_type(operation->get_input_node_ptr(1)) && ov::is_type(operation->get_input_node_ptr(1)->get_input_node_ptr(0))) || (ov::is_type(operation->get_input_node_ptr(0)) && diff --git a/src/common/low_precision_transformations/src/fold_fake_quantize.cpp b/src/common/low_precision_transformations/src/fold_fake_quantize.cpp index 2f275ccb995c4f..3963c1eea20ef1 100644 --- a/src/common/low_precision_transformations/src/fold_fake_quantize.cpp +++ b/src/common/low_precision_transformations/src/fold_fake_quantize.cpp @@ -26,20 +26,20 @@ FoldFakeQuantizeTransformation::FoldFakeQuantizeTransformation(const Params& par if (transformation_callback(op)) { return false; } - return transform(*context, m); + return transform(m); }; auto m = std::make_shared(fakeQuantize, matcher_name); this->register_matcher(m, callback); } -bool FoldFakeQuantizeTransformation::transform(TransformationContext& context, ov::pass::pattern::Matcher &m) { +bool FoldFakeQuantizeTransformation::transform(ov::pass::pattern::Matcher &m) { const auto fakeQuantize = ov::as_type_ptr(m.get_match_root()); if (fakeQuantize == nullptr) { return false; } - if (!canBeTransformed(context, fakeQuantize)) { + if (!canBeTransformed(fakeQuantize)) { return false; } @@ -76,7 +76,7 @@ bool FoldFakeQuantizeTransformation::isConstantOutput(std::shared_ptr return vecLow == vecHigh; } -bool FoldFakeQuantizeTransformation::canBeTransformed(const TransformationContext& context, std::shared_ptr op) const { +bool FoldFakeQuantizeTransformation::canBeTransformed(const std::shared_ptr& op) const { if (!NetworkHelper::isConstantPath(op) && !isConstantOutput(op)) { return false; } diff --git a/src/common/low_precision_transformations/src/fuse_convert.cpp b/src/common/low_precision_transformations/src/fuse_convert.cpp index bda3cd8b3d38c8..889233c03236b6 100644 --- a/src/common/low_precision_transformations/src/fuse_convert.cpp +++ b/src/common/low_precision_transformations/src/fuse_convert.cpp @@ -40,7 +40,7 @@ FuseConvertTransformation::FuseConvertTransformation(const Params& params) : Cle if (transformation_callback(op)) { return false; } - return transform(*context, m); + return transform(m); }; this->register_matcher(matcher, callback); @@ -68,9 +68,9 @@ std::shared_ptr removeConvertIfPossibleForSubtract( } // namespace -bool FuseConvertTransformation::transform(TransformationContext& context, ov::pass::pattern::Matcher &m) { +bool FuseConvertTransformation::transform(ov::pass::pattern::Matcher &m) { const auto op = m.get_match_root(); - if (!canBeTransformed(context, op)) { + if (!canBeTransformed(op)) { return false; } @@ -114,8 +114,8 @@ bool FuseConvertTransformation::transform(TransformationContext& context, ov::pa return true; } -bool FuseConvertTransformation::canBeTransformed(const TransformationContext& context, std::shared_ptr op) const { - if (!CleanupTransformation::canBeTransformed(context, op)) { +bool FuseConvertTransformation::canBeTransformed(const std::shared_ptr& op) const { + if (!CleanupTransformation::canBeTransformed(op)) { return false; } diff --git a/src/common/low_precision_transformations/src/fuse_elementwise_to_fake_quantize.cpp b/src/common/low_precision_transformations/src/fuse_elementwise_to_fake_quantize.cpp index e9418da055c929..5f8d9be15eb20b 100644 --- a/src/common/low_precision_transformations/src/fuse_elementwise_to_fake_quantize.cpp +++ b/src/common/low_precision_transformations/src/fuse_elementwise_to_fake_quantize.cpp @@ -15,8 +15,8 @@ namespace low_precision { FuseElementwiseToFakeQuantizeTransformation::FuseElementwiseToFakeQuantizeTransformation(const Params& params) : CleanupTransformation(params) { } -bool FuseElementwiseToFakeQuantizeTransformation::canBeTransformed(const TransformationContext& context, std::shared_ptr operation) const { - if (!CleanupTransformation::canBeTransformed(context, operation)) { +bool FuseElementwiseToFakeQuantizeTransformation::canBeTransformed(const std::shared_ptr& operation) const { + if (!CleanupTransformation::canBeTransformed(operation)) { return false; } diff --git a/src/common/low_precision_transformations/src/fuse_multiply_to_fake_quantize.cpp b/src/common/low_precision_transformations/src/fuse_multiply_to_fake_quantize.cpp index 56d67cb2edcbab..6b77e42f581af0 100644 --- a/src/common/low_precision_transformations/src/fuse_multiply_to_fake_quantize.cpp +++ b/src/common/low_precision_transformations/src/fuse_multiply_to_fake_quantize.cpp @@ -25,16 +25,16 @@ FuseMultiplyToFakeQuantizeTransformation::FuseMultiplyToFakeQuantizeTransformati if (transformation_callback(op)) { return false; } - return transform(*context, m); + return transform(m); }; auto m = std::make_shared(matcher, matcher_name); this->register_matcher(m, callback); } -bool FuseMultiplyToFakeQuantizeTransformation::transform(TransformationContext& context, ov::pass::pattern::Matcher &m) { +bool FuseMultiplyToFakeQuantizeTransformation::transform(ov::pass::pattern::Matcher &m) { const auto multiply = m.get_match_root(); - if (!canBeTransformed(context, multiply)) { + if (!canBeTransformed(multiply)) { return false; } @@ -86,7 +86,7 @@ bool FuseMultiplyToFakeQuantizeTransformation::transform(TransformationContext& newFakeQuantize->set_levels(intervalAlignment.as().levels); } - updateOutput(context, newFakeQuantize, multiply); + updateOutput(newFakeQuantize, multiply); return true; } diff --git a/src/common/low_precision_transformations/src/fuse_subtract_to_fake_quantize.cpp b/src/common/low_precision_transformations/src/fuse_subtract_to_fake_quantize.cpp index 61603cc8826713..73862fc856a944 100644 --- a/src/common/low_precision_transformations/src/fuse_subtract_to_fake_quantize.cpp +++ b/src/common/low_precision_transformations/src/fuse_subtract_to_fake_quantize.cpp @@ -25,16 +25,16 @@ FuseSubtractToFakeQuantizeTransformation::FuseSubtractToFakeQuantizeTransformati if (transformation_callback(op)) { return false; } - return transform(*context, m); + return transform(m); }; auto m = std::make_shared(matcher, matcher_name); this->register_matcher(m, callback); } -bool FuseSubtractToFakeQuantizeTransformation::transform(TransformationContext& context, ov::pass::pattern::Matcher &m) { +bool FuseSubtractToFakeQuantizeTransformation::transform(ov::pass::pattern::Matcher &m) { const auto subtract = m.get_match_root(); - if (!canBeTransformed(context, subtract)) { + if (!canBeTransformed(subtract)) { return false; } @@ -81,7 +81,7 @@ bool FuseSubtractToFakeQuantizeTransformation::transform(TransformationContext& replace_node(subtract, newFakeQuantize); NetworkHelper::copyInfo(fakeQuantize, newFakeQuantize); - updateOutput(context, newFakeQuantize, subtract); + updateOutput(newFakeQuantize, subtract); return true; } diff --git a/src/common/low_precision_transformations/src/gather.cpp b/src/common/low_precision_transformations/src/gather.cpp index 1a8aa377cff2aa..437fae10ec0d1d 100644 --- a/src/common/low_precision_transformations/src/gather.cpp +++ b/src/common/low_precision_transformations/src/gather.cpp @@ -1,4 +1,4 @@ -// Copyright (C) 2018-2022 Intel Corporation +// Copyright (C) 2018-2025 Intel Corporation // SPDX-License-Identifier: Apache-2.0 // @@ -95,16 +95,16 @@ GatherTransformation::GatherTransformation(const Params& params) : LayerTransfor if (transformation_callback(op)) { return false; } - return transform(*context, m); + return transform(m); }; auto m = std::make_shared(gather, matcher_name); this->register_matcher(m, callback); } -bool GatherTransformation::transform(TransformationContext& context, ov::pass::pattern::Matcher &m) { +bool GatherTransformation::transform(ov::pass::pattern::Matcher &m) { auto node = m.get_match_root(); - if (!canBeTransformed(context, m.get_match_root())) { + if (!canBeTransformed(m.get_match_root())) { return false; } @@ -120,14 +120,14 @@ bool GatherTransformation::transform(TransformationContext& context, ov::pass::p replace_node(dequantization.subtractConstant, newConstant); } - const auto newOperation = moveDequantizationAfter(context, gather, NetworkHelper::getDequantization(gather, defaultPrecisions)); + const auto newOperation = moveDequantizationAfter(gather, NetworkHelper::getDequantization(gather, defaultPrecisions)); OPENVINO_DEBUG("LPT: done: ", newOperation); return true; } -bool GatherTransformation::canBeTransformed(const TransformationContext& context, std::shared_ptr operation) const { - if (!LayerTransformation::canBeTransformed(context, operation)) { +bool GatherTransformation::canBeTransformed(const std::shared_ptr& operation) const { + if (!LayerTransformation::canBeTransformed(operation)) { return false; } diff --git a/src/common/low_precision_transformations/src/group_convolution.cpp b/src/common/low_precision_transformations/src/group_convolution.cpp index 6e2f48cd10e734..feabc004f05144 100644 --- a/src/common/low_precision_transformations/src/group_convolution.cpp +++ b/src/common/low_precision_transformations/src/group_convolution.cpp @@ -25,7 +25,7 @@ GroupConvolutionTransformation::GroupConvolutionTransformation(const Params& par if (transformation_callback(op)) { return false; } - return transform(*context, m); + return transform(m); }; auto m = std::make_shared(matcher, matcher_name); @@ -37,15 +37,12 @@ bool GroupConvolutionTransformation::isQuantized(const std::shared_ptr& layer, diff --git a/src/common/low_precision_transformations/src/interpolate.cpp b/src/common/low_precision_transformations/src/interpolate.cpp index f1d9a2d505788a..5559de793500e6 100644 --- a/src/common/low_precision_transformations/src/interpolate.cpp +++ b/src/common/low_precision_transformations/src/interpolate.cpp @@ -46,7 +46,7 @@ InterpolateTransformation::InterpolateTransformation(const Params& params) : Lay if (transformation_callback(op)) { return false; } - return transform(*context, m); + return transform(m); }; auto matcher = std::make_shared( @@ -56,13 +56,13 @@ InterpolateTransformation::InterpolateTransformation(const Params& params) : Lay this->register_matcher(matcher, callback); } -bool InterpolateTransformation::transform(TransformationContext &context, ov::pass::pattern::Matcher &m) { +bool InterpolateTransformation::transform(ov::pass::pattern::Matcher &m) { std::shared_ptr interpolate = m.get_match_root(); - if (!canBeTransformed(context, m.get_match_root())) { + if (!canBeTransformed(m.get_match_root())) { return false; } interpolate = NetworkHelper::separateInStandaloneBranch(interpolate, defaultPrecisions); - const auto newOperation = moveDequantizationAfter(context, interpolate, NetworkHelper::getDequantization(interpolate, defaultPrecisions)); + const auto newOperation = moveDequantizationAfter(interpolate, NetworkHelper::getDequantization(interpolate, defaultPrecisions)); OPENVINO_DEBUG("LPT: done: ", newOperation); return true; @@ -84,8 +84,8 @@ bool InterpolateTransformation::isPrecisionPreserved(std::shared_ptr layer return false; } -bool InterpolateTransformation::canBeTransformed(const TransformationContext& context, std::shared_ptr layer) const { - if (!LayerTransformation::canBeTransformed(context, layer)) { +bool InterpolateTransformation::canBeTransformed(const std::shared_ptr& layer) const { + if (!LayerTransformation::canBeTransformed(layer)) { return false; } diff --git a/src/common/low_precision_transformations/src/layer_transformation.cpp b/src/common/low_precision_transformations/src/layer_transformation.cpp index fa014a078a22d3..e7a1af82d95614 100644 --- a/src/common/low_precision_transformations/src/layer_transformation.cpp +++ b/src/common/low_precision_transformations/src/layer_transformation.cpp @@ -45,22 +45,9 @@ LayerTransformation::LayerTransformation(const Params& params) : deqPrecision(params.deqPrecision), defaultPrecisions(params.defaultPrecisions), reshapeIgnorePerTensorQuantizationCheck(params.reshapeIgnorePerTensorQuantizationCheck), - scalingMode(params.scalingMode), - context(nullptr) {} + scalingMode(params.scalingMode) {} -void LayerTransformation::setContext(TransformationContext* context) noexcept { - this->context = context; -} - -void LayerTransformation::setUpdatePrecisions(const bool updatePrecisions) { - this->updatePrecisions = updatePrecisions; -} - -void LayerTransformation::setDefaultPrecisions(const std::vector& defaultPrecisions) { - this->defaultPrecisions = defaultPrecisions; -} - -bool LayerTransformation::canBeTransformed(const TransformationContext& context, std::shared_ptr layer) const { +bool LayerTransformation::canBeTransformed(const std::shared_ptr& layer) const { if (!isQuantized(layer, defaultPrecisions)) { return false; } @@ -126,7 +113,7 @@ bool LayerTransformation::canBeTransformedStatic(const std::shared_ptr& la return true; } -bool LayerTransformation::canBeTransformedSpatialDimension(const TransformationContext& context, std::shared_ptr layer) const { +bool LayerTransformation::canBeTransformedSpatialDimension(const std::shared_ptr& layer) const { if (!isQuantized(layer, defaultPrecisions)) { OPENVINO_DEBUG("LPT: early exit: not quantized"); return false; @@ -397,7 +384,6 @@ DataPrecision LayerTransformation::getDataPrecision( } std::shared_ptr LayerTransformation::moveDequantizationAfter( - TransformationContext &context, const std::shared_ptr& operation, const FakeQuantizeDequantization& dequantization, const bool updateOutputPrecision, @@ -408,31 +394,28 @@ std::shared_ptr LayerTransformation::moveDequantizationAfter( updateOutputPrecision, moveSubtract, defaultPrecisions); - updateOutput(context, result.lastDequantization, result.newOperation); + updateOutput(result.lastDequantization, result.newOperation); return result.newOperation; } std::shared_ptr LayerTransformation::moveDequantizationBefore( - TransformationContext& context, const std::shared_ptr& operation, const FakeQuantizeDequantization& dequantization, const bool moveSubtract) const { const auto result = ov::pass::low_precision::NetworkHelper::moveDequantizationBefore(operation, dequantization, moveSubtract); - updateOutput(context, result.newOperation, result.lastDequantization); + updateOutput(result.newOperation, result.lastDequantization); return result.newOperation; } -bool LayerTransformation::updateOutput( - TransformationContext &context, - std::shared_ptr lastNode, - std::shared_ptr originalNode) const { +bool LayerTransformation::updateOutput(const std::shared_ptr& lastNode, + const std::shared_ptr& originalNode) const { bool was_updated = false; for (auto output : lastNode->outputs()) { for (auto input : output.get_target_inputs()) { if (ov::is_type(input.get_node())) { - const std::string originalName = originalNode->get_friendly_name(); + const auto originalName = originalNode->get_friendly_name(); originalNode->set_friendly_name(originalName + LayerTransformation::originalLayerPostfix); lastNode->set_friendly_name(originalName); was_updated = true; @@ -442,61 +425,6 @@ bool LayerTransformation::updateOutput( } return was_updated; } - -void LayerTransformation::updateOutput( - TransformationContext& context, - std::shared_ptr lastNode, - std::string originalName) const { - const size_t outputSize = context.model->get_output_size(); - for (size_t i = 0; i < outputSize; ++i) { - std::shared_ptr result = context.model->get_output_op(i); - std::shared_ptr outputNode = result->get_input_node_shared_ptr(0); - if (outputNode.get() == lastNode.get()) { - lastNode->set_friendly_name(originalName); - break; - } - } -} - -void LayerTransformation::addPattern(ov::pass::GraphRewrite& pass, TransformationContext& context, std::shared_ptr patternRoot) { - MATCHER_SCOPE(SingleNodeMatcher); - ov::graph_rewrite_callback internal_callback = [this, &context](ov::pass::pattern::Matcher &m) { - const bool result = transform(context, m); - (void)result; -#ifdef LPT_DISPLAY_PRECISION - if (result) { - auto operationNode = m.get_match_root(); - std::cout << "Operation was transformed: " << - operationNode->get_type_name() << ", " << - operationNode->get_friendly_name() << ", output operation precision: " << - ((operationNode->get_output_size() == 1u) ? operationNode->get_output_element_type(0) : ov::element::Type()) << - std::endl; - } -#endif - return false; - }; - // TODO: better name for matcher? required? - auto m = std::make_shared(patternRoot, matcher_name); - auto match_pass = std::make_shared( - m->get_name(), - m, - [m, internal_callback](const std::shared_ptr& node) -> bool { - OPENVINO_DEBUG("Running matcher ", m->get_name(), " on ", node); - OV_PASS_CALLBACK(m); - if (std::dynamic_pointer_cast(m)->match(node->output(0))) { - OPENVINO_DEBUG("Matcher ", m->get_name(), " matched ", node); - bool status = internal_callback(*m.get()); - // explicitly clear Matcher state because it holds pointers to matched nodes - m->clear_state(); - return status; - } - m->clear_state(); - return false; - }, - ov::pass::PassProperty::CHANGE_DYNAMIC_STATE); - pass.add_matcher(match_pass); -} - } // namespace low_precision } // namespace pass } // namespace ov diff --git a/src/common/low_precision_transformations/src/markup_quantization_granularity.cpp b/src/common/low_precision_transformations/src/markup_quantization_granularity.cpp index b9d5ac2ec4dead..f59aca3498c9f0 100644 --- a/src/common/low_precision_transformations/src/markup_quantization_granularity.cpp +++ b/src/common/low_precision_transformations/src/markup_quantization_granularity.cpp @@ -30,7 +30,7 @@ ov::pass::low_precision::MarkupQuantizationGranularity::MarkupQuantizationGranul bool ov::pass::low_precision::MarkupQuantizationGranularity::run_on_model(const std::shared_ptr& f) { RUN_ON_FUNCTION_SCOPE(MarkupPerTensorQuantization); auto setRestriction = [](const std::shared_ptr& node, const std::vector& restrictedPorts) { - auto createAttribute = [](Input& input, const QuantizationGranularityAttribute::Granularity granularity){ + auto createAttribute = [](Input& input, const QuantizationGranularityAttribute::Granularity& granularity){ auto &rt = input.get_rt_info(); rt.emplace(QuantizationGranularityAttribute::get_type_info_static(), QuantizationGranularityAttribute(granularity)); }; @@ -43,14 +43,14 @@ bool ov::pass::low_precision::MarkupQuantizationGranularity::run_on_model(const } } else { // markup specific ports - for (const auto item : restrictedPorts) { + for (const auto& item : restrictedPorts) { Input input = node->input(item.port); createAttribute(input, item.granularity); } } }; - for (const std::shared_ptr& node : f->get_ordered_ops()) { + for (const auto& node : f->get_ordered_ops()) { if (node->get_input_size() == 0) { continue; } diff --git a/src/common/low_precision_transformations/src/mat_mul.cpp b/src/common/low_precision_transformations/src/mat_mul.cpp index f2d471bb222739..b153173d264a6e 100644 --- a/src/common/low_precision_transformations/src/mat_mul.cpp +++ b/src/common/low_precision_transformations/src/mat_mul.cpp @@ -32,16 +32,16 @@ MatMulTransformation::MatMulTransformation(const Params& params) : LayerTransfor if (transformation_callback(op)) { return false; } - return transform(*context, m); + return transform(m); }; auto m = std::make_shared(matcher, matcher_name); this->register_matcher(m, callback); } -bool MatMulTransformation::transform(TransformationContext &context, ov::pass::pattern::Matcher &m) { +bool MatMulTransformation::transform(ov::pass::pattern::Matcher &m) { std::shared_ptr matMul = ov::as_type_ptr(m.get_match_root()); - if ((matMul == nullptr) || !canBeTransformed(context, matMul)) { + if ((matMul == nullptr) || !canBeTransformed(matMul)) { return false; } @@ -174,7 +174,7 @@ bool MatMulTransformation::transform(TransformationContext &context, ov::pass::p NetworkHelper::insertDequantizationAfter(matMul, newMultiply, newMatMul); copy_runtime_info({ newMultiply, matMul }, newMultiply); - updateOutput(context, newMultiply, newMatMul); + updateOutput(newMultiply, newMatMul); OPENVINO_DEBUG("LPT: done: ", newMatMul); return true; @@ -184,8 +184,8 @@ bool MatMulTransformation::isPrecisionPreserved(std::shared_ptr layer) con return false; } -bool MatMulTransformation::canBeTransformed(const TransformationContext& context, std::shared_ptr layer) const { - if (!LayerTransformation::canBeTransformedSpatialDimension(context, layer)) { +bool MatMulTransformation::canBeTransformed(const std::shared_ptr& layer) const { + if (!LayerTransformation::canBeTransformedSpatialDimension(layer)) { return false; } diff --git a/src/common/low_precision_transformations/src/max_pool.cpp b/src/common/low_precision_transformations/src/max_pool.cpp index d9b06644037847..ef0a508fac3a65 100644 --- a/src/common/low_precision_transformations/src/max_pool.cpp +++ b/src/common/low_precision_transformations/src/max_pool.cpp @@ -26,15 +26,15 @@ MaxPoolTransformation::MaxPoolTransformation(const Params& params) : LayerTransf if (transformation_callback(op)) { return false; } - return transform(*context, m); + return transform(m); }; auto m = std::make_shared(matcher, matcher_name); this->register_matcher(m, callback); } -bool MaxPoolTransformation::canBeTransformed(const TransformationContext& context, std::shared_ptr op) const { - if (!LayerTransformation::canBeTransformed(context, op)) { +bool MaxPoolTransformation::canBeTransformed(const std::shared_ptr& op) const { + if (!LayerTransformation::canBeTransformed(op)) { return false; } @@ -51,13 +51,13 @@ bool MaxPoolTransformation::canBeTransformed(const TransformationContext& contex return true; } -bool MaxPoolTransformation::transform(TransformationContext& context, ov::pass::pattern::Matcher &m) { - if (!canBeTransformed(context, m.get_match_root())) { +bool MaxPoolTransformation::transform(ov::pass::pattern::Matcher &m) { + if (!canBeTransformed(m.get_match_root())) { return false; } const std::shared_ptr pooling = NetworkHelper::separateInStandaloneBranch(m.get_match_root(), defaultPrecisions); - const auto newOperation = moveDequantizationAfter(context, pooling, NetworkHelper::getDequantization(pooling, defaultPrecisions)); + const auto newOperation = moveDequantizationAfter(pooling, NetworkHelper::getDequantization(pooling, defaultPrecisions)); OPENVINO_DEBUG("LPT: done: ", newOperation); return true; diff --git a/src/common/low_precision_transformations/src/move_fake_quantize.cpp b/src/common/low_precision_transformations/src/move_fake_quantize.cpp index abee9cbd081a0f..54b54a332db561 100644 --- a/src/common/low_precision_transformations/src/move_fake_quantize.cpp +++ b/src/common/low_precision_transformations/src/move_fake_quantize.cpp @@ -46,7 +46,7 @@ MoveFakeQuantize::MoveFakeQuantize(const Params& params) : LayerTransformation(p return false; } - return transform(*context, m); + return transform(m); }; auto m = std::make_shared( @@ -55,9 +55,9 @@ MoveFakeQuantize::MoveFakeQuantize(const Params& params) : LayerTransformation(p this->register_matcher(m, callback); } -bool MoveFakeQuantize::transform(TransformationContext& context, ov::pass::pattern::Matcher& m) { +bool MoveFakeQuantize::transform(ov::pass::pattern::Matcher& m) { const auto fq = m.get_match_root(); - if (!canBeTransformed(context, fq)) { + if (!canBeTransformed(fq)) { return false; } @@ -156,16 +156,16 @@ bool MoveFakeQuantize::transform(TransformationContext& context, ov::pass::patte newConcat->set_friendly_name(concat->get_friendly_name()); NetworkHelper::copyInfo(concat, newConcat); if (!dequantization.empty()) { - moveDequantizationBefore(context, newConcat, dequantization); + moveDequantizationBefore(newConcat, dequantization); return true; } replace_node(fq, newConcat); - updateOutput(context, newConcat, fq); + updateOutput(newConcat, fq); return true; } -bool MoveFakeQuantize::canBeTransformed(const TransformationContext& context, std::shared_ptr layer) const { +bool MoveFakeQuantize::canBeTransformed(const std::shared_ptr& layer) const { auto operation = layer->get_input_node_shared_ptr(0); std::shared_ptr concat; if (is_type(operation)) { diff --git a/src/common/low_precision_transformations/src/multiply.cpp b/src/common/low_precision_transformations/src/multiply.cpp index 4c1f3c073febcf..8dd6cce059d96e 100644 --- a/src/common/low_precision_transformations/src/multiply.cpp +++ b/src/common/low_precision_transformations/src/multiply.cpp @@ -33,16 +33,16 @@ MultiplyTransformation::MultiplyTransformation(const Params& params) : if (transformation_callback(op)) { return false; } - return transform(*context, m); + return transform(m); }; auto m = std::make_shared(matcher, matcher_name); this->register_matcher(m, callback); } -bool MultiplyTransformation::transform(TransformationContext& context, ov::pass::pattern::Matcher& m) { +bool MultiplyTransformation::transform(ov::pass::pattern::Matcher& m) { auto multiply = m.get_match_root(); - if (!canBeTransformed(context, multiply)) { + if (!canBeTransformed(multiply)) { return false; } @@ -100,7 +100,7 @@ bool MultiplyTransformation::transform(TransformationContext& context, ov::pass: ov::op::TemporaryReplaceOutputType(in2, deqPrecision).get()); replace_node(multiply, new_multiply); - updateOutput(context, new_multiply, multiply); + updateOutput(new_multiply, multiply); return true; } @@ -128,7 +128,7 @@ bool MultiplyTransformation::transform(TransformationContext& context, ov::pass: multiply->get_output_element_type(0)); replace_node(multiply, new_scales); - const auto was_updated = updateOutput(context, new_scales, multiply); + const auto was_updated = updateOutput(new_scales, multiply); NetworkHelper::copyInfo(multiply, new_multiply, !was_updated); return true; diff --git a/src/common/low_precision_transformations/src/multiply_partial.cpp b/src/common/low_precision_transformations/src/multiply_partial.cpp index aea1bf49b8ffc1..e01b09324712ef 100644 --- a/src/common/low_precision_transformations/src/multiply_partial.cpp +++ b/src/common/low_precision_transformations/src/multiply_partial.cpp @@ -32,16 +32,16 @@ MultiplyPartialTransformation::MultiplyPartialTransformation(const Params& param if (transformation_callback(op)) { return false; } - return transform(*context, m); + return transform(m); }; auto m = std::make_shared(matcher, matcher_name); this->register_matcher(m, callback); } -bool MultiplyPartialTransformation::transform(TransformationContext& context, ov::pass::pattern::Matcher& m) { +bool MultiplyPartialTransformation::transform(ov::pass::pattern::Matcher& m) { auto multiply = m.get_match_root(); - if (!canBeTransformed(context, multiply)) { + if (!canBeTransformed(multiply)) { return false; } @@ -168,7 +168,7 @@ bool MultiplyPartialTransformation::transform(TransformationContext& context, ov } replace_node(multiply, newMultiply); - updateOutput(context, newMultiply, multiply); + updateOutput(newMultiply, multiply); if (fullPathIndex != -1) { NetworkHelper::foldDequantization(newMultiply, fullPathIndex, defaultPrecisions); @@ -178,7 +178,7 @@ bool MultiplyPartialTransformation::transform(TransformationContext& context, ov return true; } -bool MultiplyPartialTransformation::canBeTransformed(const TransformationContext& context, std::shared_ptr layer) const { +bool MultiplyPartialTransformation::canBeTransformed(const std::shared_ptr& layer) const { FakeQuantizeDequantization dequantization1 = pass::low_precision::NetworkHelper::getDequantization(layer, defaultPrecisions, 0ul); FakeQuantizeDequantization dequantization2 = pass::low_precision::NetworkHelper::getDequantization(layer, defaultPrecisions, 1ul); @@ -193,7 +193,7 @@ bool MultiplyPartialTransformation::canBeTransformed(const TransformationContext return false; } - return EltwiseBaseTransformation::canBeTransformed(context, layer); + return EltwiseBaseTransformation::canBeTransformed(layer); } } // namespace low_precision diff --git a/src/common/low_precision_transformations/src/multiply_to_group_convolution.cpp b/src/common/low_precision_transformations/src/multiply_to_group_convolution.cpp index 466b7ad6c75e5d..8e52eb38ee8ee1 100644 --- a/src/common/low_precision_transformations/src/multiply_to_group_convolution.cpp +++ b/src/common/low_precision_transformations/src/multiply_to_group_convolution.cpp @@ -24,16 +24,16 @@ MultiplyToGroupConvolutionTransformation::MultiplyToGroupConvolutionTransformati if (transformation_callback(op)) { return false; } - return transform(*context, m); + return transform(m); }; auto m = std::make_shared(matcher, matcher_name); this->register_matcher(m, callback); } -bool MultiplyToGroupConvolutionTransformation::transform(TransformationContext& context, ov::pass::pattern::Matcher &m) { +bool MultiplyToGroupConvolutionTransformation::transform(ov::pass::pattern::Matcher &m) { const auto multiply = m.get_match_root(); - if (!canBeTransformed(context, multiply)) { + if (!canBeTransformed(multiply)) { return false; } @@ -142,8 +142,8 @@ bool MultiplyToGroupConvolutionTransformation::transform(TransformationContext& return true; } -bool MultiplyToGroupConvolutionTransformation::canBeTransformed(const TransformationContext& context, std::shared_ptr operation) const { - if (!CleanupTransformation::canBeTransformed(context, operation)) { +bool MultiplyToGroupConvolutionTransformation::canBeTransformed(const std::shared_ptr& operation) const { + if (!CleanupTransformation::canBeTransformed(operation)) { return false; } diff --git a/src/common/low_precision_transformations/src/mvn.cpp b/src/common/low_precision_transformations/src/mvn.cpp index 4c848b69b82661..22dfc2f9816ed0 100644 --- a/src/common/low_precision_transformations/src/mvn.cpp +++ b/src/common/low_precision_transformations/src/mvn.cpp @@ -52,15 +52,15 @@ MVNTransformation::MVNTransformation(const Params& params) : LayerTransformation if (transformation_callback(op)) { return false; } - return transform(*context, m); + return transform(m); }; auto m = std::make_shared(matcher, matcher_name); this->register_matcher(m, callback); } -bool MVNTransformation::canBeTransformed(const TransformationContext& context, std::shared_ptr operation) const { - if (!LayerTransformation::canBeTransformed(context, operation)) { +bool MVNTransformation::canBeTransformed(const std::shared_ptr& operation) const { + if (!LayerTransformation::canBeTransformed(operation)) { return false; } @@ -117,9 +117,9 @@ bool MVNTransformation::canBeTransformed(const TransformationContext& context, s return false; } -bool MVNTransformation::transform(TransformationContext &context, ov::pass::pattern::Matcher &m) { +bool MVNTransformation::transform(ov::pass::pattern::Matcher &m) { std::shared_ptr operation = m.get_match_root(); - if (!canBeTransformed(context, operation)) { + if (!canBeTransformed(operation)) { return false; } @@ -167,7 +167,7 @@ bool MVNTransformation::transform(TransformationContext &context, ov::pass::patt NetworkHelper::insertDequantizationAfter(mvn, newMultiply, newMVN); - updateOutput(context, newMultiply, newMVN); + updateOutput(newMultiply, newMVN); OPENVINO_DEBUG("LPT: done: ", newMVN); return true; diff --git a/src/common/low_precision_transformations/src/network_helper.cpp b/src/common/low_precision_transformations/src/network_helper.cpp index e57fdcfb1b8e81..afb7e19c13e7ad 100644 --- a/src/common/low_precision_transformations/src/network_helper.cpp +++ b/src/common/low_precision_transformations/src/network_helper.cpp @@ -622,6 +622,7 @@ std::shared_ptr NetworkHelper::separateInStandaloneBranch(std::shared_ parent = multiply->output(0); } + OPENVINO_ASSERT(dequantization.multiply != nullptr || dequantization.subtract != nullptr, "incorrect dequantization ops configuration"); const auto originalParent = dequantization.multiply ? dequantization.multiply->shared_from_this() : dequantization.subtract->shared_from_this(); diff --git a/src/common/low_precision_transformations/src/normalize_l2.cpp b/src/common/low_precision_transformations/src/normalize_l2.cpp index c9f1cc6a7fe8af..9c30456f84afba 100644 --- a/src/common/low_precision_transformations/src/normalize_l2.cpp +++ b/src/common/low_precision_transformations/src/normalize_l2.cpp @@ -47,15 +47,15 @@ NormalizeL2Transformation::NormalizeL2Transformation(const Params& params) : Lay if (transformation_callback(op)) { return false; } - return transform(*context, m); + return transform(m); }; auto m = std::make_shared(matcher, matcher_name); this->register_matcher(m, callback); } -bool NormalizeL2Transformation::canBeTransformed(const TransformationContext& context, std::shared_ptr operation) const { - if (!LayerTransformation::canBeTransformed(context, operation)) { +bool NormalizeL2Transformation::canBeTransformed(const std::shared_ptr& operation) const { + if (!LayerTransformation::canBeTransformed(operation)) { return false; } @@ -97,9 +97,9 @@ bool NormalizeL2Transformation::canBeTransformed(const TransformationContext& co return true; } -bool NormalizeL2Transformation::transform(TransformationContext &context, ov::pass::pattern::Matcher &m) { +bool NormalizeL2Transformation::transform(ov::pass::pattern::Matcher &m) { std::shared_ptr operation = m.get_match_root(); - if (!canBeTransformed(context, operation)) { + if (!canBeTransformed(operation)) { return false; } @@ -146,7 +146,7 @@ bool NormalizeL2Transformation::transform(TransformationContext &context, ov::pa NetworkHelper::insertDequantizationAfter(normalize, newMultiply, newNormalize); ov::copy_runtime_info({ normalize, newMultiply }, newMultiply); - updateOutput(context, newMultiply, newNormalize); + updateOutput(newMultiply, newNormalize); OPENVINO_DEBUG("LPT: done: ", newNormalize); return true; diff --git a/src/common/low_precision_transformations/src/pad.cpp b/src/common/low_precision_transformations/src/pad.cpp index 12310ec5724f6c..c023ee9d14d9ee 100644 --- a/src/common/low_precision_transformations/src/pad.cpp +++ b/src/common/low_precision_transformations/src/pad.cpp @@ -31,7 +31,7 @@ PadTransformation::PadTransformation(const Params& params) : LayerTransformation if (transformation_callback(op)) { return false; } - return transform(*context, m); + return transform(m); }; auto m = std::make_shared(matcher, matcher_name); @@ -50,8 +50,8 @@ namespace { } } // namespace -bool PadTransformation::transform(TransformationContext& context, ov::pass::pattern::Matcher& m) { - if (!canBeTransformed(context, m.get_match_root())) { +bool PadTransformation::transform(ov::pass::pattern::Matcher& m) { + if (!canBeTransformed(m.get_match_root())) { return false; } @@ -164,14 +164,14 @@ bool PadTransformation::transform(TransformationContext& context, ov::pass::patt const auto convertedZero = ov::opset1::Constant::create(dequantization.data.get_element_type(), Shape{}, { padConstantValue }); pad->set_argument(3, convertedZero); - const auto newOperation = moveDequantizationAfter(context, pad, dequantization); + const auto newOperation = moveDequantizationAfter(pad, dequantization); OPENVINO_DEBUG("LPT: done: ", newOperation); return true; } -bool PadTransformation::canBeTransformed(const TransformationContext& context, std::shared_ptr op) const { - if (!LayerTransformation::canBeTransformedSpatialDimension(context, op)) { +bool PadTransformation::canBeTransformed(const std::shared_ptr& op) const { + if (!LayerTransformation::canBeTransformedSpatialDimension(op)) { return false; } diff --git a/src/common/low_precision_transformations/src/prelu.cpp b/src/common/low_precision_transformations/src/prelu.cpp index 46e0d692f0faca..e30bb6fa041074 100644 --- a/src/common/low_precision_transformations/src/prelu.cpp +++ b/src/common/low_precision_transformations/src/prelu.cpp @@ -28,22 +28,22 @@ PReluTransformation::PReluTransformation(const Params& params) : LayerTransforma if (transformation_callback(op)) { return false; } - return transform(*context, m); + return transform(m); }; auto m = std::make_shared(matcher, matcher_name); this->register_matcher(m, callback); } -bool PReluTransformation::transform(TransformationContext& context, ov::pass::pattern::Matcher &m) { +bool PReluTransformation::transform(ov::pass::pattern::Matcher &m) { std::shared_ptr prelu = m.get_match_root(); - if (!canBeTransformed(context, prelu)) { + if (!canBeTransformed(prelu)) { return false; } prelu = NetworkHelper::separateInStandaloneBranch(prelu, defaultPrecisions); const FakeQuantizeDequantization dequantization = NetworkHelper::getDequantization(prelu, defaultPrecisions, 0); - const auto newOperation = moveDequantizationAfter(context, prelu, dequantization, false, false); + const auto newOperation = moveDequantizationAfter(prelu, dequantization, false, false); OPENVINO_DEBUG("LPT: done: ", newOperation); return true; @@ -53,8 +53,8 @@ bool PReluTransformation::isPrecisionPreserved(std::shared_ptr op) const n return false; } -bool PReluTransformation::canBeTransformed(const TransformationContext& context, std::shared_ptr op) const { - if (!LayerTransformation::canBeTransformed(context, op)) { +bool PReluTransformation::canBeTransformed(const std::shared_ptr& op) const { + if (!LayerTransformation::canBeTransformed(op)) { return false; } diff --git a/src/common/low_precision_transformations/src/pull_reshape_through_dequantization.cpp b/src/common/low_precision_transformations/src/pull_reshape_through_dequantization.cpp index 157a204af3a089..6e33afc09461f2 100644 --- a/src/common/low_precision_transformations/src/pull_reshape_through_dequantization.cpp +++ b/src/common/low_precision_transformations/src/pull_reshape_through_dequantization.cpp @@ -101,7 +101,7 @@ std::shared_ptr moveThroughConvert(const std::shared_ptr& reshape, c void fuseConstant(const std::shared_ptr& reshape, const std::shared_ptr& constant) { ov::OutputVector result(1); - reshape->constant_fold(result, { constant, reshape->input_value(1) }); + OPENVINO_ASSERT(reshape->constant_fold(result, { constant, reshape->input_value(1) }), "Reshape constant folding failed"); const auto newConstant = result[0].get_node_shared_ptr(); replace_node(reshape, newConstant); copy_runtime_info({ constant, reshape }, newConstant); @@ -139,7 +139,7 @@ ov::pass::low_precision::PullReshapeThroughDequantization::PullReshapeThroughDeq return false; } - while (reshape != nullptr) { + do { const auto parent = reshape->get_input_node_shared_ptr(0); if (ov::is_type(parent) || ov::is_type(parent)) { reshape = pull_reshape_through_dequantization::moveThroughElementwise(reshape, parent); @@ -151,7 +151,7 @@ ov::pass::low_precision::PullReshapeThroughDequantization::PullReshapeThroughDeq } else { THROW_IE_LPT_EXCEPTION(*parent) << "unexepcted operation type"; } - } + } while (reshape != nullptr); return true; }; diff --git a/src/common/low_precision_transformations/src/pull_transpose_through_dequantization.cpp b/src/common/low_precision_transformations/src/pull_transpose_through_dequantization.cpp index a4557288c74f23..3f3533f12a7da7 100644 --- a/src/common/low_precision_transformations/src/pull_transpose_through_dequantization.cpp +++ b/src/common/low_precision_transformations/src/pull_transpose_through_dequantization.cpp @@ -110,7 +110,7 @@ ov::pass::low_precision::PullTransposeThroughDequantization::PullTransposeThroug ov::matcher_pass_callback callback = [=](ov::pass::pattern::Matcher & m) -> bool { const auto& opsMap = m.get_pattern_value_map(); - auto transpose = opsMap.find(matcherTranspose)->second.get_node()->shared_from_this(); + auto transpose = opsMap.at(matcherTranspose).get_node_shared_ptr(); while (transpose != nullptr) { const auto parent = transpose->get_input_node_shared_ptr(0); diff --git a/src/common/low_precision_transformations/src/recurrent_cell.cpp b/src/common/low_precision_transformations/src/recurrent_cell.cpp index cec96044502596..34d851d6a2b464 100644 --- a/src/common/low_precision_transformations/src/recurrent_cell.cpp +++ b/src/common/low_precision_transformations/src/recurrent_cell.cpp @@ -43,7 +43,7 @@ RecurrentCellTransformation::RecurrentCellTransformation(const Params& params) : return false; } - return transform(*context, m); + return transform(m); }; auto m = std::make_shared( @@ -116,7 +116,7 @@ std::vector> get_supported_precisions(std::shar } // namespace -void RecurrentCellTransformation::propagate(TransformationContext& context, const std::shared_ptr node) { +void RecurrentCellTransformation::propagate(const std::shared_ptr node) { if (!isSupportedForPerChannelQuantization(node)) { return; } @@ -126,7 +126,7 @@ void RecurrentCellTransformation::propagate(TransformationContext& context, cons if (dequantization.empty()) { return; } - const auto& new_node = moveDequantizationAfter(context, normalized_node, dequantization); + const auto& new_node = moveDequantizationAfter(normalized_node, dequantization); const auto& new_dequantization = NetworkHelper::getDequantizationBelow(new_node); if (new_dequantization.empty()) { @@ -136,12 +136,12 @@ void RecurrentCellTransformation::propagate(TransformationContext& context, cons for (auto output : new_dequantization.multiply->outputs()) { for (auto input : output.get_target_inputs()) { auto child = input.get_node()->shared_from_this(); - propagate(context, child); + propagate(child); } } } -bool RecurrentCellTransformation::transform(TransformationContext& context, ov::pass::pattern::Matcher& m) { +bool RecurrentCellTransformation::transform(ov::pass::pattern::Matcher& m) { const auto lstm = m.get_match_root(); const auto inputs = get_supported_precisions(lstm); for (const auto& input : inputs) { @@ -179,13 +179,13 @@ bool RecurrentCellTransformation::transform(TransformationContext& context, ov:: for (const auto& output : multiply->outputs()) { for (const auto& input : output.get_target_inputs()) { const auto input_node = input.get_node(); - propagate(context, input_node->shared_from_this()); + propagate(input_node->shared_from_this()); } } } } - if (!canBeTransformed(context, lstm)) { + if (!canBeTransformed(lstm)) { return false; } @@ -228,7 +228,7 @@ bool RecurrentCellTransformation::transform(TransformationContext& context, ov:: propagateSkipCleanupAttribute(deq_multiply); this->register_new_node(new_fq); - updateOutput(context, deq_multiply, new_fq); + updateOutput(deq_multiply, new_fq); } else { continue; } @@ -245,7 +245,7 @@ bool RecurrentCellTransformation::transform(TransformationContext& context, ov:: return true; } -bool RecurrentCellTransformation::canBeTransformed(const TransformationContext& context, std::shared_ptr lstm) const { +bool RecurrentCellTransformation::canBeTransformed(const std::shared_ptr& lstm) const { const auto inputs = get_supported_precisions(lstm); for (const auto& index : inputs) { const auto& input = lstm->get_input_node_ptr(index.first); diff --git a/src/common/low_precision_transformations/src/reduce_base_transformation.cpp b/src/common/low_precision_transformations/src/reduce_base_transformation.cpp index 5fe679d8c997bf..c39681bc660f21 100644 --- a/src/common/low_precision_transformations/src/reduce_base_transformation.cpp +++ b/src/common/low_precision_transformations/src/reduce_base_transformation.cpp @@ -16,8 +16,8 @@ namespace low_precision { ReduceBaseTransformation::ReduceBaseTransformation(const Params& params) : LayerTransformation(params) {} -bool ReduceBaseTransformation::transform(TransformationContext& context, ov::pass::pattern::Matcher& m) { - if (!canBeTransformed(context, m.get_match_root())) { +bool ReduceBaseTransformation::transform(ov::pass::pattern::Matcher& m) { + if (!canBeTransformed(m.get_match_root())) { return false; } @@ -29,13 +29,13 @@ bool ReduceBaseTransformation::transform(TransformationContext& context, ov::pas // updatePrecision depends on type and parameters of the reduce const bool updatePrecision = getUpdatePrecision(reduce); - const auto newOperation = moveDequantizationAfter(context, reduce, dequantization, updatePrecision); + const auto newOperation = moveDequantizationAfter(reduce, dequantization, updatePrecision); OPENVINO_DEBUG("LPT: done: ", newOperation); return true; } -bool ReduceBaseTransformation::canBeTransformed(const TransformationContext& context, std::shared_ptr reduce) const { +bool ReduceBaseTransformation::canBeTransformed(const std::shared_ptr& reduce) const { const auto dequantization = NetworkHelper::getDequantization(reduce, defaultPrecisions); if (dequantization.empty()) { return false; diff --git a/src/common/low_precision_transformations/src/reduce_max.cpp b/src/common/low_precision_transformations/src/reduce_max.cpp index 4cf9c2ed2100aa..65d021accf3452 100644 --- a/src/common/low_precision_transformations/src/reduce_max.cpp +++ b/src/common/low_precision_transformations/src/reduce_max.cpp @@ -23,19 +23,19 @@ ReduceMaxTransformation::ReduceMaxTransformation(const Params& params) : ReduceB if (transformation_callback(op)) { return false; } - return transform(*context, m); + return transform(m); }; auto m = std::make_shared(matcher, matcher_name); this->register_matcher(m, callback); } -bool ReduceMaxTransformation::canBeTransformed(const TransformationContext& context, std::shared_ptr reduce) const { +bool ReduceMaxTransformation::canBeTransformed(const std::shared_ptr& reduce) const { if (!ov::is_type(reduce)) { return false; } - if (!ReduceBaseTransformation::canBeTransformed(context, reduce)) { + if (!ReduceBaseTransformation::canBeTransformed(reduce)) { return false; } diff --git a/src/common/low_precision_transformations/src/reduce_mean.cpp b/src/common/low_precision_transformations/src/reduce_mean.cpp index 451a1d4c3804df..55f080587290b9 100644 --- a/src/common/low_precision_transformations/src/reduce_mean.cpp +++ b/src/common/low_precision_transformations/src/reduce_mean.cpp @@ -23,15 +23,15 @@ ReduceMeanTransformation::ReduceMeanTransformation(const Params& params) : Reduc if (transformation_callback(op)) { return false; } - return transform(*context, m); + return transform(m); }; auto m = std::make_shared(matcher, matcher_name); this->register_matcher(m, callback); } -bool ReduceMeanTransformation::canBeTransformed(const TransformationContext& context, std::shared_ptr reduce) const { - return ov::is_type(reduce) ? ReduceBaseTransformation::canBeTransformed(context, reduce) : false; +bool ReduceMeanTransformation::canBeTransformed(const std::shared_ptr& reduce) const { + return ov::is_type(reduce) ? ReduceBaseTransformation::canBeTransformed(reduce) : false; } bool ReduceMeanTransformation::isPrecisionPreserved(std::shared_ptr reduce) const noexcept { diff --git a/src/common/low_precision_transformations/src/reduce_min.cpp b/src/common/low_precision_transformations/src/reduce_min.cpp index d7433c322718c0..6ad0cfea259b38 100644 --- a/src/common/low_precision_transformations/src/reduce_min.cpp +++ b/src/common/low_precision_transformations/src/reduce_min.cpp @@ -22,19 +22,19 @@ ReduceMinTransformation::ReduceMinTransformation(const Params& params) : ReduceB if (transformation_callback(op)) { return false; } - return transform(*context, m); + return transform(m); }; auto m = std::make_shared(matcher, matcher_name); this->register_matcher(m, callback); } -bool ReduceMinTransformation::canBeTransformed(const TransformationContext& context, std::shared_ptr reduce) const { +bool ReduceMinTransformation::canBeTransformed(const std::shared_ptr& reduce) const { if (!ov::is_type(reduce)) { return false; } - if (!ReduceBaseTransformation::canBeTransformed(context, reduce)) { + if (!ReduceBaseTransformation::canBeTransformed(reduce)) { return false; } diff --git a/src/common/low_precision_transformations/src/reduce_sum.cpp b/src/common/low_precision_transformations/src/reduce_sum.cpp index 1bc8bf75d27a7f..d28fbdc9c559e7 100644 --- a/src/common/low_precision_transformations/src/reduce_sum.cpp +++ b/src/common/low_precision_transformations/src/reduce_sum.cpp @@ -23,16 +23,16 @@ ReduceSumTransformation::ReduceSumTransformation(const Params& params) : ReduceB if (transformation_callback(op)) { return false; } - return transform(*context, m); + return transform(m); }; auto m = std::make_shared(matcher, matcher_name); this->register_matcher(m, callback); } -bool ReduceSumTransformation::canBeTransformed(const TransformationContext& context, std::shared_ptr reduce) const { +bool ReduceSumTransformation::canBeTransformed(const std::shared_ptr& reduce) const { const auto reduceSum = ov::as_type_ptr(reduce); - if (!reduceSum || !ReduceBaseTransformation::canBeTransformed(context, reduceSum)) { + if (!reduceSum || !ReduceBaseTransformation::canBeTransformed(reduceSum)) { return false; } diff --git a/src/common/low_precision_transformations/src/relu.cpp b/src/common/low_precision_transformations/src/relu.cpp index 6d39cccc0e0260..ca2de4e05f0b84 100644 --- a/src/common/low_precision_transformations/src/relu.cpp +++ b/src/common/low_precision_transformations/src/relu.cpp @@ -28,22 +28,22 @@ ReluTransformation::ReluTransformation(const Params& params) : LayerTransformati if (transformation_callback(op)) { return false; } - return transform(*context, m); + return transform(m); }; auto m = std::make_shared(matcher, matcher_name); this->register_matcher(m, callback); } -bool ReluTransformation::transform(TransformationContext& context, ov::pass::pattern::Matcher &m) { +bool ReluTransformation::transform(ov::pass::pattern::Matcher &m) { std::shared_ptr relu = m.get_match_root(); - if (!canBeTransformed(context, relu)) { + if (!canBeTransformed(relu)) { return false; } relu = NetworkHelper::separateInStandaloneBranch(relu, defaultPrecisions); const FakeQuantizeDequantization dequantization = NetworkHelper::getDequantization(relu, defaultPrecisions, 0); - const auto newOperation = moveDequantizationAfter(context, relu, dequantization); + const auto newOperation = moveDequantizationAfter(relu, dequantization); OPENVINO_DEBUG("LPT: done: ", newOperation); return true; @@ -53,8 +53,8 @@ bool ReluTransformation::isPrecisionPreserved(std::shared_ptr op) const no return true; } -bool ReluTransformation::canBeTransformed(const TransformationContext& context, std::shared_ptr op) const { - if (!LayerTransformation::canBeTransformed(context, op)) { +bool ReluTransformation::canBeTransformed(const std::shared_ptr& op) const { + if (!LayerTransformation::canBeTransformed(op)) { return false; } diff --git a/src/common/low_precision_transformations/src/reshape.cpp b/src/common/low_precision_transformations/src/reshape.cpp index 4d9b9c53a782f6..cf24edc18953b4 100644 --- a/src/common/low_precision_transformations/src/reshape.cpp +++ b/src/common/low_precision_transformations/src/reshape.cpp @@ -48,7 +48,7 @@ ReshapeTransformation::ReshapeTransformation(const Params& params) : LayerTransf } } - return transform(*context, m); + return transform(m); }; auto m = std::make_shared(matcher, matcher_name); @@ -146,19 +146,19 @@ void reshapeDequantizationConstant(const std::shared_ptr& r } // namespace -bool ReshapeTransformation::transform(TransformationContext& context, ov::pass::pattern::Matcher &m) { +bool ReshapeTransformation::transform(ov::pass::pattern::Matcher &m) { std::shared_ptr reshape = ov::as_type_ptr(m.get_match_root()); if (NetworkHelper::isConstantPath(reshape)) { return false; } - if (!canBeTransformed(context, reshape)) { + if (!canBeTransformed(reshape)) { return false; } reshape = ov::as_type_ptr(NetworkHelper::separateInStandaloneBranch(reshape, defaultPrecisions)); reshapeDequantizationConstant(reshape, defaultPrecisions); - const auto newOperation = moveDequantizationAfter(context, reshape, NetworkHelper::getDequantization(reshape, defaultPrecisions, 0)); + const auto newOperation = moveDequantizationAfter(reshape, NetworkHelper::getDequantization(reshape, defaultPrecisions, 0)); OPENVINO_DEBUG("LPT: done: ", newOperation); return true; @@ -188,8 +188,8 @@ inline size_t getFirstChangedDimension(const PartialShape& shape1, const Partial return i; } -bool ReshapeTransformation::canBeTransformed(const TransformationContext& context, std::shared_ptr op) const { - if (!LayerTransformation::canBeTransformed(context, op)) { +bool ReshapeTransformation::canBeTransformed(const std::shared_ptr& op) const { + if (!LayerTransformation::canBeTransformed(op)) { return false; } diff --git a/src/common/low_precision_transformations/src/shuffle_channels.cpp b/src/common/low_precision_transformations/src/shuffle_channels.cpp index ab170ea28572e2..67abf9b28db708 100644 --- a/src/common/low_precision_transformations/src/shuffle_channels.cpp +++ b/src/common/low_precision_transformations/src/shuffle_channels.cpp @@ -26,15 +26,15 @@ ShuffleChannelsTransformation::ShuffleChannelsTransformation(const Params& param if (transformation_callback(op)) { return false; } - return transform(*context, m); + return transform(m); }; auto m = std::make_shared(matcher, matcher_name); this->register_matcher(m, callback); } -bool ShuffleChannelsTransformation::transform(TransformationContext& context, ov::pass::pattern::Matcher& m) { - if (!canBeTransformed(context, m.get_match_root())) { +bool ShuffleChannelsTransformation::transform(ov::pass::pattern::Matcher& m) { + if (!canBeTransformed(m.get_match_root())) { return false; } @@ -73,14 +73,14 @@ bool ShuffleChannelsTransformation::transform(TransformationContext& context, ov replace_node(dequantization.multiplyConstant, shuffledMulConst); dequantization.multiplyConstant = shuffledMulConst; - const auto newOperation = moveDequantizationAfter(context, shuffleChannels, dequantization); + const auto newOperation = moveDequantizationAfter(shuffleChannels, dequantization); OPENVINO_DEBUG("LPT: done: ", newOperation); return true; } -bool ShuffleChannelsTransformation::canBeTransformed(const TransformationContext& context, std::shared_ptr op) const { - if (!LayerTransformation::canBeTransformedSpatialDimension(context, op)) { +bool ShuffleChannelsTransformation::canBeTransformed(const std::shared_ptr& op) const { + if (!LayerTransformation::canBeTransformedSpatialDimension(op)) { return false; } diff --git a/src/common/low_precision_transformations/src/slice.cpp b/src/common/low_precision_transformations/src/slice.cpp index 99c51f4e3f5ac3..082c00f207a37a 100644 --- a/src/common/low_precision_transformations/src/slice.cpp +++ b/src/common/low_precision_transformations/src/slice.cpp @@ -26,27 +26,27 @@ SliceTransformation::SliceTransformation(const Params& params) : LayerTransforma if (transformation_callback(op)) { return false; } - return transform(*context, m); + return transform(m); }; auto m = std::make_shared(matcher, matcher_name); this->register_matcher(m, callback); } -bool SliceTransformation::transform(TransformationContext& context, ov::pass::pattern::Matcher& m) { - if (!SliceTransformation::canBeTransformed(context, m.get_match_root())) { +bool SliceTransformation::transform(ov::pass::pattern::Matcher& m) { + if (!SliceTransformation::canBeTransformed(m.get_match_root())) { return false; } const auto strided_slice = NetworkHelper::separateInStandaloneBranch(m.get_match_root(), defaultPrecisions); - const auto newOperation = moveDequantizationAfter(context, strided_slice, NetworkHelper::getDequantization(strided_slice, defaultPrecisions)); + const auto newOperation = moveDequantizationAfter(strided_slice, NetworkHelper::getDequantization(strided_slice, defaultPrecisions)); OPENVINO_DEBUG("LPT: done: ", newOperation); return true; } -bool SliceTransformation::canBeTransformed(const TransformationContext& context, std::shared_ptr operation) const { - if (!LayerTransformation::canBeTransformed(context, operation)) { +bool SliceTransformation::canBeTransformed(const std::shared_ptr& operation) const { + if (!LayerTransformation::canBeTransformed(operation)) { return false; } diff --git a/src/common/low_precision_transformations/src/space_to_batch.cpp b/src/common/low_precision_transformations/src/space_to_batch.cpp index 2f0373ffec1068..20a5d1b863a18a 100644 --- a/src/common/low_precision_transformations/src/space_to_batch.cpp +++ b/src/common/low_precision_transformations/src/space_to_batch.cpp @@ -26,15 +26,15 @@ SpaceToBatchTransformation::SpaceToBatchTransformation(const Params& params) : L if (transformation_callback(op)) { return false; } - return transform(*context, m); + return transform(m); }; auto m = std::make_shared(matcher, matcher_name); this->register_matcher(m, callback); } -bool SpaceToBatchTransformation::canBeTransformed(const TransformationContext& context, std::shared_ptr op) const { - if (!LayerTransformation::canBeTransformed(context, op)) { +bool SpaceToBatchTransformation::canBeTransformed(const std::shared_ptr& op) const { + if (!LayerTransformation::canBeTransformed(op)) { return false; } @@ -46,13 +46,13 @@ bool SpaceToBatchTransformation::canBeTransformed(const TransformationContext& c return dequantization.isPerTensor(); } -bool SpaceToBatchTransformation::transform(TransformationContext& context, ov::pass::pattern::Matcher& m) { - if (!canBeTransformed(context, m.get_match_root())) { +bool SpaceToBatchTransformation::transform(ov::pass::pattern::Matcher& m) { + if (!canBeTransformed(m.get_match_root())) { return false; } const std::shared_ptr op = NetworkHelper::separateInStandaloneBranch(m.get_match_root(), defaultPrecisions); - const auto newOperation = moveDequantizationAfter(context, op, NetworkHelper::getDequantization(op, defaultPrecisions)); + const auto newOperation = moveDequantizationAfter(op, NetworkHelper::getDequantization(op, defaultPrecisions)); OPENVINO_DEBUG("LPT: done: ", newOperation); return true; diff --git a/src/common/low_precision_transformations/src/split.cpp b/src/common/low_precision_transformations/src/split.cpp index 88deb9f62e444b..35b1ede004730e 100644 --- a/src/common/low_precision_transformations/src/split.cpp +++ b/src/common/low_precision_transformations/src/split.cpp @@ -24,15 +24,15 @@ SplitTransformation::SplitTransformation(const Params& params) : LayerTransforma if (transformation_callback(op)) { return false; } - return transform(*context, m); + return transform(m); }; auto m = std::make_shared(matcher, matcher_name); this->register_matcher(m, callback); } -bool SplitTransformation::transform(TransformationContext& context, ov::pass::pattern::Matcher& m) { - if (!canBeTransformed(context, m.get_match_root())) { +bool SplitTransformation::transform(ov::pass::pattern::Matcher& m) { + if (!canBeTransformed(m.get_match_root())) { return false; } @@ -120,7 +120,7 @@ bool SplitTransformation::transform(TransformationContext& context, ov::pass::pa } } - updateOutputs(context, lastNodes, newSplit); + updateOutputs(lastNodes, newSplit); OPENVINO_DEBUG("LPT: done: ", newSplit); return true; @@ -128,12 +128,10 @@ bool SplitTransformation::transform(TransformationContext& context, ov::pass::pa void SplitTransformation::updateOutputs( - TransformationContext& context, std::vector> lastNodes, std::shared_ptr originalNode) const { - //TODO: LPT: during refactoring update is not tested if (lastNodes.size() == 1ul) { - updateOutput(context, lastNodes[0], originalNode); + updateOutput(lastNodes[0], originalNode); } else { const std::string originalName = originalNode->get_friendly_name(); for (size_t i = 0; i < lastNodes.size(); ++i) { @@ -155,7 +153,7 @@ bool SplitTransformation::isPrecisionPreserved(std::shared_ptr layer) cons return true; } -bool SplitTransformation::canBeTransformed(const TransformationContext& context, std::shared_ptr layer) const { +bool SplitTransformation::canBeTransformed(const std::shared_ptr& layer) const { return !NetworkHelper::getDequantization(layer, defaultPrecisions).empty() && layer->get_input_partial_shape(0).rank().is_static(); } diff --git a/src/common/low_precision_transformations/src/squeeze.cpp b/src/common/low_precision_transformations/src/squeeze.cpp index 04bdf62362bddd..2ddef0b81be120 100644 --- a/src/common/low_precision_transformations/src/squeeze.cpp +++ b/src/common/low_precision_transformations/src/squeeze.cpp @@ -26,15 +26,15 @@ SqueezeTransformation::SqueezeTransformation(const Params& params) : LayerTransf if (transformation_callback(op)) { return false; } - return transform(*context, m); + return transform(m); }; auto m = std::make_shared(matcher, matcher_name); this->register_matcher(m, callback); } -bool SqueezeTransformation::transform(TransformationContext& context, ov::pass::pattern::Matcher &m) { - if (!canBeTransformed(context, m.get_match_root())) { +bool SqueezeTransformation::transform(ov::pass::pattern::Matcher &m) { + if (!canBeTransformed(m.get_match_root())) { return false; } @@ -66,7 +66,7 @@ bool SqueezeTransformation::transform(TransformationContext& context, ov::pass:: replace_node(dequantization.subtractConstant, newConstant); } - const auto newOperation = moveDequantizationAfter(context, squeeze, NetworkHelper::getDequantization(squeeze, defaultPrecisions)); + const auto newOperation = moveDequantizationAfter(squeeze, NetworkHelper::getDequantization(squeeze, defaultPrecisions)); OPENVINO_DEBUG("LPT: done: ", newOperation); return true; @@ -76,8 +76,8 @@ bool SqueezeTransformation::isPrecisionPreserved(std::shared_ptr layer) co return true; } -bool SqueezeTransformation::canBeTransformed(const TransformationContext& context, std::shared_ptr layer) const { - return (!NetworkHelper::getDequantization(layer, defaultPrecisions).empty()) && LayerTransformation::canBeTransformed(context, layer); +bool SqueezeTransformation::canBeTransformed(const std::shared_ptr& layer) const { + return (!NetworkHelper::getDequantization(layer, defaultPrecisions).empty()) && LayerTransformation::canBeTransformed(layer); } } // namespace low_precision diff --git a/src/common/low_precision_transformations/src/strided_slice.cpp b/src/common/low_precision_transformations/src/strided_slice.cpp index 5d9939e1fe943a..046a1d65af6e50 100644 --- a/src/common/low_precision_transformations/src/strided_slice.cpp +++ b/src/common/low_precision_transformations/src/strided_slice.cpp @@ -107,15 +107,15 @@ StridedSliceTransformation::StridedSliceTransformation(const Params& params) : L if (transformation_callback(op)) { return false; } - return transform(*context, m); + return transform(m); }; auto m = std::make_shared(matcher, matcher_name); this->register_matcher(m, callback); } -bool StridedSliceTransformation::transform(TransformationContext& context, ov::pass::pattern::Matcher& m) { - if (!StridedSliceTransformation::canBeTransformed(context, m.get_match_root())) { +bool StridedSliceTransformation::transform(ov::pass::pattern::Matcher& m) { + if (!StridedSliceTransformation::canBeTransformed(m.get_match_root())) { return false; } @@ -132,13 +132,13 @@ bool StridedSliceTransformation::transform(TransformationContext& context, ov::p replace_node(dequantization.multiplyConstant, new_mul_const); dequantization.multiplyConstant = new_mul_const; - const auto newOperation = moveDequantizationAfter(context, strided_slice, NetworkHelper::getDequantization(strided_slice, defaultPrecisions)); + const auto newOperation = moveDequantizationAfter(strided_slice, NetworkHelper::getDequantization(strided_slice, defaultPrecisions)); OPENVINO_DEBUG("LPT: done: ", newOperation); return true; } -bool StridedSliceTransformation::canBeTransformed(const TransformationContext& context, std::shared_ptr operation) const { +bool StridedSliceTransformation::canBeTransformed(const std::shared_ptr& operation) const { if (!ov::is_type(operation)) { return false; } diff --git a/src/common/low_precision_transformations/src/subtract.cpp b/src/common/low_precision_transformations/src/subtract.cpp index d67a8dc1e0e288..b19add9fca1570 100644 --- a/src/common/low_precision_transformations/src/subtract.cpp +++ b/src/common/low_precision_transformations/src/subtract.cpp @@ -34,16 +34,16 @@ SubtractTransformation::SubtractTransformation(const Params& params) : LayerTran if (transformation_callback(op)) { return false; } - return transform(*context, m); + return transform(m); }; auto m = std::make_shared(subtract, matcher_name); this->register_matcher(m, callback); } -bool SubtractTransformation::transform(TransformationContext& context, ov::pass::pattern::Matcher &m) { +bool SubtractTransformation::transform(ov::pass::pattern::Matcher &m) { std::shared_ptr subtract = ov::as_type_ptr(m.get_match_root()); - if (!canBeTransformed(context, subtract)) { + if (!canBeTransformed(subtract)) { return false; } diff --git a/src/common/low_precision_transformations/src/transformation_context.cpp b/src/common/low_precision_transformations/src/transformation_context.cpp deleted file mode 100644 index 7cef253f0e3f3f..00000000000000 --- a/src/common/low_precision_transformations/src/transformation_context.cpp +++ /dev/null @@ -1,18 +0,0 @@ -// Copyright (C) 2018-2025 Intel Corporation -// SPDX-License-Identifier: Apache-2.0 -// - -#include "low_precision/transformation_context.hpp" - -namespace ov { -namespace pass { -namespace low_precision { - -TransformationContext::TransformationContext() : model(nullptr) {} - -TransformationContext::TransformationContext(std::shared_ptr model) : model(model) { -} - -} // namespace low_precision -} // namespace pass -} // namespace ov diff --git a/src/common/low_precision_transformations/src/transparent_base_transformation.cpp b/src/common/low_precision_transformations/src/transparent_base_transformation.cpp index f5efd99e008b86..8b7a94f5ef966b 100644 --- a/src/common/low_precision_transformations/src/transparent_base_transformation.cpp +++ b/src/common/low_precision_transformations/src/transparent_base_transformation.cpp @@ -14,20 +14,20 @@ using namespace ov; using namespace ov::pass; using namespace ov::pass::low_precision; -bool TransparentBaseTransformation::transform(TransformationContext& context, ov::pass::pattern::Matcher &m) { +bool TransparentBaseTransformation::transform(ov::pass::pattern::Matcher &m) { std::shared_ptr op = m.get_match_root(); - if (!canBeTransformed(context, op)) { + if (!canBeTransformed(op)) { return false; } op = NetworkHelper::separateInStandaloneBranch(op, defaultPrecisions); - const auto newOperation = moveDequantizationAfter(context, op, NetworkHelper::getDequantization(op, defaultPrecisions)); + const auto newOperation = moveDequantizationAfter(op, NetworkHelper::getDequantization(op, defaultPrecisions)); OPENVINO_DEBUG("LPT: done: ", newOperation); return true; } -bool TransparentBaseTransformation::canBeTransformed(const TransformationContext& context, std::shared_ptr layer) const { +bool TransparentBaseTransformation::canBeTransformed(const std::shared_ptr& layer) const { return true; } diff --git a/src/common/low_precision_transformations/src/transpose.cpp b/src/common/low_precision_transformations/src/transpose.cpp index 4d8577e40643ff..b210920ab5bc65 100644 --- a/src/common/low_precision_transformations/src/transpose.cpp +++ b/src/common/low_precision_transformations/src/transpose.cpp @@ -26,7 +26,7 @@ TransposeTransformation::TransposeTransformation(const Params& params) : LayerTr if (transformation_callback(op)) { return false; } - return transform(*context, m); + return transform(m); }; auto m = std::make_shared(matcher, matcher_name); @@ -83,15 +83,15 @@ void transposeDequantizationConstant(std::shared_ptr& transpose, const std } // namespace -bool TransposeTransformation::transform(TransformationContext& context, ov::pass::pattern::Matcher &m) { +bool TransposeTransformation::transform(ov::pass::pattern::Matcher &m) { std::shared_ptr transpose = m.get_match_root(); - if (!canBeTransformed(context, transpose)) { + if (!canBeTransformed(transpose)) { return false; } transpose = NetworkHelper::separateInStandaloneBranch(transpose, defaultPrecisions); transposeDequantizationConstant(transpose, defaultPrecisions); - const auto newOperation = moveDequantizationAfter(context, transpose, NetworkHelper::getDequantization(transpose, defaultPrecisions, 0)); + const auto newOperation = moveDequantizationAfter(transpose, NetworkHelper::getDequantization(transpose, defaultPrecisions, 0)); OPENVINO_DEBUG("LPT: done: ", newOperation); return true; @@ -101,8 +101,8 @@ bool TransposeTransformation::isPrecisionPreserved(std::shared_ptr op) con return true; } -bool TransposeTransformation::canBeTransformed(const TransformationContext& context, std::shared_ptr op) const { - if (!LayerTransformation::canBeTransformed(context, op)) { +bool TransposeTransformation::canBeTransformed(const std::shared_ptr& op) const { + if (!LayerTransformation::canBeTransformed(op)) { return false; } diff --git a/src/common/low_precision_transformations/src/unsqueeze.cpp b/src/common/low_precision_transformations/src/unsqueeze.cpp index 3ba7a951950a5b..32e3f89ab01e69 100644 --- a/src/common/low_precision_transformations/src/unsqueeze.cpp +++ b/src/common/low_precision_transformations/src/unsqueeze.cpp @@ -26,15 +26,15 @@ UnsqueezeTransformation::UnsqueezeTransformation(const Params& params) : LayerTr if (transformation_callback(op)) { return false; } - return transform(*context, m); + return transform(m); }; auto m = std::make_shared(matcher, matcher_name); this->register_matcher(m, callback); } -bool UnsqueezeTransformation::transform(TransformationContext& context, ov::pass::pattern::Matcher &m) { - if (!canBeTransformed(context, m.get_match_root())) { +bool UnsqueezeTransformation::transform(ov::pass::pattern::Matcher &m) { + if (!canBeTransformed(m.get_match_root())) { return false; } @@ -68,7 +68,7 @@ bool UnsqueezeTransformation::transform(TransformationContext& context, ov::pass replace_node(dequantization.subtractConstant, newConstant); } - const auto newOperation = moveDequantizationAfter(context, unsqueeze, NetworkHelper::getDequantization(unsqueeze, defaultPrecisions)); + const auto newOperation = moveDequantizationAfter(unsqueeze, NetworkHelper::getDequantization(unsqueeze, defaultPrecisions)); OPENVINO_DEBUG("LPT: done: ", newOperation); return true; @@ -78,8 +78,8 @@ bool UnsqueezeTransformation::isPrecisionPreserved(std::shared_ptr layer) return true; } -bool UnsqueezeTransformation::canBeTransformed(const TransformationContext& context, std::shared_ptr layer) const { - return (!NetworkHelper::getDequantization(layer, defaultPrecisions).empty()) && LayerTransformation::canBeTransformed(context, layer); +bool UnsqueezeTransformation::canBeTransformed(const std::shared_ptr& layer) const { + return (!NetworkHelper::getDequantization(layer, defaultPrecisions).empty()) && LayerTransformation::canBeTransformed(layer); } diff --git a/src/common/low_precision_transformations/src/variadic_split.cpp b/src/common/low_precision_transformations/src/variadic_split.cpp index fd719cb5fcdf05..e381fd2e58bd48 100644 --- a/src/common/low_precision_transformations/src/variadic_split.cpp +++ b/src/common/low_precision_transformations/src/variadic_split.cpp @@ -26,7 +26,7 @@ VariadicSplitTransformation::VariadicSplitTransformation(const Params& params) : if (transformation_callback(op)) { return false; } - return transform(*context, m); + return transform(m); }; auto m = std::make_shared(matcher, matcher_name); diff --git a/src/common/low_precision_transformations/src/weightable_layer_transformation.cpp b/src/common/low_precision_transformations/src/weightable_layer_transformation.cpp index 9bd43e8a73fe9b..64c6e15cd81356 100644 --- a/src/common/low_precision_transformations/src/weightable_layer_transformation.cpp +++ b/src/common/low_precision_transformations/src/weightable_layer_transformation.cpp @@ -49,9 +49,10 @@ WeightableLayerTransformation::WeightableLayerTransformation(const Params& param canBeTransformedParams(canBeTransformedParams) { } -bool WeightableLayerTransformation::canConvolutionBeTransformed(const TransformationContext& context, std::shared_ptr layer, - const std::vector& defaultPrecisions) const { - if (!WeightableLayerTransformation::canBeTransformed(context, layer)) { +bool WeightableLayerTransformation::canConvolutionBeTransformed( + const std::shared_ptr& layer, + const ov::element::TypeVector& defaultPrecisions) const { + if (!WeightableLayerTransformation::canBeTransformed(layer)) { return false; } @@ -88,8 +89,8 @@ bool WeightableLayerTransformation::canConvolutionBeTransformed(const Transforma return true; } -bool WeightableLayerTransformation::canBeTransformed(const TransformationContext& context, std::shared_ptr layer) const { - if (!LayerTransformation::canBeTransformed(context, layer)) { +bool WeightableLayerTransformation::canBeTransformed(const std::shared_ptr& layer) const { + if (!LayerTransformation::canBeTransformed(layer)) { return false; } diff --git a/src/common/low_precision_transformations/tests/concat_transformation.cpp b/src/common/low_precision_transformations/tests/concat_transformation.cpp index 4d6973f3f440cf..d833e21ad81584 100644 --- a/src/common/low_precision_transformations/tests/concat_transformation.cpp +++ b/src/common/low_precision_transformations/tests/concat_transformation.cpp @@ -128,6 +128,110 @@ const std::vector testValues = { {ov::element::f32, {128.f}, {0.1f}} } }, + // dynamic concatenation axis, but the same per-tensor values + { + {{1, -1, 4, 4}, {1, -1, 4, 4}}, + std::int64_t{1}, + LayerTransformation::createParamsU8I8(), + { + ov::element::u8, + { + {ov::element::f32, {128.f}, {0.1f}}, + {ov::element::f32, {128.f}, {0.1f}} + } + }, + { + ov::element::u8, + {{}, {}}, + ov::element::u8, + {ov::element::f32, {128.f}, {0.1f}} + } + }, + // dynamic concatenation axis, but the same per-tensor values + { + {{1, -1, 4, 4}, {1, -1, 4, 4}}, + std::int64_t{1}, + LayerTransformation::createParamsU8I8(), + { + ov::element::u8, + { + {ov::element::f32, {}, {{0.1f}, ov::element::f32, {1, 1, 1}}}, + {ov::element::f32, {}, {{0.1f}, ov::element::f32, {1, 1, 1}}} + } + }, + { + ov::element::u8, + {{}, {}}, + ov::element::u8, + {ov::element::f32, {}, {0.1f}} + } + }, + // dynamic concatenation axis, dq don't match + { + {{1, -1, 4, 4}, {1, -1, 4, 4}}, + std::int64_t{1}, + LayerTransformation::createParamsU8I8(), + { + ov::element::u8, + { + {ov::element::f32, {128.f}, {0.1f}}, + {ov::element::f32, {}, {0.1f}} + } + }, + { + ov::element::u8, + { + {ov::element::f32, {128.f}, {0.1f}}, + {ov::element::f32, {}, {0.1f}} + }, + ov::element::f32, + {} + } + }, + // dynamic concatenation axis, different per-tensor values + { + {{1, -1, 4, 4}, {1, -1, 4, 4}}, + std::int64_t{1}, + LayerTransformation::createParamsU8I8(), + { + ov::element::u8, + { + {ov::element::f32, {128.f}, {0.1f}}, + {ov::element::f32, {128.f}, {10.f}} + } + }, + { + ov::element::u8, + { + {ov::element::f32, {128.f}, {0.1f}}, + {ov::element::f32, {128.f}, {10.f}} + }, + ov::element::f32, + {} + } + }, + // dynamic output concatenation axis, but one input dim is static + { + {{1, -1, 4, 4}, {1, 3, 4, 4}}, + std::int64_t{1}, + LayerTransformation::createParamsU8I8(), + { + ov::element::u8, + { + {ov::element::f32, {128.f}, {0.1f}}, + {ov::element::f32, {{128.f, 64.f, 128.f}}, {{10.f, 1.f, 10.f}}} + } + }, + { + ov::element::u8, + { + {ov::element::f32, {128.f}, {0.1f}}, + {ov::element::f32, {{128.f, 64.f, 128.f}}, {{10.f, 1.f, 10.f}}} + }, + ov::element::f32, + {} + } + }, { {{1, 3, 4, 4}, {1, 3, 4, 4}}, std::int64_t{1}, diff --git a/src/common/low_precision_transformations/tests/gather_transformation.cpp b/src/common/low_precision_transformations/tests/gather_transformation.cpp index d710709ca69229..79a581e50d589c 100644 --- a/src/common/low_precision_transformations/tests/gather_transformation.cpp +++ b/src/common/low_precision_transformations/tests/gather_transformation.cpp @@ -1,4 +1,4 @@ -// Copyright (C) 2018-2022 Intel Corporation +// Copyright (C) 2018-2025 Intel Corporation // SPDX-License-Identifier: Apache-2.0 // diff --git a/src/common/low_precision_transformations/tests/layer_transformation.hpp b/src/common/low_precision_transformations/tests/layer_transformation.hpp index 6ce93863c42a67..83a9faa70e16d3 100644 --- a/src/common/low_precision_transformations/tests/layer_transformation.hpp +++ b/src/common/low_precision_transformations/tests/layer_transformation.hpp @@ -8,7 +8,6 @@ #include "low_precision/rt_info/intervals_alignment_attribute.hpp" #include "low_precision/rt_info/precisions_attribute.hpp" #include "low_precision/layer_transformation.hpp" -#include "low_precision/transformation_context.hpp" #include "low_precision/network_helper.hpp" #include "ov_lpt_models/common/dequantization_operations.hpp" diff --git a/src/common/low_precision_transformations/tests/simple_low_precision_transformer.cpp b/src/common/low_precision_transformations/tests/simple_low_precision_transformer.cpp index 9a80930160b298..ee1bb78ef4992a 100644 --- a/src/common/low_precision_transformations/tests/simple_low_precision_transformer.cpp +++ b/src/common/low_precision_transformations/tests/simple_low_precision_transformer.cpp @@ -10,7 +10,6 @@ #include "low_precision/markup_bias.hpp" #include "low_precision/markup_can_be_quantized.hpp" #include "low_precision/markup_quantization_granularity.hpp" -#include "low_precision/transformation_context.hpp" // cleanup transformations #include "low_precision/convert.hpp" diff --git a/src/common/snippets/include/snippets/lowered/pass/mha_parallel_wa_optimizer.hpp b/src/common/snippets/include/snippets/lowered/pass/mha_parallel_wa_optimizer.hpp index 2f42a523ec4eac..7a49f5942f1db2 100644 --- a/src/common/snippets/include/snippets/lowered/pass/mha_parallel_wa_optimizer.hpp +++ b/src/common/snippets/include/snippets/lowered/pass/mha_parallel_wa_optimizer.hpp @@ -12,6 +12,8 @@ namespace ov { namespace snippets { namespace lowered { namespace pass { + +class SetDynamicWAToOuterMostLoop; /** * @class MHAParallelWAOptimizer * @brief Optimizes the dynamic MHA execution increasing parallel work amount dy dividing Brgemm's "M" dimension to "parallel_m" @@ -22,6 +24,7 @@ namespace pass { * - Determines loops that should be adjusted. */ class MHAParallelWAOptimizer : public lowered::pass::RuntimeOptimizer { + friend class SetDynamicWAToOuterMostLoop; public: OPENVINO_RTTI("MHAParallelWAOptimizer", "", RuntimeOptimizer) MHAParallelWAOptimizer() = default; @@ -31,10 +34,14 @@ class MHAParallelWAOptimizer : public lowered::pass::RuntimeOptimizer { bool applicable() const override { return !m_loops_to_split.empty(); } private: - static std::unordered_set find_applicable_brgemms(const lowered::LinearIRCPtr& linear_ir); + static std::unordered_set find_applicable_brgemms( + const lowered::LinearIRCPtr& linear_ir, + bool check_dynamic_wa = true); + static std::unordered_set find_unsqueezed_params( const lowered::LinearIRCPtr& linear_ir, const std::unordered_set& brgemms); + static std::vector find_loops_to_split( const lowered::LinearIRCPtr& linear_ir, const std::unordered_set& unsqueezed_params); diff --git a/src/common/snippets/include/snippets/lowered/pass/set_dynamic_wa_to_outermost_loop.hpp b/src/common/snippets/include/snippets/lowered/pass/set_dynamic_wa_to_outermost_loop.hpp new file mode 100644 index 00000000000000..6daeb97ec8c566 --- /dev/null +++ b/src/common/snippets/include/snippets/lowered/pass/set_dynamic_wa_to_outermost_loop.hpp @@ -0,0 +1,30 @@ +// Copyright (C) 2023-2025 Intel Corporation +// SPDX-License-Identifier: Apache-2.0 +// + +#pragma once + +#include "pass.hpp" + +namespace ov { +namespace snippets { +namespace lowered { +namespace pass { + +/** + * @interface SetDynamicWAToOuterMostLoop + * @brief The pass set dynamic work amount to outermost Loop by M in dynamic MHA Subgraphs + * to allow MHAParallelWAOptimizer optimizes parallel work amount in runtime. + * @ingroup snippets + */ +class SetDynamicWAToOuterMostLoop : public Pass { +public: + OPENVINO_RTTI("SetDynamicWAToOuterMostLoop", "", Pass); + SetDynamicWAToOuterMostLoop() = default; + bool run(LinearIR& linear_ir) override; +}; + +} // namespace pass +} // namespace lowered +} // namespace snippets +} // namespace ov diff --git a/src/common/snippets/include/snippets/op/reg_spill.hpp b/src/common/snippets/include/snippets/op/reg_spill.hpp index 84fe0b4da609c1..93ff1738830964 100644 --- a/src/common/snippets/include/snippets/op/reg_spill.hpp +++ b/src/common/snippets/include/snippets/op/reg_spill.hpp @@ -1,4 +1,4 @@ -// Copyright (C) 2018-2024 Intel Corporation +// Copyright (C) 2018-2025 Intel Corporation // SPDX-License-Identifier: Apache-2.0 // diff --git a/src/common/snippets/src/generator.cpp b/src/common/snippets/src/generator.cpp index 144fab766e739b..bb6bd636a791ac 100644 --- a/src/common/snippets/src/generator.cpp +++ b/src/common/snippets/src/generator.cpp @@ -1,4 +1,4 @@ -// Copyright (C) 2018-2024 Intel Corporation +// Copyright (C) 2018-2025 Intel Corporation // SPDX-License-Identifier: Apache-2.0 // diff --git a/src/common/snippets/src/lowered/pass/mha_parallel_wa_optimizer.cpp b/src/common/snippets/src/lowered/pass/mha_parallel_wa_optimizer.cpp index c75d1e86abbfa5..bb01346f4eff7d 100644 --- a/src/common/snippets/src/lowered/pass/mha_parallel_wa_optimizer.cpp +++ b/src/common/snippets/src/lowered/pass/mha_parallel_wa_optimizer.cpp @@ -85,7 +85,9 @@ bool MHAParallelWAOptimizer::run(const lowered::LinearIR& linear_ir) { return true; } -std::unordered_set MHAParallelWAOptimizer::find_applicable_brgemms(const lowered::LinearIRCPtr& linear_ir) { +std::unordered_set MHAParallelWAOptimizer::find_applicable_brgemms( + const lowered::LinearIRCPtr& linear_ir, + bool check_dynamic_wa) { auto is_brgemm = [](const lowered::ExpressionPtr& expr) { return ov::is_type(expr->get_node()); }; @@ -96,12 +98,12 @@ std::unordered_set MHAParallelWAOptimizer::find_applicab brgemm_it = std::find_if(std::next(brgemm_it), linear_ir->end(), is_brgemm); } const auto& loop_manager = linear_ir->get_loop_manager(); - auto applicable_brgemm = [&loop_manager](const lowered::ExpressionPtr& expr) { + auto applicable_brgemm = [&loop_manager, check_dynamic_wa](const lowered::ExpressionPtr& expr) { const auto& loop_idces = expr->get_loop_ids(); if (loop_idces.empty()) return false; const auto& outermost_loop = loop_manager->get_loop_info(loop_idces[0]); - if (!snippets::utils::is_dynamic_value(outermost_loop->get_work_amount())) + if (check_dynamic_wa && !snippets::utils::is_dynamic_value(outermost_loop->get_work_amount())) return false; bool loop_by_m = true; outermost_loop->iterate_through_ports([&loop_by_m](const lowered::LoopPort& port) { diff --git a/src/common/snippets/src/lowered/pass/set_dynamic_wa_to_outermost_loop.cpp b/src/common/snippets/src/lowered/pass/set_dynamic_wa_to_outermost_loop.cpp new file mode 100644 index 00000000000000..8a5db80f577aee --- /dev/null +++ b/src/common/snippets/src/lowered/pass/set_dynamic_wa_to_outermost_loop.cpp @@ -0,0 +1,73 @@ +// Copyright (C) 2023-2025 Intel Corporation +// SPDX-License-Identifier: Apache-2.0 +// + +#include "snippets/lowered/pass/set_dynamic_wa_to_outermost_loop.hpp" + +#include "snippets/lowered/pass/mha_parallel_wa_optimizer.hpp" +#include "snippets/itt.hpp" +#include "snippets/lowered/linear_ir.hpp" +#include "snippets/lowered/loop_manager.hpp" +#include "snippets/op/brgemm.hpp" +#include "snippets/utils/loop_utils.hpp" + +namespace ov { +namespace snippets { +namespace lowered { +namespace pass { + +bool SetDynamicWAToOuterMostLoop::run(LinearIR& linear_ir) { + OV_ITT_SCOPED_TASK(ov::pass::itt::domains::SnippetsTransform, "Snippets::SetDynamicWAToOuterMostLoop") + if (linear_ir.empty() || !linear_ir.is_dynamic() || linear_ir.get_config().m_enable_domain_optimization) + return false; + + const auto linear_ir_ptr = std::make_shared(linear_ir); + const auto brgemms = MHAParallelWAOptimizer::find_applicable_brgemms(linear_ir_ptr, false); + if (brgemms.empty()) + return false; + + const auto unsqueezed_params = MHAParallelWAOptimizer::find_unsqueezed_params(linear_ir_ptr, brgemms); + OPENVINO_ASSERT(!unsqueezed_params.empty(), "unsqueezed_params mustn't be empty after initialization"); + + + const auto& loop_manager = linear_ir_ptr->get_loop_manager(); + std::unordered_set affected_loops; + size_t prev_loop_id = std::numeric_limits::max(); + static const size_t dim_M_idx = 1; + + auto add_affected_loop = [&](const lowered::ExpressionPtr& expr) { + const auto& loop_idces = expr->get_loop_ids(); + if (loop_idces.empty() || loop_idces.front() == prev_loop_id) + return; + + prev_loop_id = loop_idces.front(); + const auto loop_info = loop_manager->get_loop_info(prev_loop_id); + if (loop_info->get_dim_idx() == dim_M_idx) { + affected_loops.insert(loop_info); + } + }; + + size_t i = 0; + std::unordered_set visited; + for (const auto& param : linear_ir_ptr->get_parameters()) { + if (unsqueezed_params.count(i++)) + continue; + utils::visit_path(param, visited, add_affected_loop, false); + } + + bool modified = false; + for (const auto& loop : affected_loops) { + if (!utils::is_dynamic_value(loop->get_work_amount())) { + loop->set_work_amount(utils::get_dynamic_value()); + ov::snippets::utils::update_data_pointer_shifts(loop); + modified = true; + } + } + + return modified; +} + +} // namespace pass +} // namespace lowered +} // namespace snippets +} // namespace ov \ No newline at end of file diff --git a/src/common/snippets/src/op/reg_spill.cpp b/src/common/snippets/src/op/reg_spill.cpp index 0eef459a47ac62..f09b2a419cf3fd 100644 --- a/src/common/snippets/src/op/reg_spill.cpp +++ b/src/common/snippets/src/op/reg_spill.cpp @@ -1,4 +1,4 @@ -// Copyright (C) 2018-2024 Intel Corporation +// Copyright (C) 2018-2025 Intel Corporation // SPDX-License-Identifier: Apache-2.0 // diff --git a/src/common/snippets/src/op/subgraph.cpp b/src/common/snippets/src/op/subgraph.cpp index ecfa72bcb20919..42820889e2f63f 100644 --- a/src/common/snippets/src/op/subgraph.cpp +++ b/src/common/snippets/src/op/subgraph.cpp @@ -54,6 +54,7 @@ #include "snippets/lowered/pass/validate_expanded_loops.hpp" #include "snippets/lowered/pass/set_load_store_scalar.hpp" #include "snippets/lowered/pass/extract_loop_invariants.hpp" +#include "snippets/lowered/pass/set_dynamic_wa_to_outermost_loop.hpp" #include "snippets/lowered/pass/init_registers.hpp" @@ -467,6 +468,7 @@ void Subgraph::control_flow_transformations(size_t min_parallel_work_amount, siz pipeline.register_pass(); pipeline.register_pass(); pipeline.register_pass(); + pipeline.register_pass(); pipeline.register_pass(); pipeline.register_pass(m_linear_ir->get_config().m_are_buffers_optimized); pipeline.register_pass(); diff --git a/src/common/transformations/include/transformations/op_conversions/convert_convertlike.hpp b/src/common/transformations/include/transformations/op_conversions/convert_convertlike.hpp index 5952fc114b76fd..94352953df1e82 100644 --- a/src/common/transformations/include/transformations/op_conversions/convert_convertlike.hpp +++ b/src/common/transformations/include/transformations/op_conversions/convert_convertlike.hpp @@ -1,4 +1,4 @@ -// Copyright (C) 2018-2021 Intel Corporation +// Copyright (C) 2018-2025 Intel Corporation // SPDX-License-Identifier: Apache-2.0 // diff --git a/src/common/transformations/include/transformations/op_conversions/convert_scatter_nd_update15_downgrade.hpp b/src/common/transformations/include/transformations/op_conversions/convert_scatter_nd_update15_downgrade.hpp index 4af9172e6351cb..ea36cfddef4eed 100644 --- a/src/common/transformations/include/transformations/op_conversions/convert_scatter_nd_update15_downgrade.hpp +++ b/src/common/transformations/include/transformations/op_conversions/convert_scatter_nd_update15_downgrade.hpp @@ -1,4 +1,4 @@ -// Copyright (C) 2018-2023 Intel Corporation +// Copyright (C) 2018-2025 Intel Corporation // SPDX-License-Identifier: Apache-2.0 // diff --git a/src/common/transformations/src/transformations/fp16_compression/mark_decompression_convert_constant_folding.cpp b/src/common/transformations/src/transformations/fp16_compression/mark_decompression_convert_constant_folding.cpp index 7724692be61662..8393e0ac1e97f8 100644 --- a/src/common/transformations/src/transformations/fp16_compression/mark_decompression_convert_constant_folding.cpp +++ b/src/common/transformations/src/transformations/fp16_compression/mark_decompression_convert_constant_folding.cpp @@ -1,4 +1,4 @@ -// Copyright (C) 2018-2022 Intel Corporation +// Copyright (C) 2018-2025 Intel Corporation // SPDX-License-Identifier: Apache-2.0 // diff --git a/src/common/transformations/src/transformations/op_conversions/convert_convertlike.cpp b/src/common/transformations/src/transformations/op_conversions/convert_convertlike.cpp index aa80d1e35af1e4..c04260917ca55d 100644 --- a/src/common/transformations/src/transformations/op_conversions/convert_convertlike.cpp +++ b/src/common/transformations/src/transformations/op_conversions/convert_convertlike.cpp @@ -1,4 +1,4 @@ -// Copyright (C) 2018-2021 Intel Corporation +// Copyright (C) 2018-2025 Intel Corporation // SPDX-License-Identifier: Apache-2.0 // diff --git a/src/common/transformations/src/transformations/op_conversions/convert_scatter_nd_update15_downgrade.cpp b/src/common/transformations/src/transformations/op_conversions/convert_scatter_nd_update15_downgrade.cpp index 02bb4cbad5a94b..d72721be467a63 100644 --- a/src/common/transformations/src/transformations/op_conversions/convert_scatter_nd_update15_downgrade.cpp +++ b/src/common/transformations/src/transformations/op_conversions/convert_scatter_nd_update15_downgrade.cpp @@ -1,4 +1,4 @@ -// Copyright (C) 2018-2023 Intel Corporation +// Copyright (C) 2018-2025 Intel Corporation // SPDX-License-Identifier: Apache-2.0 // diff --git a/src/common/transformations/tests/common_optimizations/convert_convertlike.cpp b/src/common/transformations/tests/common_optimizations/convert_convertlike.cpp index 785559e4fef9e6..3ddafc7be0df0c 100644 --- a/src/common/transformations/tests/common_optimizations/convert_convertlike.cpp +++ b/src/common/transformations/tests/common_optimizations/convert_convertlike.cpp @@ -1,4 +1,4 @@ -// Copyright (C) 2018-2021 Intel Corporation +// Copyright (C) 2018-2025 Intel Corporation // SPDX-License-Identifier: Apache-2.0 // diff --git a/src/common/util/include/openvino/util/cpp_version.hpp b/src/common/util/include/openvino/util/cpp_version.hpp index c0998588027c2a..b250df6a38b2a2 100644 --- a/src/common/util/include/openvino/util/cpp_version.hpp +++ b/src/common/util/include/openvino/util/cpp_version.hpp @@ -1,4 +1,4 @@ -// Copyright (C) 2018-2024 Intel Corporation +// Copyright (C) 2018-2025 Intel Corporation // SPDX-License-Identifier: Apache-2.0 // diff --git a/src/common/util/include/openvino/util/file_path.hpp b/src/common/util/include/openvino/util/file_path.hpp index 9080ea5289a51e..34c326e67ec391 100644 --- a/src/common/util/include/openvino/util/file_path.hpp +++ b/src/common/util/include/openvino/util/file_path.hpp @@ -1,4 +1,4 @@ -// Copyright (C) 2018-2024 Intel Corporation +// Copyright (C) 2018-2025 Intel Corporation // SPDX-License-Identifier: Apache-2.0 // diff --git a/src/core/include/openvino/core/any.hpp b/src/core/include/openvino/core/any.hpp index 6f65efb5233ab1..3e41ed51ee9c54 100644 --- a/src/core/include/openvino/core/any.hpp +++ b/src/core/include/openvino/core/any.hpp @@ -536,7 +536,7 @@ class OPENVINO_API Any { template U convert_impl() const; - virtual ~Base() = default; + virtual ~Base(); }; template @@ -611,8 +611,6 @@ class OPENVINO_API Any { template Impl(Args&&... args) : value(std::forward(args)...) {} - virtual ~Impl(){}; - const std::type_info& type_info() const override { return typeid(T); } diff --git a/src/core/include/openvino/core/attribute_adapter.hpp b/src/core/include/openvino/core/attribute_adapter.hpp index 706d3e9e363450..8f00cc6cfd601f 100644 --- a/src/core/include/openvino/core/attribute_adapter.hpp +++ b/src/core/include/openvino/core/attribute_adapter.hpp @@ -34,7 +34,7 @@ class OPENVINO_API ValueAccessor { /// \brief type info enables identification of the value accessor, as well as is_type and /// as_type. virtual const DiscreteTypeInfo& get_type_info() const = 0; - virtual ~ValueAccessor() = default; + virtual ~ValueAccessor(); virtual void set_as_any(const ov::Any& x) { OPENVINO_NOT_IMPLEMENTED; } diff --git a/src/core/include/openvino/core/attribute_visitor.hpp b/src/core/include/openvino/core/attribute_visitor.hpp index f1790cba959c2f..35fb5fb0ccd7e4 100644 --- a/src/core/include/openvino/core/attribute_visitor.hpp +++ b/src/core/include/openvino/core/attribute_visitor.hpp @@ -56,7 +56,7 @@ class VisitorAdapter; /// deserialization. class OPENVINO_API AttributeVisitor { public: - virtual ~AttributeVisitor() = default; + virtual ~AttributeVisitor(); // Must implement these methods /// \brief handles all specialized on_adapter methods implemented by the visitor. /// diff --git a/src/core/include/openvino/core/model.hpp b/src/core/include/openvino/core/model.hpp index 5733209f492377..6ad235062eda36 100644 --- a/src/core/include/openvino/core/model.hpp +++ b/src/core/include/openvino/core/model.hpp @@ -107,7 +107,7 @@ class OPENVINO_API Model : public std::enable_shared_from_this { /// based on traversing the graph from the results and the sinks. Model(const ov::OutputVector& results, const ov::SinkVector& sinks, const std::string& name = ""); - virtual ~Model() = default; + virtual ~Model(); /// Return the number of outputs for this Model. size_t get_output_size() const; diff --git a/src/core/include/openvino/core/preprocess/padding_mode.hpp b/src/core/include/openvino/core/preprocess/padding_mode.hpp index c1391628e8f50b..5d20859397e837 100644 --- a/src/core/include/openvino/core/preprocess/padding_mode.hpp +++ b/src/core/include/openvino/core/preprocess/padding_mode.hpp @@ -1,4 +1,4 @@ -// Copyright (C) 2018-2023 Intel Corporation +// Copyright (C) 2018-2025 Intel Corporation // SPDX-License-Identifier: Apache-2.0 // diff --git a/src/core/include/openvino/core/runtime_attribute.hpp b/src/core/include/openvino/core/runtime_attribute.hpp index 82b860cc99d7ec..86171a81562e90 100644 --- a/src/core/include/openvino/core/runtime_attribute.hpp +++ b/src/core/include/openvino/core/runtime_attribute.hpp @@ -28,7 +28,7 @@ class OPENVINO_API RuntimeAttribute { } using Ptr = std::shared_ptr; using Base = std::tuple<::ov::RuntimeAttribute>; - virtual ~RuntimeAttribute() = default; + virtual ~RuntimeAttribute(); virtual bool is_copyable() const; virtual bool is_copyable(const std::shared_ptr& to) const; virtual Any init(const std::shared_ptr& node) const; diff --git a/src/core/include/openvino/core/type.hpp b/src/core/include/openvino/core/type.hpp index 4877b9ce02b251..812208855fa7f3 100644 --- a/src/core/include/openvino/core/type.hpp +++ b/src/core/include/openvino/core/type.hpp @@ -77,6 +77,10 @@ struct OPENVINO_API DiscreteTypeInfo { OPENVINO_API std::ostream& operator<<(std::ostream& s, const DiscreteTypeInfo& info); +#if defined(__ANDROID__) || defined(ANDROID) +# define OPENVINO_DYNAMIC_CAST +#endif + /// \brief Tests if value is a pointer/shared_ptr that can be statically cast to a /// Type*/shared_ptr template @@ -93,7 +97,11 @@ template typename std::enable_if(std::declval())), Type*>::value, Type*>::type as_type(Value value) { +#ifdef OPENVINO_DYNAMIC_CAST return ov::is_type(value) ? static_cast(value) : nullptr; +#else + return dynamic_cast(value); +#endif } namespace util { @@ -114,7 +122,11 @@ struct AsTypePtr> { /// Type, nullptr otherwise template auto as_type_ptr(const U& value) -> decltype(::ov::util::AsTypePtr::template call(value)) { +#ifdef OPENVINO_DYNAMIC_CAST return ::ov::util::AsTypePtr::template call(value); +#else + return std::dynamic_pointer_cast(value); +#endif } } // namespace ov diff --git a/src/core/include/openvino/op/util/multi_subgraph_base.hpp b/src/core/include/openvino/op/util/multi_subgraph_base.hpp index 5f6053acfcd281..71ba0ebe4f6b35 100644 --- a/src/core/include/openvino/op/util/multi_subgraph_base.hpp +++ b/src/core/include/openvino/op/util/multi_subgraph_base.hpp @@ -20,7 +20,7 @@ class OPENVINO_API MultiSubGraphOp : public ov::op::Sink { OPENVINO_OP("MultiSubGraphOp", "util", ov::op::Sink); /// \brief Abstract class describes a connection between a MultiSubGraphOp input and /// the body. - class InputDescription { + class OPENVINO_API InputDescription { protected: /// /// \brief Constructs a new instance. @@ -34,7 +34,7 @@ class OPENVINO_API MultiSubGraphOp : public ov::op::Sink { public: using Ptr = std::shared_ptr; using type_info_t = DiscreteTypeInfo; - virtual ~InputDescription() = default; + virtual ~InputDescription(); virtual std::shared_ptr copy() const = 0; virtual const type_info_t& get_type_info() const = 0; @@ -45,7 +45,7 @@ class OPENVINO_API MultiSubGraphOp : public ov::op::Sink { /// \brief Abstract class describes how a MultiSubGraphOp output is produced from /// the body. - class OutputDescription { + class OPENVINO_API OutputDescription { protected: /// /// \brief Constructs a new instance. @@ -59,7 +59,7 @@ class OPENVINO_API MultiSubGraphOp : public ov::op::Sink { public: using Ptr = std::shared_ptr; using type_info_t = DiscreteTypeInfo; - virtual ~OutputDescription() = default; + virtual ~OutputDescription(); virtual std::shared_ptr copy() const = 0; virtual const type_info_t& get_type_info() const = 0; diff --git a/src/core/include/openvino/op/util/variable_extension.hpp b/src/core/include/openvino/op/util/variable_extension.hpp index 924bd97c17f9a2..e4f811afe52a8f 100644 --- a/src/core/include/openvino/op/util/variable_extension.hpp +++ b/src/core/include/openvino/op/util/variable_extension.hpp @@ -39,7 +39,7 @@ class OPENVINO_API VariableExtension { virtual std::string get_variable_id() const = 0; protected: - virtual ~VariableExtension(){}; + virtual ~VariableExtension(); protected: std::shared_ptr m_variable; diff --git a/src/core/include/openvino/pass/pass.hpp b/src/core/include/openvino/pass/pass.hpp index fc019859128f25..6440114ab9a8ec 100644 --- a/src/core/include/openvino/pass/pass.hpp +++ b/src/core/include/openvino/pass/pass.hpp @@ -44,7 +44,7 @@ class OPENVINO_API PassBase { public: PassBase(); - virtual ~PassBase() = default; + virtual ~PassBase(); /// Check if this pass has all the pass properties. bool get_property(const PassPropertyMask& prop_mask) const; diff --git a/src/core/include/openvino/pass/pattern/matcher.hpp b/src/core/include/openvino/pass/pattern/matcher.hpp index f39b284702969e..acf7c85841fc09 100644 --- a/src/core/include/openvino/pass/pattern/matcher.hpp +++ b/src/core/include/openvino/pass/pattern/matcher.hpp @@ -108,7 +108,8 @@ class OPENVINO_API Matcher { Matcher(std::shared_ptr pattern_node, const std::string& name); Matcher(std::shared_ptr pattern_node, const std::string& name, bool strict_mode); - virtual ~Matcher() = default; + virtual ~Matcher(); + /// \brief Matches a pattern to \p graph_node /// /// \param graph_value is an input graph to be matched against @@ -176,7 +177,7 @@ class OPENVINO_API Matcher { size_t add_node(Output node); - bool virtual match_value(const ov::Output& pattern_value, const ov::Output& graph_value); + virtual bool match_value(const ov::Output& pattern_value, const ov::Output& graph_value); bool is_strict_mode() { return m_strict_mode; diff --git a/src/core/include/openvino/runtime/allocator.hpp b/src/core/include/openvino/runtime/allocator.hpp index 4180d90b0ce4bf..ae62fb7b290802 100644 --- a/src/core/include/openvino/runtime/allocator.hpp +++ b/src/core/include/openvino/runtime/allocator.hpp @@ -37,7 +37,7 @@ class OPENVINO_API Allocator { friend class ov::Tensor; - struct Base : public std::enable_shared_from_this { + struct OPENVINO_API Base : public std::enable_shared_from_this { virtual void* addressof() = 0; const void* addressof() const { return const_cast(this)->addressof(); @@ -48,7 +48,7 @@ class OPENVINO_API Allocator { virtual bool is_equal(const Base& other) const = 0; protected: - virtual ~Base() = default; + virtual ~Base(); }; template diff --git a/src/core/reference/include/openvino/reference/utils/philox_converter.hpp b/src/core/reference/include/openvino/reference/utils/philox_converter.hpp index 45fbb7d160a247..bf6baaff8af1d4 100644 --- a/src/core/reference/include/openvino/reference/utils/philox_converter.hpp +++ b/src/core/reference/include/openvino/reference/utils/philox_converter.hpp @@ -19,7 +19,7 @@ class PhiloxConverter { public: PhiloxConverter() = delete; - virtual ~PhiloxConverter(){}; + virtual ~PhiloxConverter() = default; /// \brief Returns the number of generated elements per execution /// based on the requested data type. diff --git a/src/core/reference/include/openvino/reference/utils/philox_generator.hpp b/src/core/reference/include/openvino/reference/utils/philox_generator.hpp index f38a947b9ded27..81ea89acf0c55c 100644 --- a/src/core/reference/include/openvino/reference/utils/philox_generator.hpp +++ b/src/core/reference/include/openvino/reference/utils/philox_generator.hpp @@ -30,7 +30,7 @@ class PhiloxGenerator { public: PhiloxGenerator() = delete; - virtual ~PhiloxGenerator(){}; + virtual ~PhiloxGenerator() = default; /// @brief Get a set of 4 random 32-bit unsigned integers based on the seed(s). /// @return A vector with a random set of 4 32-bit unsigned integers. diff --git a/src/core/src/any.cpp b/src/core/src/any.cpp index 1637a139680394..4dd9ce40af5703 100644 --- a/src/core/src/any.cpp +++ b/src/core/src/any.cpp @@ -30,6 +30,8 @@ bool util::equal(std::type_index lhs, std::type_index rhs) { return result; } +Any::Base::~Base() = default; + bool Any::Base::is(const std::type_info& other) const { return util::equal(type_info(), other); } diff --git a/src/core/src/attribute_visitor.cpp b/src/core/src/attribute_visitor.cpp index 63a59591e37839..991e549fa83cf0 100644 --- a/src/core/src/attribute_visitor.cpp +++ b/src/core/src/attribute_visitor.cpp @@ -10,6 +10,10 @@ using namespace std; +ov::ValueAccessor::~ValueAccessor() = default; + +ov::AttributeVisitor::~AttributeVisitor() = default; + void ov::AttributeVisitor::start_structure(const string& name) { m_context.push_back(name); } diff --git a/src/core/src/model.cpp b/src/core/src/model.cpp index c9a25676b9cf2e..44ac9c9177d955 100644 --- a/src/core/src/model.cpp +++ b/src/core/src/model.cpp @@ -221,6 +221,8 @@ ov::Model::Model(const ov::OutputVector& results, const ov::SinkVector& sinks, c ov::Model::Model(const OutputVector& results, const string& name) : Model(results, ov::SinkVector{}, name) {} +ov::Model::~Model() = default; + void ov::Model::prerequirements(bool detect_variables, bool detect_parameters) { OV_ITT_SCOPED_TASK(ov::itt::domains::core, "Model::prerequirements"); diff --git a/src/core/src/op/fake_convert.cpp b/src/core/src/op/fake_convert.cpp index 517674402ef872..71f7aed3f65e8b 100644 --- a/src/core/src/op/fake_convert.cpp +++ b/src/core/src/op/fake_convert.cpp @@ -1,4 +1,4 @@ -// Copyright (C) 2018-2022 Intel Corporation +// Copyright (C) 2018-2025 Intel Corporation // SPDX-License-Identifier: Apache-2.0 // diff --git a/src/core/src/op/util/multi_subgraph_base.cpp b/src/core/src/op/util/multi_subgraph_base.cpp index 6b7f78afcfff86..5e5f84d8ff7353 100644 --- a/src/core/src/op/util/multi_subgraph_base.cpp +++ b/src/core/src/op/util/multi_subgraph_base.cpp @@ -8,10 +8,14 @@ ov::op::util::MultiSubGraphOp::InputDescription::InputDescription(uint64_t input : m_input_index(input_index), m_body_parameter_index(body_parameter_index) {} +ov::op::util::MultiSubGraphOp::InputDescription::~InputDescription() = default; + ov::op::util::MultiSubGraphOp::OutputDescription::OutputDescription(uint64_t body_value_index, uint64_t output_index) : m_body_value_index(body_value_index), m_output_index(output_index) {} +ov::op::util::MultiSubGraphOp::OutputDescription::~OutputDescription() = default; + ov::op::util::MultiSubGraphOp::SliceInputDescription::SliceInputDescription(uint64_t input_index, uint64_t body_parameter_index, int64_t start, diff --git a/src/core/src/op/util/variable_extension.cpp b/src/core/src/op/util/variable_extension.cpp new file mode 100644 index 00000000000000..b49055dbccd8f4 --- /dev/null +++ b/src/core/src/op/util/variable_extension.cpp @@ -0,0 +1,9 @@ +// Copyright (C) 2018-2025 Intel Corporation +// SPDX-License-Identifier: Apache-2.0 +// + +#include "openvino/op/util/variable_extension.hpp" + +using namespace ov::op::util; + +VariableExtension::~VariableExtension() = default; diff --git a/src/core/src/pass/pass.cpp b/src/core/src/pass/pass.cpp index 73a3f7261e5d56..420b8d2729828a 100644 --- a/src/core/src/pass/pass.cpp +++ b/src/core/src/pass/pass.cpp @@ -16,6 +16,8 @@ using namespace std; ov::pass::PassBase::PassBase() : m_property(), m_name(), m_pass_config(std::make_shared()) {} +ov::pass::PassBase::~PassBase() = default; + bool ov::pass::PassBase::get_property(const PassPropertyMask& prop) const { return m_property.is_set(prop); } diff --git a/src/core/src/pattern/matcher.cpp b/src/core/src/pattern/matcher.cpp index 54e153ebbaa962..3681b933cebe14 100644 --- a/src/core/src/pattern/matcher.cpp +++ b/src/core/src/pattern/matcher.cpp @@ -37,6 +37,8 @@ Matcher::Matcher(std::shared_ptr pattern_node, const std::string& name) Matcher::Matcher(std::shared_ptr pattern_node, const std::string& name, bool strict_mode) : Matcher(make_node_output(pattern_node), name, strict_mode) {} +Matcher::~Matcher() = default; + MatcherState::~MatcherState() { if (m_restore) { if (!m_matcher->m_matched_list.empty()) { diff --git a/src/core/src/runtime/allocator.cpp b/src/core/src/runtime/allocator.cpp index 2a1d8a79ad3ddf..729a61d9b0d8dc 100644 --- a/src/core/src/runtime/allocator.cpp +++ b/src/core/src/runtime/allocator.cpp @@ -45,6 +45,8 @@ struct DefaultAllocator { } }; +Allocator::Base::~Base() = default; + Allocator::Allocator() : Allocator{DefaultAllocator{}} {} Allocator::~Allocator() { diff --git a/src/core/src/runtime_attribute.cpp b/src/core/src/runtime_attribute.cpp index e936afd6b29a76..cf67b09cb2b37d 100644 --- a/src/core/src/runtime_attribute.cpp +++ b/src/core/src/runtime_attribute.cpp @@ -9,6 +9,8 @@ namespace ov { +RuntimeAttribute::~RuntimeAttribute() = default; + std::string RuntimeAttribute::to_string() const { return {}; } diff --git a/src/core/tests/pass/serialization/from_model.cpp b/src/core/tests/pass/serialization/from_model.cpp index b1c3f0bad6212c..9999426d6c6431 100644 --- a/src/core/tests/pass/serialization/from_model.cpp +++ b/src/core/tests/pass/serialization/from_model.cpp @@ -1,4 +1,4 @@ -// Copyright (C) 2018-2021 Intel Corporation +// Copyright (C) 2018-2025 Intel Corporation // SPDX-License-Identifier: Apache-2.0 // diff --git a/src/core/tests/rtti.cpp b/src/core/tests/rtti.cpp index 1fd8787ee60f38..9cfa225f4a3010 100644 --- a/src/core/tests/rtti.cpp +++ b/src/core/tests/rtti.cpp @@ -5,10 +5,12 @@ #include "common_test_utils/test_tools.hpp" #include "gtest/gtest.h" #include "openvino/op/op.hpp" +#include "openvino/pass/matcher_pass.hpp" -using namespace ov; using namespace std; +namespace ov::test { + class OpType : public ov::op::Op { public: OPENVINO_OP("OpType"); @@ -88,3 +90,55 @@ TEST(rtti, op_with_type_version_parent_old) { ASSERT_NE(type_info.parent, nullptr); ASSERT_EQ(*type_info.parent, OpType::get_type_info_static()); } + +#if !defined(__ANDROID__) && !defined(ANDROID) + +class IncompleteRtti : public pass::MatcherPass { +public: + OPENVINO_RTTI("IncompleteRtti", "rtti_test"); +}; + +class DerivedIncompleteRtti : public IncompleteRtti { +public: + OPENVINO_RTTI("DerivedIncompleteRtti", "rtti_test", IncompleteRtti); +}; + +// Assert backward compatibility of RTTI definition without parent but casted with as_type or as_type_ptr pointer work. +TEST(rtti, assert_casting_without_parent) { + { + IncompleteRtti incomplete; + DerivedIncompleteRtti derived; + + auto pass_A = as_type(&incomplete); + auto pass_B = as_type(&derived); + auto pass_C = as_type(&derived); + + EXPECT_NE(nullptr, pass_A); + EXPECT_NE(nullptr, pass_B); + EXPECT_NE(nullptr, pass_C); + + EXPECT_NE(nullptr, as_type(pass_A)); + EXPECT_NE(nullptr, as_type(pass_B)); + EXPECT_NE(nullptr, as_type(pass_B)); + EXPECT_NE(nullptr, as_type(pass_C)); + } + { + auto incomplete = std::make_shared(); + auto derived = std::make_shared(); + + auto pass_A = as_type_ptr(incomplete); + auto pass_B = as_type_ptr(derived); + auto pass_C = as_type_ptr(derived); + + EXPECT_NE(nullptr, pass_A); + EXPECT_NE(nullptr, pass_B); + EXPECT_NE(nullptr, pass_C); + + EXPECT_NE(nullptr, as_type_ptr(pass_A)); + EXPECT_NE(nullptr, as_type_ptr(pass_B)); + EXPECT_NE(nullptr, as_type_ptr(pass_B)); + EXPECT_NE(nullptr, as_type_ptr(pass_C)); + } +} +#endif // ANDROID +} // namespace ov::test diff --git a/src/core/tests/type_prop/col2im.cpp b/src/core/tests/type_prop/col2im.cpp index c376cdcf39d264..5532d210f760fc 100644 --- a/src/core/tests/type_prop/col2im.cpp +++ b/src/core/tests/type_prop/col2im.cpp @@ -1,4 +1,4 @@ -// Copyright (C) 2018-2023 Intel Corporation +// Copyright (C) 2018-2025 Intel Corporation // SPDX-License-Identifier: Apache-2.0 // diff --git a/src/core/tests/type_prop/region_yolo.cpp b/src/core/tests/type_prop/region_yolo.cpp index 96dc868a0354f3..5eb2b317d35e7c 100644 --- a/src/core/tests/type_prop/region_yolo.cpp +++ b/src/core/tests/type_prop/region_yolo.cpp @@ -1,4 +1,4 @@ -// Copyright (C) 2018-2021 Intel Corporation +// Copyright (C) 2018-2025 Intel Corporation // SPDX-License-Identifier: Apache-2.0 // diff --git a/src/core/tests/type_prop/rms_norm.cpp b/src/core/tests/type_prop/rms_norm.cpp index ca7155722241b7..97367d9a6a4959 100644 --- a/src/core/tests/type_prop/rms_norm.cpp +++ b/src/core/tests/type_prop/rms_norm.cpp @@ -1,4 +1,4 @@ -// Copyright (C) 2018-2023 Intel Corporation +// Copyright (C) 2018-2025 Intel Corporation // SPDX-License-Identifier: Apache-2.0 // diff --git a/src/core/tests/type_prop/slice_scatter.cpp b/src/core/tests/type_prop/slice_scatter.cpp index fad6dd70349606..2be2d73d6e23fd 100644 --- a/src/core/tests/type_prop/slice_scatter.cpp +++ b/src/core/tests/type_prop/slice_scatter.cpp @@ -1,4 +1,4 @@ -// Copyright (C) 2018-2023 Intel Corporation +// Copyright (C) 2018-2025 Intel Corporation // SPDX-License-Identifier: Apache-2.0 // diff --git a/src/core/tests/type_prop/stft.cpp b/src/core/tests/type_prop/stft.cpp index 2969af4e5a43bd..4ee5098797d3c8 100644 --- a/src/core/tests/type_prop/stft.cpp +++ b/src/core/tests/type_prop/stft.cpp @@ -1,4 +1,4 @@ -// Copyright (C) 2018-2023 Intel Corporation +// Copyright (C) 2018-2025 Intel Corporation // SPDX-License-Identifier: Apache-2.0 // diff --git a/src/core/tests/type_prop/string_tensor_pack.cpp b/src/core/tests/type_prop/string_tensor_pack.cpp index a81aa8eeb1ffd4..4d40f9a3782c15 100644 --- a/src/core/tests/type_prop/string_tensor_pack.cpp +++ b/src/core/tests/type_prop/string_tensor_pack.cpp @@ -1,4 +1,4 @@ -// Copyright (C) 2018-2023 Intel Corporation +// Copyright (C) 2018-2025 Intel Corporation // SPDX-License-Identifier: Apache-2.0 // diff --git a/src/core/tests/type_prop/string_tensor_unpack.cpp b/src/core/tests/type_prop/string_tensor_unpack.cpp index afdd44706635f5..37efe08b81120a 100644 --- a/src/core/tests/type_prop/string_tensor_unpack.cpp +++ b/src/core/tests/type_prop/string_tensor_unpack.cpp @@ -1,4 +1,4 @@ -// Copyright (C) 2018-2023 Intel Corporation +// Copyright (C) 2018-2025 Intel Corporation // SPDX-License-Identifier: Apache-2.0 // diff --git a/src/frontends/common/include/openvino/frontend/decoder.hpp b/src/frontends/common/include/openvino/frontend/decoder.hpp index 46afa8aee1cfe9..7794cc23b94b04 100644 --- a/src/frontends/common/include/openvino/frontend/decoder.hpp +++ b/src/frontends/common/include/openvino/frontend/decoder.hpp @@ -49,9 +49,9 @@ struct Union; } // namespace type /// Plays a role of node, block and module decoder -class IDecoder { +class FRONTEND_API IDecoder { public: - virtual ~IDecoder() = default; + virtual ~IDecoder(); }; class FRONTEND_API DecoderBase : public IDecoder { diff --git a/src/frontends/common/include/openvino/frontend/graph_iterator.hpp b/src/frontends/common/include/openvino/frontend/graph_iterator.hpp index 054173f1f41bdb..9b05849c78e8a1 100644 --- a/src/frontends/common/include/openvino/frontend/graph_iterator.hpp +++ b/src/frontends/common/include/openvino/frontend/graph_iterator.hpp @@ -34,9 +34,6 @@ class FRONTEND_API GraphIterator : ::ov::RuntimeAttribute { /// \brief Return a pointer to a decoder of the current node virtual std::shared_ptr get_decoder() const = 0; - /// \brief Destructor - virtual ~GraphIterator() = default; - /// \brief Checks if the main model graph contains a function of the requested name in the library /// Returns GraphIterator to this function and nullptr, if it does not exist virtual std::shared_ptr get_body_graph_iterator(const std::string& func_name) const = 0; @@ -48,14 +45,10 @@ class FRONTEND_API GraphIterator : ::ov::RuntimeAttribute { virtual std::vector get_output_names() const = 0; /// \brief Returns a map from internal tensor name to (user-defined) external name for inputs - virtual std::map get_input_names_map() const { - return {}; - } + virtual std::map get_input_names_map() const; /// \brief Returns a map from internal tensor name to (user-defined) external name for outputs - virtual std::map get_output_names_map() const { - return {}; - } + virtual std::map get_output_names_map() const; }; } // namespace tensorflow diff --git a/src/frontends/common/include/openvino/frontend/input_model.hpp b/src/frontends/common/include/openvino/frontend/input_model.hpp index f679a28d41aca5..5ea01dba5ea97a 100644 --- a/src/frontends/common/include/openvino/frontend/input_model.hpp +++ b/src/frontends/common/include/openvino/frontend/input_model.hpp @@ -51,7 +51,7 @@ class FRONTEND_API InputModel { InputModel& operator=(const InputModel&) = delete; InputModel& operator=(InputModel&&) = delete; - virtual ~InputModel() = default; + virtual ~InputModel(); ///// Searching for places ///// diff --git a/src/frontends/common/include/openvino/frontend/node_context.hpp b/src/frontends/common/include/openvino/frontend/node_context.hpp index 2fb607f3644b16..9d6bb78789298b 100644 --- a/src/frontends/common/include/openvino/frontend/node_context.hpp +++ b/src/frontends/common/include/openvino/frontend/node_context.hpp @@ -18,7 +18,7 @@ class FRONTEND_API NodeContext { public: // TODO: Why this ctor is explicit when get_op_type is virtual so m_op_type looks to be a custom implementation explicit NodeContext(const std::string& op_type) : m_op_type(op_type) {} - virtual ~NodeContext() = default; + virtual ~NodeContext(); /// \brief Returns a number of inputs virtual size_t get_input_size() const { diff --git a/src/frontends/common/include/openvino/frontend/place.hpp b/src/frontends/common/include/openvino/frontend/place.hpp index ecaed4cd93b2da..be661149dc09e5 100644 --- a/src/frontends/common/include/openvino/frontend/place.hpp +++ b/src/frontends/common/include/openvino/frontend/place.hpp @@ -61,7 +61,7 @@ class FRONTEND_API Place { public: typedef std::shared_ptr Ptr; - virtual ~Place() = 0; + virtual ~Place(); /// \brief All associated names (synonyms) that identify this place in the graph in a /// framework specific way diff --git a/src/frontends/common/src/decoder.cpp b/src/frontends/common/src/decoder.cpp index b9f4b27da2ce99..f793a3fd2f47e7 100644 --- a/src/frontends/common/src/decoder.cpp +++ b/src/frontends/common/src/decoder.cpp @@ -6,4 +6,6 @@ using namespace ov::frontend; -DecoderBase::~DecoderBase() = default; \ No newline at end of file +IDecoder::~IDecoder() = default; + +DecoderBase::~DecoderBase() = default; diff --git a/src/frontends/common/src/graph_iterator.cpp b/src/frontends/common/src/graph_iterator.cpp new file mode 100644 index 00000000000000..1a97e35448cf06 --- /dev/null +++ b/src/frontends/common/src/graph_iterator.cpp @@ -0,0 +1,15 @@ +// Copyright (C) 2018-2025 Intel Corporation +// SPDX-License-Identifier: Apache-2.0 +// + +#include "openvino/frontend/graph_iterator.hpp" + +using namespace ov::frontend::tensorflow; + +std::map GraphIterator::get_input_names_map() const { + return {}; +} + +std::map GraphIterator::get_output_names_map() const { + return {}; +} diff --git a/src/frontends/common/src/hash_table.cpp b/src/frontends/common/src/hash_table.cpp index f01abd3c9d5bbe..4c8a465e4152a8 100644 --- a/src/frontends/common/src/hash_table.cpp +++ b/src/frontends/common/src/hash_table.cpp @@ -6,4 +6,4 @@ using namespace ov::frontend; -HashTable::~HashTable(){}; +HashTable::~HashTable() = default; diff --git a/src/frontends/common/src/input_model.cpp b/src/frontends/common/src/input_model.cpp index f2c52f2eb696d1..11d474aaec4bcb 100644 --- a/src/frontends/common/src/input_model.cpp +++ b/src/frontends/common/src/input_model.cpp @@ -12,6 +12,8 @@ using namespace ov; using namespace ov::frontend; +InputModel::~InputModel() = default; + std::vector InputModel::get_inputs() const { if (!m_actual) { return {}; diff --git a/src/frontends/common/src/node_context.cpp b/src/frontends/common/src/node_context.cpp new file mode 100644 index 00000000000000..91c8c8c911ca9e --- /dev/null +++ b/src/frontends/common/src/node_context.cpp @@ -0,0 +1,9 @@ +// Copyright (C) 2018-2025 Intel Corporation +// SPDX-License-Identifier: Apache-2.0 +// + +#include "openvino/frontend/node_context.hpp" + +using namespace ov::frontend; + +NodeContext::~NodeContext() = default; diff --git a/src/frontends/common/src/variable.cpp b/src/frontends/common/src/variable.cpp index 9c82520d568bd2..b0fb30280080f3 100644 --- a/src/frontends/common/src/variable.cpp +++ b/src/frontends/common/src/variable.cpp @@ -6,4 +6,4 @@ using namespace ov::frontend; -Variable::~Variable(){}; +Variable::~Variable() = default; diff --git a/src/frontends/ir/tests/meta_data_tests.cpp b/src/frontends/ir/tests/meta_data_tests.cpp index eba4f38af67913..2af1e0114222b9 100644 --- a/src/frontends/ir/tests/meta_data_tests.cpp +++ b/src/frontends/ir/tests/meta_data_tests.cpp @@ -1,4 +1,4 @@ -// Copyright (C) 2018-2021 Intel Corporation +// Copyright (C) 2018-2025 Intel Corporation // SPDX-License-Identifier: Apache-2.0 // diff --git a/src/frontends/ir/tests/threading_tests.cpp b/src/frontends/ir/tests/threading_tests.cpp index 7dc1ca193ddb97..a83d53b5151305 100644 --- a/src/frontends/ir/tests/threading_tests.cpp +++ b/src/frontends/ir/tests/threading_tests.cpp @@ -1,4 +1,4 @@ -// Copyright (C) 2018-2021 Intel Corporation +// Copyright (C) 2018-2025 Intel Corporation // SPDX-License-Identifier: Apache-2.0 // diff --git a/src/frontends/onnx/frontend/src/op/com.microsoft/dynamic_quantize_matmul.cpp b/src/frontends/onnx/frontend/src/op/com.microsoft/dynamic_quantize_matmul.cpp index 147e45301316a3..85700bddcfc01c 100644 --- a/src/frontends/onnx/frontend/src/op/com.microsoft/dynamic_quantize_matmul.cpp +++ b/src/frontends/onnx/frontend/src/op/com.microsoft/dynamic_quantize_matmul.cpp @@ -1,4 +1,4 @@ -// Copyright (C) 2018-2024 Intel Corporation +// Copyright (C) 2018-2025 Intel Corporation // SPDX-License-Identifier: Apache-2.0 // diff --git a/src/frontends/onnx/frontend/src/op/dequantize_linear.cpp b/src/frontends/onnx/frontend/src/op/dequantize_linear.cpp index a80e6a77f430e2..4705504699158b 100644 --- a/src/frontends/onnx/frontend/src/op/dequantize_linear.cpp +++ b/src/frontends/onnx/frontend/src/op/dequantize_linear.cpp @@ -255,6 +255,8 @@ ov::OutputVector dequantize_linear(const ov::frontend::onnx::Node& node) { if (zp.get_node_shared_ptr()) { broadcastable_x = std::make_shared(x, zp); + } else { + broadcastable_x = x; } const auto& scaled_x = std::make_shared(broadcastable_x, scale); diff --git a/src/frontends/onnx/frontend/src/op/unique.cpp b/src/frontends/onnx/frontend/src/op/unique.cpp index bc842624474ccd..c1d0886181af4a 100644 --- a/src/frontends/onnx/frontend/src/op/unique.cpp +++ b/src/frontends/onnx/frontend/src/op/unique.cpp @@ -1,4 +1,4 @@ -// Copyright (C) 2018-2022 Intel Corporation +// Copyright (C) 2018-2025 Intel Corporation // SPDX-License-Identifier: Apache-2.0 // diff --git a/src/frontends/onnx/frontend/src/utils/norm.hpp b/src/frontends/onnx/frontend/src/utils/norm.hpp index 964becc2f0db04..656dcd8ed1cd1a 100644 --- a/src/frontends/onnx/frontend/src/utils/norm.hpp +++ b/src/frontends/onnx/frontend/src/utils/norm.hpp @@ -1,4 +1,4 @@ -// Copyright (C) 2018-2022 Intel Corporation +// Copyright (C) 2018-2025 Intel Corporation // SPDX-License-Identifier: Apache-2.0 // #pragma once diff --git a/src/frontends/onnx/frontend/src/utils/split.hpp b/src/frontends/onnx/frontend/src/utils/split.hpp index 5cdbaf287eb90b..809d2aec8d2d28 100644 --- a/src/frontends/onnx/frontend/src/utils/split.hpp +++ b/src/frontends/onnx/frontend/src/utils/split.hpp @@ -1,4 +1,4 @@ -// Copyright (C) 2018-2022 Intel Corporation +// Copyright (C) 2018-2025 Intel Corporation // SPDX-License-Identifier: Apache-2.0 // #pragma once diff --git a/src/frontends/onnx/tests/conversion.cpp b/src/frontends/onnx/tests/conversion.cpp index 237712e60b2725..94d735761b30a6 100644 --- a/src/frontends/onnx/tests/conversion.cpp +++ b/src/frontends/onnx/tests/conversion.cpp @@ -1,4 +1,4 @@ -// Copyright (C) 2018-2021 Intel Corporation +// Copyright (C) 2018-2025 Intel Corporation // SPDX-License-Identifier: Apache-2.0 // diff --git a/src/frontends/onnx/tests/models/dequantize_linear_21_no_zero_point.prototxt b/src/frontends/onnx/tests/models/dequantize_linear_21_no_zero_point.prototxt new file mode 100644 index 00000000000000..ab276f3b4d7c78 --- /dev/null +++ b/src/frontends/onnx/tests/models/dequantize_linear_21_no_zero_point.prototxt @@ -0,0 +1,55 @@ +ir_version: 3 +producer_name: "OpenVINO ONNX Frontend" +graph { + name: "test_dequantize_21" + initializer { + dims: 6 + dims: 3 + data_type: 21 + name: "data" + raw_data: "\x21\x43\x65\x87\xA9\xCB\xED\xFF\x00" + } + initializer { + dims: 2 + dims: 3 + data_type: 1 + name: "scale" + raw_data: "\x00\x00\x80\x3f\x00\x00\x80\x3f\x00\x00\x80\x3f\x00\x00\x80\x3f\x00\x00\x80\x3f\x00\x00\x80\x3f" + } + node { + input: "data" + input: "scale" + output: "output" + name: "DequantizeNode" + op_type: "DequantizeLinear" + attribute { + name: "axis" + i: 0 + type: INT + } + attribute { + name: "block_size" + i: 3 + type: INT + } + } + output { + name: "output" + type { + tensor_type { + elem_type: 1 + shape { + dim { + dim_value: 6 + } + dim { + dim_value: 3 + } + } + } + } + } +} +opset_import { + version: 21 +} diff --git a/src/frontends/onnx/tests/onnx_import_quant.in.cpp b/src/frontends/onnx/tests/onnx_import_quant.in.cpp index 793eb73772880a..166898988a59e4 100644 --- a/src/frontends/onnx/tests/onnx_import_quant.in.cpp +++ b/src/frontends/onnx/tests/onnx_import_quant.in.cpp @@ -191,6 +191,17 @@ OPENVINO_TEST(${BACKEND_NAME}, onnx_model_dequantize_linear_no_zero_point) { test_case.run(); } +OPENVINO_TEST(${BACKEND_NAME}, onnx_model_dequantize_linear_21_no_zero_point) { + auto model = convert_model("dequantize_linear_21_no_zero_point.onnx"); + + auto test_case = ov::test::TestCase(model, s_device); + + test_case.add_expected_output( + {6, 3}, + std::vector{1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 15, 0, 0}); + test_case.run(); +} + OPENVINO_TEST(${BACKEND_NAME}, onnx_model_dequantize_linear_scalar_zero_scale_uint8) { auto model = convert_model("dequantize_linear_0.onnx"); diff --git a/src/frontends/paddle/include/openvino/frontend/paddle/extension/op.hpp b/src/frontends/paddle/include/openvino/frontend/paddle/extension/op.hpp index 68cea85c19cc44..5dc1499a39080e 100644 --- a/src/frontends/paddle/include/openvino/frontend/paddle/extension/op.hpp +++ b/src/frontends/paddle/include/openvino/frontend/paddle/extension/op.hpp @@ -1,4 +1,4 @@ -// Copyright (C) 2018-2022 Intel Corporation +// Copyright (C) 2018-2025 Intel Corporation // SPDX-License-Identifier: Apache-2.0 // diff --git a/src/frontends/paddle/src/internal/pass/transform_fakequantize.cpp b/src/frontends/paddle/src/internal/pass/transform_fakequantize.cpp index 4ab7557c4be2cb..d4d933721ee200 100644 --- a/src/frontends/paddle/src/internal/pass/transform_fakequantize.cpp +++ b/src/frontends/paddle/src/internal/pass/transform_fakequantize.cpp @@ -1,4 +1,4 @@ -// Copyright (C) 2018-2022 Intel Corporation +// Copyright (C) 2018-2025 Intel Corporation // SPDX-License-Identifier: Apache-2.0 // diff --git a/src/frontends/paddle/src/internal/pass/transform_fakequantize.hpp b/src/frontends/paddle/src/internal/pass/transform_fakequantize.hpp index 19abfcbf260d73..23f73f53597a43 100644 --- a/src/frontends/paddle/src/internal/pass/transform_fakequantize.hpp +++ b/src/frontends/paddle/src/internal/pass/transform_fakequantize.hpp @@ -1,4 +1,4 @@ -// Copyright (C) 2018-2022 Intel Corporation +// Copyright (C) 2018-2025 Intel Corporation // SPDX-License-Identifier: Apache-2.0 // diff --git a/src/frontends/paddle/src/op/dequantize_linear.cpp b/src/frontends/paddle/src/op/dequantize_linear.cpp index 271b938c17ab43..f30055bf889bca 100644 --- a/src/frontends/paddle/src/op/dequantize_linear.cpp +++ b/src/frontends/paddle/src/op/dequantize_linear.cpp @@ -1,4 +1,4 @@ -// Copyright (C) 2018-2022 Intel Corporation +// Copyright (C) 2018-2025 Intel Corporation // SPDX-License-Identifier: Apache-2.0 // diff --git a/src/frontends/paddle/src/op/generate_proposals_v2.cpp b/src/frontends/paddle/src/op/generate_proposals_v2.cpp index 2df436357bbb22..47547fd46a778b 100644 --- a/src/frontends/paddle/src/op/generate_proposals_v2.cpp +++ b/src/frontends/paddle/src/op/generate_proposals_v2.cpp @@ -1,4 +1,4 @@ -// Copyright (C) 2018-2021 Intel Corporation +// Copyright (C) 2018-2025 Intel Corporation // SPDX-License-Identifier: Apache-2.0 // diff --git a/src/frontends/paddle/src/op/quantize_linear.cpp b/src/frontends/paddle/src/op/quantize_linear.cpp index 99e12cd4d0efb4..43fcabd3747819 100644 --- a/src/frontends/paddle/src/op/quantize_linear.cpp +++ b/src/frontends/paddle/src/op/quantize_linear.cpp @@ -1,4 +1,4 @@ -// Copyright (C) 2018-2022 Intel Corporation +// Copyright (C) 2018-2025 Intel Corporation // SPDX-License-Identifier: Apache-2.0 // diff --git a/src/frontends/paddle/src/op/round.cpp b/src/frontends/paddle/src/op/round.cpp index f981fa1e841843..5ce02ffe89bde9 100644 --- a/src/frontends/paddle/src/op/round.cpp +++ b/src/frontends/paddle/src/op/round.cpp @@ -1,4 +1,4 @@ -// Copyright (C) 2018-2023 Intel Corporation +// Copyright (C) 2018-2025 Intel Corporation // SPDX-License-Identifier: Apache-2.0 // diff --git a/src/frontends/paddle/src/op/top_k_v2.cpp b/src/frontends/paddle/src/op/top_k_v2.cpp index 8f51920f05d1a2..cfb113c7a55102 100644 --- a/src/frontends/paddle/src/op/top_k_v2.cpp +++ b/src/frontends/paddle/src/op/top_k_v2.cpp @@ -1,4 +1,4 @@ -// Copyright (C) 2018-2021 Intel Corporation +// Copyright (C) 2018-2025 Intel Corporation // SPDX-License-Identifier: Apache-2.0 // #include "default_opset.hpp" diff --git a/src/frontends/paddle/tests/conversion.cpp b/src/frontends/paddle/tests/conversion.cpp index 9bcbf9b855765c..c2ad29a42a3303 100644 --- a/src/frontends/paddle/tests/conversion.cpp +++ b/src/frontends/paddle/tests/conversion.cpp @@ -1,4 +1,4 @@ -// Copyright (C) 2018-2021 Intel Corporation +// Copyright (C) 2018-2025 Intel Corporation // SPDX-License-Identifier: Apache-2.0 // diff --git a/src/frontends/paddle/tests/op_extension.cpp b/src/frontends/paddle/tests/op_extension.cpp index e8843c10c475bc..cbd05bb1f1d212 100644 --- a/src/frontends/paddle/tests/op_extension.cpp +++ b/src/frontends/paddle/tests/op_extension.cpp @@ -1,4 +1,4 @@ -// Copyright (C) 2018-2022 Intel Corporation +// Copyright (C) 2018-2025 Intel Corporation // SPDX-License-Identifier: Apache-2.0 // diff --git a/src/frontends/paddle/tests/test_models/gen_scripts/generate_roll.py b/src/frontends/paddle/tests/test_models/gen_scripts/generate_roll.py index 6c53d8091169fc..356f2809a10237 100644 --- a/src/frontends/paddle/tests/test_models/gen_scripts/generate_roll.py +++ b/src/frontends/paddle/tests/test_models/gen_scripts/generate_roll.py @@ -1,4 +1,4 @@ -# Copyright (C) 2018-2023 Intel Corporation +# Copyright (C) 2018-2025 Intel Corporation # SPDX-License-Identifier: Apache-2.0 # diff --git a/src/frontends/paddle/tests/test_models/gen_scripts/generate_round.py b/src/frontends/paddle/tests/test_models/gen_scripts/generate_round.py index c19492373a3280..1b95b7c7406d99 100644 --- a/src/frontends/paddle/tests/test_models/gen_scripts/generate_round.py +++ b/src/frontends/paddle/tests/test_models/gen_scripts/generate_round.py @@ -1,4 +1,4 @@ -# Copyright (C) 2018-2023 Intel Corporation +# Copyright (C) 2018-2025 Intel Corporation # SPDX-License-Identifier: Apache-2.0 # diff --git a/src/frontends/pytorch/src/frontend.cpp b/src/frontends/pytorch/src/frontend.cpp index 04ba9a9c92c281..6debdb8c33311e 100644 --- a/src/frontends/pytorch/src/frontend.cpp +++ b/src/frontends/pytorch/src/frontend.cpp @@ -30,7 +30,6 @@ #include "transforms/dict_resolver.hpp" #include "transforms/einsum_list_construct.hpp" #include "transforms/index_loop_getitem_replacer.hpp" -#include "transforms/irfftn_complex_replacer.hpp" #include "transforms/listconstruct_replacer.hpp" #include "transforms/min_max_prim_list_construct_replacer.hpp" #include "transforms/prim_list_construct_pad.hpp" @@ -40,7 +39,6 @@ #include "transforms/quantized_node_remover.hpp" #include "transforms/remove_packing_ops.hpp" #include "transforms/reverseprop_resolver.hpp" -#include "transforms/rfftn_complex_replacer.hpp" #include "transforms/softmax_reshape_elimination.hpp" #include "transforms/string_equality_replacer.hpp" #include "transforms/torchfx_gptq_pattern_replacer.hpp" @@ -69,6 +67,11 @@ std::map get_unconverted_types_from_model(const std::s if (!unconverted_ops_types.count(op_type_it->second)) { unconverted_ops_types.emplace(op_type_it->second, std::move(exception_msg)); } + } else if (const auto& fw_node = ov::as_type_ptr(node)) { + auto op_type = std::string(fw_node->get_type_name()); + if (!unconverted_ops_types.count(op_type)) { + unconverted_ops_types.emplace(op_type, "This is OpenVINO internal type."); + } } if (const auto& fw_node = ov::as_type_ptr(node)) { for (size_t i = 0; i < fw_node->get_internal_subgraphs_size(); ++i) { @@ -283,8 +286,6 @@ void FrontEnd::normalize(const std::shared_ptr& model) const { manager.register_pass(); manager.register_pass(); manager.register_pass(); - manager.register_pass(); - manager.register_pass(); manager.register_pass(); manager.register_pass(); manager.register_pass(); @@ -396,7 +397,7 @@ ov::frontend::InputModel::Ptr FrontEnd::load_impl(const std::vector& va size_t extra_variants_num = variants.size() > 0 && variants[variants.size() - 1].is() ? 1 : 0; FRONT_END_GENERAL_CHECK(variants.size() == 1 + extra_variants_num, "PyTorch Frontend supports exactly one parameter in model representation, got ", - std::to_string(variants.size()), + variants.size(), " instead."); FRONT_END_GENERAL_CHECK(variants[0].is>(), "PyTorch Frontend doesn't support provided model type. Please provide supported model " diff --git a/src/frontends/pytorch/src/op/any.cpp b/src/frontends/pytorch/src/op/any.cpp index a17b8777e5f916..09941914065bdd 100644 --- a/src/frontends/pytorch/src/op/any.cpp +++ b/src/frontends/pytorch/src/op/any.cpp @@ -1,4 +1,4 @@ -// Copyright (C) 2018-2023 Intel Corporation +// Copyright (C) 2018-2025 Intel Corporation // SPDX-License-Identifier: Apache-2.0 // diff --git a/src/frontends/pytorch/src/op/bernoulli.cpp b/src/frontends/pytorch/src/op/bernoulli.cpp new file mode 100644 index 00000000000000..7a408fce610ec1 --- /dev/null +++ b/src/frontends/pytorch/src/op/bernoulli.cpp @@ -0,0 +1,82 @@ +// Copyright (C) 2018-2025 Intel Corporation +// SPDX-License-Identifier: Apache-2.0 +// + +#include "openvino/frontend/pytorch/node_context.hpp" +#include "openvino/op/constant.hpp" +#include "openvino/op/convert_like.hpp" +#include "openvino/op/less.hpp" +#include "openvino/op/random_uniform.hpp" +#include "openvino/op/shape_of.hpp" +#include "utils.hpp" + +namespace ov { +namespace frontend { +namespace pytorch { +namespace op { + +using namespace ov; +using namespace ov::op; + +OutputVector translate_bernoulli(const NodeContext& context) { + // supported signatures: + // 1. aten::bernoulli(input, *, Generator? generator=None) -> Tensor + // 2. aten::bernoulli(input, *, Generator? generator=None, Tensor(a!) out) -> Tensor(a!) + // 3. aten::bernoulli(input, float p, *, Generator? generator=None) -> Tensor + num_inputs_check(context, 1, 3); + uint64_t global_seed = 0; + auto input = context.get_input(0); + auto input_type = input.get_element_type().is_static() ? input.get_element_type() : element::f64; + auto input_shape = context.mark_node(std::make_shared(input, element::i32)); + auto probs_threshold = input; + + bool with_p = false; + size_t gen_ind = 1; + if (!context.input_is_none(1)) { + auto p = context.get_input(1); + with_p = p.get_element_type().is_real() ? true : false; + if (with_p) { + // need to override probs thresholds and samples type + input_type = p.get_element_type().is_static() ? p.get_element_type() : element::f64; + gen_ind = 2; + probs_threshold = p; + } + } + + if (!context.input_is_none(gen_ind)) { + // retrieve seed set to Generator + auto gen_const = as_type_ptr(context.get_input(static_cast(gen_ind)).get_node_shared_ptr()); + PYTORCH_OP_CONVERSION_CHECK(gen_const, "aten::bernoulli expects a constant representing a generator seed"); + auto seed = gen_const->cast_vector(); + global_seed = seed.size() > 0 ? seed[0] : global_seed; + } + + // generate tensor of input shape with elements sampled from u ~ RandomUniform(0, 1) distribution + // I[u < input] will represent samples of bernoulli distribution with parameter `input` + auto const_zero = context.mark_node(std::make_shared(input_type, Shape{}, 0.0f)); + auto const_one = context.mark_node(std::make_shared(input_type, Shape{}, 1.0f)); + auto ru_samples = context.mark_node(std::make_shared(input_shape, + const_zero, + const_one, + input_type, + global_seed, + 0, + PhiloxAlignment::PYTORCH)); + if (!input.get_element_type().is_static()) { + ru_samples = context.mark_node(std::make_shared(ru_samples, probs_threshold)); + } + auto bernoulli_samples = context.mark_node(std::make_shared(ru_samples, probs_threshold)); + + if (!with_p && !context.input_is_none(2)) { + auto out = context.get_input(2); + bernoulli_samples = context.mark_node(std::make_shared(bernoulli_samples, out)); + context.mutate_input(2, bernoulli_samples); + } else { + bernoulli_samples = context.mark_node(std::make_shared(bernoulli_samples, input)); + } + return {bernoulli_samples}; +}; +} // namespace op +} // namespace pytorch +} // namespace frontend +} // namespace ov diff --git a/src/frontends/pytorch/src/op/complex.cpp b/src/frontends/pytorch/src/op/complex.cpp new file mode 100644 index 00000000000000..8ec0f5435e358b --- /dev/null +++ b/src/frontends/pytorch/src/op/complex.cpp @@ -0,0 +1,84 @@ +// Copyright (C) 2018-2025 Intel Corporation +// SPDX-License-Identifier: Apache-2.0 +// + +#include "openvino/frontend/complex_type_mark.hpp" +#include "openvino/frontend/pytorch/node_context.hpp" +#include "openvino/op/concat.hpp" +#include "openvino/op/split.hpp" +#include "openvino/op/squeeze.hpp" +#include "openvino/op/unsqueeze.hpp" +#include "utils.hpp" + +namespace ov { +namespace frontend { +namespace pytorch { +namespace op { + +using namespace ov::op; + +OutputVector translate_complex(const NodeContext& context) { + num_inputs_check(context, 2, 2); + auto real = context.get_input(0); + auto imag = context.get_input(1); + + auto const_neg_1 = context.mark_node(v0::Constant::create(element::i32, Shape{}, {-1})); + real = context.mark_node(std::make_shared(real, const_neg_1)); + imag = context.mark_node(std::make_shared(imag, const_neg_1)); + + auto complex = context.mark_node(std::make_shared(OutputVector{real, imag}, -1)); + + return {context.mark_node(std::make_shared(complex, complex->get_element_type()))}; +}; + +OutputVector translate_imag(const NodeContext& context) { + num_inputs_check(context, 1, 1, true); + auto complex = context.get_input(0); + + auto complex_type_mark = as_type_ptr(complex.get_node_shared_ptr()); + PYTORCH_OP_CONVERSION_CHECK(complex_type_mark, "aten::imag operation expects complex type tensor on input."); + + complex = complex_type_mark->input_value(0); + auto axis = context.mark_node(v0::Constant::create(element::i32, Shape{}, {-1})); + auto imag = context.mark_node(std::make_shared(complex, axis, 2))->output(1); + + auto const_neg_1 = context.mark_node(v0::Constant::create(element::i32, Shape{}, {-1})); + return {context.mark_node(std::make_shared(imag, const_neg_1))}; +}; + +OutputVector translate_real(const NodeContext& context) { + num_inputs_check(context, 1, 1, true); + auto complex = context.get_input(0); + + auto complex_type_mark = as_type_ptr(complex.get_node_shared_ptr()); + PYTORCH_OP_CONVERSION_CHECK(complex_type_mark, "aten::real operation expects complex type tensor on input."); + + complex = complex_type_mark->input_value(0); + auto axis = context.mark_node(v0::Constant::create(element::i32, Shape{}, {-1})); + auto real = context.mark_node(std::make_shared(complex, axis, 2))->output(0); + + auto const_neg_1 = context.mark_node(v0::Constant::create(element::i32, Shape{}, {-1})); + return {context.mark_node(std::make_shared(real, const_neg_1))}; +}; + +OutputVector translate_view_as_real(const NodeContext& context) { + num_inputs_check(context, 1, 1, true); + auto complex = context.get_input(0); + + auto complex_type_mark = as_type_ptr(complex.get_node_shared_ptr()); + PYTORCH_OP_CONVERSION_CHECK(complex_type_mark, "aten::real operation expects complex type tensor on input."); + + return {complex_type_mark->input_value(0)}; +}; + +OutputVector translate_view_as_complex(const NodeContext& context) { + num_inputs_check(context, 1, 1); + auto complex = context.get_input(0); + + return {context.mark_node(std::make_shared(complex, complex.get_element_type()))}; +}; + +} // namespace op +} // namespace pytorch +} // namespace frontend +} // namespace ov diff --git a/src/frontends/pytorch/src/op/fft.cpp b/src/frontends/pytorch/src/op/fft.cpp new file mode 100644 index 00000000000000..0c2eb17c49d305 --- /dev/null +++ b/src/frontends/pytorch/src/op/fft.cpp @@ -0,0 +1,208 @@ +// Copyright (C) 2018-2025 Intel Corporation +// SPDX-License-Identifier: Apache-2.0 +// + +#include "openvino/frontend/complex_type_mark.hpp" +#include "openvino/frontend/pytorch/node_context.hpp" +#include "openvino/op/divide.hpp" +#include "openvino/op/equal.hpp" +#include "openvino/op/gather.hpp" +#include "openvino/op/irdft.hpp" +#include "openvino/op/multiply.hpp" +#include "openvino/op/range.hpp" +#include "openvino/op/rdft.hpp" +#include "openvino/op/reduce_prod.hpp" +#include "openvino/op/reshape.hpp" +#include "openvino/op/scatter_update.hpp" +#include "openvino/op/select.hpp" +#include "openvino/op/shape_of.hpp" +#include "openvino/op/sqrt.hpp" +#include "openvino/op/squeeze.hpp" +#include "openvino/op/subtract.hpp" +#include "utils.hpp" + +namespace ov { +namespace frontend { +namespace pytorch { +namespace op { + +using namespace ov::op; + +OutputVector translate_fft_rfftn(const NodeContext& context) { + // aten::fft_rfftn(Tensor self, int[1]? s=None, int[1]? dim=None, str? norm=None) -> Tensor + num_inputs_check(context, 1, 4); + auto input = context.get_input(0); + + auto const_neg_1 = context.mark_node(v0::Constant::create(element::i32, Shape{}, {-1})); + auto const_0 = context.mark_node(v0::Constant::create(element::i32, Shape{}, {0})); + auto const_1 = context.mark_node(v0::Constant::create(element::i32, Shape{}, {1})); + + Output input_shape; + Output input_rank_scalar; + std::tie(input_shape, input_rank_scalar) = get_shape_rank(context, input, true); + + Output raw_s; + // Inputs can be either none or List. Check whether input values should be used or should be set to default values. + if (!context.input_is_none(1)) { + // s is provided, load from input. + raw_s = get_input_concat_if_list(context, 1); + raw_s = context.mark_node(std::make_shared(raw_s, element::i32)); + } + Output dim; + // Handle dim parameter containing vector of integers indicating dimensions to be transformed. + if (!context.input_is_none(2)) { + // dim is provided, load from input. + dim = get_input_concat_if_list(context, 2); + dim = context.mark_node(std::make_shared(dim, element::i32)); + } else if (!context.input_is_none(1)) { + // If dim is default and s is provided, use last s_len dimensions where s_len is length of s. + auto s_len = context.mark_node(std::make_shared(raw_s, element::i32)); + auto slice_start = context.mark_node(std::make_shared(input_rank_scalar, s_len)); + auto slice_start_scalar = context.mark_node(std::make_shared(slice_start)); + dim = context.mark_node( + std::make_shared(slice_start_scalar, input_rank_scalar, const_1, element::i32)); + } else { + // Dim and s are set to default, use all of dimensions. + dim = context.mark_node(std::make_shared(const_0, input_rank_scalar, const_1, element::i32)); + } + + Output s; + if (context.input_is_none(1)) { + // Value for s was set to default, use full size for all dimensions. + s = context.mark_node(std::make_shared(input_shape, dim, const_0)); + } else { + // Values for s were provided. Replace -1 values with default full size in given dimension. + auto full_s_cond = context.mark_node(std::make_shared(raw_s, const_neg_1)); + auto full_s_values = context.mark_node(std::make_shared(input_shape, dim, const_0)); + s = context.mark_node(std::make_shared(full_s_cond, full_s_values, raw_s)); + } + + // Handle norm parameter indicating normalization mode to use. Defaults to "backward". + std::string norm = "backward"; + if (!context.input_is_none(3)) { + norm = context.const_input(3); + } + + auto rdft = context.mark_node(std::make_shared(input, dim, s)); + + // Apply normalizations + auto n_int = context.mark_node(std::make_shared(s, const_0)); + auto n = context.mark_node(std::make_shared(n_int, rdft)); + Output normalized_rfftn; + if (norm == "forward") { + // Normalize by 1/n + normalized_rfftn = context.mark_node(std::make_shared(rdft, n)); + } else if (norm == "backward") { + // No normalization + normalized_rfftn = rdft; + } else if (norm == "ortho") { + // Normalize by 1/sqrt(n) + auto sqrt_n = context.mark_node(std::make_shared(n)); + normalized_rfftn = context.mark_node(std::make_shared(rdft, sqrt_n)); + } else { + FRONT_END_THROW( + "aten::fft_rfftn: unrecognized normalization mode. Only forward, backward and ortho are supported."); + } + + return {std::make_shared(normalized_rfftn, normalized_rfftn.get_element_type())}; +} + +OutputVector translate_fft_irfftn(const NodeContext& context) { + // aten::fft_irfftn(Tensor self, int[1]? s=None, int[1]? dim=None, str? norm=None) -> Tensor + num_inputs_check(context, 1, 4, true); + auto input = context.get_input(0); + + auto complex_type_mark = as_type_ptr(input.get_node_shared_ptr()); + PYTORCH_OP_CONVERSION_CHECK(complex_type_mark, "aten::fft_irfftn operation expects complex type tensor on input."); + input = complex_type_mark->input_value(0); + + auto const_neg_1 = context.mark_node(v0::Constant::create(element::i32, Shape{1}, {-1})); + auto const_0 = context.mark_node(v0::Constant::create(element::i32, Shape{1}, {0})); + auto const_scalar_0 = context.mark_node(v0::Constant::create(element::i32, Shape{}, {0})); + auto const_1 = context.mark_node(v0::Constant::create(element::i32, Shape{1}, {1})); + auto const_scalar_1 = context.mark_node(v0::Constant::create(element::i32, Shape{}, {1})); + auto const_2 = context.mark_node(v0::Constant::create(element::i32, Shape{1}, {2})); + + // Input shape of complex number (excluding dimension created by concatenation of real and imag) + auto complex_input_shape = get_complex_shape(context, input); + auto input_rank = context.mark_node(std::make_shared(complex_input_shape, element::i32)); + auto input_rank_scalar = context.mark_node(std::make_shared(input_rank)); + + Output raw_s; + // Inputs can be either none or List. Check whether input values should be used or should be set to default values. + if (!context.input_is_none(1)) { + // s is provided, load from input. + raw_s = get_input_concat_if_list(context, 1); + raw_s = context.mark_node(std::make_shared(raw_s, element::i32)); + } + + // Handle dim parameter containing vector of integers indicating dimensions to be transformed. + Output dim; + if (!context.input_is_none(2)) { + // Dim values is provided, load from input. + dim = get_input_concat_if_list(context, 2); + dim = context.mark_node(std::make_shared(dim, element::i32)); + } else if (!context.input_is_none(1)) { + // If dim is default and s is provided, use last s_len dimensions where s_len is length of s. + auto s_len = context.mark_node(std::make_shared(raw_s, element::i32)); + auto range_start = context.mark_node(std::make_shared(input_rank, s_len)); + auto range_start_scalar = context.mark_node(std::make_shared(range_start)); + dim = context.mark_node( + std::make_shared(range_start_scalar, input_rank_scalar, const_scalar_1, element::i32)); + } else { + // Dim and s are set to default, use all of dimensions. + dim = context.mark_node( + std::make_shared(const_scalar_0, input_rank_scalar, const_scalar_1, element::i32)); + } + + // Calculate default s values. Use full available size except last element, which is set to even value in last + // dimension: s[-1] = 2 * (complex_input_shape[dim[-1]]) + auto default_s_raw = context.mark_node(std::make_shared(complex_input_shape, dim, const_0)); + auto last_s = context.mark_node(std::make_shared(default_s_raw, const_neg_1, const_0)); + auto last_s_m_1 = context.mark_node(std::make_shared(last_s, const_1)); + auto s_upd = context.mark_node(std::make_shared(last_s_m_1, const_2)); + auto s_shape = context.mark_node(std::make_shared(default_s_raw, element::i32)); + auto last_s_idx = context.mark_node(std::make_shared(s_shape, const_1)); + auto default_s = context.mark_node(std::make_shared(default_s_raw, last_s_idx, s_upd, const_0)); + + // Handle s parameter containing vector of intigers indicating signal sizes for dimensions. + Output s; + if (!context.input_is_none(1)) { + // Values for s were provided. Replace -1 values with default full size in given dimension. + auto full_s_cond = context.mark_node(std::make_shared(raw_s, const_neg_1)); + s = context.mark_node(std::make_shared(full_s_cond, default_s, raw_s)); + } else { + // Value for s was set to default. + s = default_s; + } + + // Handle norm parameter indicating normalization mode to use. Defaults to "backward". + std::string norm = "backward"; + if (!context.input_is_none(3)) { + norm = context.const_input(3); + } + + auto irdft = context.mark_node(std::make_shared(input, dim, s)); + + // Apply normalizations. + auto n_int = context.mark_node(std::make_shared(s, const_0)); + auto n = context.mark_node(std::make_shared(n_int, irdft)); + Output normalized_irfftn; + if (norm == "forward") { + normalized_irfftn = context.mark_node(std::make_shared(irdft, n)); + } else if (norm == "backward") { + normalized_irfftn = irdft; + } else if (norm == "ortho") { + auto sqrt_n = context.mark_node(std::make_shared(n)); + normalized_irfftn = context.mark_node(std::make_shared(irdft, sqrt_n)); + } else { + FRONT_END_THROW( + "aten::fft_irfftn: unrecognized normalization mode. Only forward, backward and ortho are supported."); + } + return {normalized_irfftn}; +} + +} // namespace op +} // namespace pytorch +} // namespace frontend +} // namespace ov diff --git a/src/frontends/pytorch/src/op/index_copy_.cpp b/src/frontends/pytorch/src/op/index_copy_.cpp index c13b53858a9c00..f8acb4db1749f8 100644 --- a/src/frontends/pytorch/src/op/index_copy_.cpp +++ b/src/frontends/pytorch/src/op/index_copy_.cpp @@ -1,4 +1,4 @@ -// Copyright (C) 2018-2023 Intel Corporation +// Copyright (C) 2018-2025 Intel Corporation // SPDX-License-Identifier: Apache-2.0 // diff --git a/src/frontends/pytorch/src/op/index_fill_.cpp b/src/frontends/pytorch/src/op/index_fill_.cpp index a24f3fa2f5b1c7..ee0ac618079c3f 100644 --- a/src/frontends/pytorch/src/op/index_fill_.cpp +++ b/src/frontends/pytorch/src/op/index_fill_.cpp @@ -1,4 +1,4 @@ -// Copyright (C) 2018-2023 Intel Corporation +// Copyright (C) 2018-2025 Intel Corporation // SPDX-License-Identifier: Apache-2.0 // diff --git a/src/frontends/pytorch/src/op/index_put_.cpp b/src/frontends/pytorch/src/op/index_put_.cpp index 1b5725a8a95bb3..4591862d8f04c1 100644 --- a/src/frontends/pytorch/src/op/index_put_.cpp +++ b/src/frontends/pytorch/src/op/index_put_.cpp @@ -10,7 +10,7 @@ namespace frontend { namespace pytorch { namespace op { -OutputVector translate_index_put_(const NodeContext& context) { +OutputVector translate_index_put(const NodeContext& context) { // Pass as PtFrameworkNode to register as `inplace_op`. Conversion to OV operators is done as transformation. auto node = std::make_shared(context.get_decoder(), context.inputs()); return {context.mark_node(node)}; diff --git a/src/frontends/pytorch/src/op/log.cpp b/src/frontends/pytorch/src/op/log.cpp index e932538c86520e..dbda6329deeb4f 100644 --- a/src/frontends/pytorch/src/op/log.cpp +++ b/src/frontends/pytorch/src/op/log.cpp @@ -77,7 +77,7 @@ OutputVector translate_log10(const NodeContext& context) { }; OutputVector translate_logsumexp(const NodeContext& context) { - num_inputs_check(context, 1, 2); + num_inputs_check(context, 1, 3); auto input = context.get_input(0); ov::Output dim; if (!context.input_is_none(1)) { @@ -85,8 +85,12 @@ OutputVector translate_logsumexp(const NodeContext& context) { } else { dim = context.mark_node(get_axes_range(context, 0)); } + bool keepdim = false; + if (!context.input_is_none(2)) { + keepdim = context.const_input(2); + } auto exp = context.mark_node(std::make_shared(input)); - auto sum = context.mark_node(std::make_shared(exp, dim, false)); + auto sum = context.mark_node(std::make_shared(exp, dim, keepdim)); auto log = context.mark_node(std::make_shared(sum)); return {log}; }; diff --git a/src/frontends/pytorch/src/op/permute.cpp b/src/frontends/pytorch/src/op/permute.cpp index 46016ca8ca16a0..c724e38b8077b2 100644 --- a/src/frontends/pytorch/src/op/permute.cpp +++ b/src/frontends/pytorch/src/op/permute.cpp @@ -3,7 +3,10 @@ // #include "openvino/core/validation_util.hpp" +#include "openvino/frontend/complex_type_mark.hpp" #include "openvino/frontend/pytorch/node_context.hpp" +#include "openvino/op/concat.hpp" +#include "openvino/op/subtract.hpp" #include "openvino/op/transpose.hpp" #include "utils.hpp" @@ -12,17 +15,41 @@ namespace frontend { namespace pytorch { namespace op { +using namespace ov::op; + OutputVector translate_permute(const NodeContext& context) { - num_inputs_check(context, 2, 2); + num_inputs_check(context, 2, 2, true); auto data = context.get_input(0); auto order = get_input_concat_if_list(context, 1); - auto rank = std::get<1>(get_shape_rank(context, data)); - auto rank_converted = context.mark_node(std::make_shared(rank, order)); + + Output rank; + auto complex_type_mark = as_type_ptr(data.get_node_shared_ptr()); + if (complex_type_mark) { + data = complex_type_mark->input_value(0); + rank = std::get<1>(get_shape_rank(context, data)); + auto const_1 = context.mark_node(v0::Constant::create(element::i32, Shape{}, {1})); + rank = context.mark_node(std::make_shared(rank, const_1)); + } else { + rank = std::get<1>(get_shape_rank(context, data)); + } + + auto rank_converted = context.mark_node(std::make_shared(rank, order)); auto order_normalized = normalize_axis(context, order, rank_converted); + + if (complex_type_mark) { + auto to_concat = OutputVector{order_normalized, rank_converted}; + order_normalized = context.mark_node(std::make_shared(to_concat, 0)); + } + if (const auto order_const = ov::util::get_constant_from_source(order_normalized)) { order_normalized = order_const; } - return {context.mark_node(std::make_shared(data, order_normalized))}; + auto permute = context.mark_node(std::make_shared(data, order_normalized)); + if (complex_type_mark) { + const auto& complex_dtype = complex_type_mark->get_complex_part_type(); + permute = context.mark_node(std::make_shared(permute, complex_dtype)); + } + return {permute}; } } // namespace op diff --git a/src/frontends/pytorch/src/op/reshape.cpp b/src/frontends/pytorch/src/op/reshape.cpp index 7524d0e3c4aaf4..b9dcfc8d9afc4a 100644 --- a/src/frontends/pytorch/src/op/reshape.cpp +++ b/src/frontends/pytorch/src/op/reshape.cpp @@ -4,6 +4,7 @@ #include "openvino/op/reshape.hpp" +#include "openvino/frontend/complex_type_mark.hpp" #include "openvino/frontend/pytorch/node_context.hpp" #include "openvino/op/concat.hpp" #include "openvino/op/squeeze.hpp" @@ -15,15 +16,34 @@ namespace frontend { namespace pytorch { namespace op { +using namespace ov::op; + OutputVector translate_reshape(const NodeContext& context) { // Translation is used by both aten::view and aten::reshape. // Schema: aten::view(Tensor input, int[] shape) -> Tensor // Schema: aten::reshape(Tensor input, int[] shape) -> Tensor // For shape parameter, int[] is converted into single dimensional Tensor. - num_inputs_check(context, 2, 2); + num_inputs_check(context, 2, 2, true); + auto tensor = context.get_input(0); auto shape = get_input_concat_if_list(context, 1); - auto reshape = std::make_shared(context.get_input(0), shape, false); - return {context.mark_node(reshape)}; + + auto complex_type_mark = as_type_ptr(tensor.get_node_shared_ptr()); + if (complex_type_mark) { + tensor = complex_type_mark->input_value(0); + auto const_2 = context.mark_node(v0::Constant::create(element::i32, Shape{1}, {2})); + const_2 = context.mark_node(std::make_shared(const_2, shape)); + + shape = context.mark_node(std::make_shared(OutputVector{shape, const_2}, 0)); + } + + auto reshape = context.mark_node(std::make_shared(tensor, shape, false)); + + if (complex_type_mark) { + const auto& complex_dtype = complex_type_mark->get_complex_part_type(); + return {context.mark_node(std::make_shared(reshape, complex_dtype))}; + } else { + return {reshape}; + } }; } // namespace op diff --git a/src/frontends/pytorch/src/op/size.cpp b/src/frontends/pytorch/src/op/size.cpp index d8f1ee28123c10..2eca5f2707e53d 100644 --- a/src/frontends/pytorch/src/op/size.cpp +++ b/src/frontends/pytorch/src/op/size.cpp @@ -2,10 +2,12 @@ // SPDX-License-Identifier: Apache-2.0 // +#include "openvino/frontend/complex_type_mark.hpp" #include "openvino/frontend/pytorch/node_context.hpp" #include "openvino/op/constant.hpp" #include "openvino/op/gather.hpp" #include "openvino/op/shape_of.hpp" +#include "openvino/op/slice.hpp" #include "utils.hpp" namespace ov { @@ -16,10 +18,25 @@ namespace op { using namespace ov::op; OutputVector translate_size(const NodeContext& context) { - num_inputs_check(context, 1, 2); - auto shape = context.mark_node(std::make_shared(context.get_input(0), element::i64)); + num_inputs_check(context, 1, 2, true); + auto data = context.get_input(0); + Output shape; + + auto complex_type_mark = as_type_ptr(data.get_node_shared_ptr()); + if (complex_type_mark) { + data = complex_type_mark->input_value(0); + shape = context.mark_node(std::make_shared(data, element::i64)); + + auto zero = context.mark_node(v0::Constant::create(element::i32, Shape{1}, {0})); + auto stop = context.mark_node(v0::Constant::create(element::i32, Shape{1}, {-1})); + auto step = context.mark_node(v0::Constant::create(element::i32, Shape{1}, {1})); + shape = context.mark_node(std::make_shared(shape, zero, stop, step, zero)); + } else { + shape = context.mark_node(std::make_shared(data, element::i64)); + } + if (context.input_is_none(1)) { - return shape->outputs(); + return {shape}; } else { auto axis_0 = context.mark_node(v0::Constant::create(element::i32, Shape{}, {0})); return {context.mark_node(std::make_shared(shape, context.get_input(1), axis_0))}; diff --git a/src/frontends/pytorch/src/op/stft.cpp b/src/frontends/pytorch/src/op/stft.cpp index 8e478835fdcdd6..678f44dcbe1edf 100644 --- a/src/frontends/pytorch/src/op/stft.cpp +++ b/src/frontends/pytorch/src/op/stft.cpp @@ -4,6 +4,7 @@ #include "openvino/op/stft.hpp" +#include "openvino/frontend/complex_type_mark.hpp" #include "openvino/frontend/pytorch/node_context.hpp" #include "openvino/op/broadcast.hpp" #include "openvino/op/constant.hpp" @@ -78,8 +79,6 @@ OutputVector translate_stft(const NodeContext& context) { if (!context.input_is_none(7)) { return_complex = context.const_input(7); } - PYTORCH_OP_CONVERSION_CHECK(!return_complex, - "aten::stft conversion is currently supported with return_complex=False only."); // Perform STFT constexpr bool transpose_frames = true; @@ -88,8 +87,10 @@ OutputVector translate_stft(const NodeContext& context) { if (normalized) { const auto nfft_convert = context.mark_node(std::make_shared(n_fft, stft)); const auto divisor = context.mark_node(std::make_shared(nfft_convert)); - const auto norm_stft = context.mark_node(std::make_shared(stft, divisor)); - return {norm_stft}; + stft = context.mark_node(std::make_shared(stft, divisor)); + } + if (return_complex) { + return {context.mark_node(std::make_shared(stft, stft->get_element_type()))}; } else { return {stft}; } diff --git a/src/frontends/pytorch/src/op_table.cpp b/src/frontends/pytorch/src/op_table.cpp index fe4e84bd47d45e..458ad679d8b444 100644 --- a/src/frontends/pytorch/src/op_table.cpp +++ b/src/frontends/pytorch/src/op_table.cpp @@ -48,6 +48,7 @@ OP_CONVERTER(translate_avg_pool2d); OP_CONVERTER(translate_avg_pool3d); OP_CONVERTER(translate_bool); OP_CONVERTER(translate_batch_norm); +OP_CONVERTER(translate_bernoulli); OP_CONVERTER(translate_bitwise_and); OP_CONVERTER(translate_bitwise_not); OP_CONVERTER(translate_bitwise_or); @@ -59,6 +60,7 @@ OP_CONVERTER(translate_celu); OP_CONVERTER(translate_channel_shuffle); OP_CONVERTER(translate_clamp); OP_CONVERTER(translate_col2im); +OP_CONVERTER(translate_complex); OP_CONVERTER(translate_constant); OP_CONVERTER(translate_conv_transposend); OP_CONVERTER(translate_convnd); @@ -86,6 +88,8 @@ OP_CONVERTER(translate_expm1); OP_CONVERTER(translate_eye); OP_CONVERTER(translate_fake_quantize_per_channel_affine); OP_CONVERTER(translate_fake_quantize_per_tensor_affine); +OP_CONVERTER(translate_fft_irfftn); +OP_CONVERTER(translate_fft_rfftn); OP_CONVERTER(translate_fill); OP_CONVERTER(translate_fill_diagonal); OP_CONVERTER(translate_flatten); @@ -108,11 +112,12 @@ OP_CONVERTER(translate_hann_window); OP_CONVERTER(translate_hardtanh); OP_CONVERTER(translate_if); OP_CONVERTER(translate_im2col); +OP_CONVERTER(translate_imag); OP_CONVERTER(translate_index); OP_CONVERTER(translate_index_add); OP_CONVERTER(translate_index_copy_); OP_CONVERTER(translate_index_fill_); -OP_CONVERTER(translate_index_put_); +OP_CONVERTER(translate_index_put); OP_CONVERTER(translate_index_select); OP_CONVERTER(translate_instance_norm); OP_CONVERTER(translate_int); @@ -192,6 +197,7 @@ OP_CONVERTER(translate_randn); OP_CONVERTER(translate_randint); OP_CONVERTER(translate_rand_like); OP_CONVERTER(translate_randn_like); +OP_CONVERTER(translate_real); OP_CONVERTER(translate_reciprocal); OP_CONVERTER(translate_relu6); OP_CONVERTER(translate_remainder); @@ -246,6 +252,8 @@ OP_CONVERTER(translate_upsample_nearest3d); OP_CONVERTER(translate_upsample_trilinear3d); OP_CONVERTER(translate_var); OP_CONVERTER(translate_var_mean); +OP_CONVERTER(translate_view_as_complex); +OP_CONVERTER(translate_view_as_real); OP_CONVERTER(translate_weight_norm); OP_CONVERTER(translate_where); OP_CONVERTER(translate_zeros); @@ -401,6 +409,7 @@ const std::unordered_map get_supported_ops_ts() { {"aten::avg_pool3d", op::quantizable_op}, {"aten::baddbmm", op::translate_addmm}, {"aten::batch_norm", op::translate_batch_norm}, + {"aten::bernoulli", op::translate_bernoulli}, {"aten::bitwise_and", op::translate_bitwise_and}, {"aten::bitwise_not", op::translate_bitwise_not}, {"aten::bitwise_or", op::translate_bitwise_or}, @@ -423,8 +432,9 @@ const std::unordered_map get_supported_ops_ts() { {"aten::clip", op::translate_clamp}, {"aten::clone", op::skip_node}, // ignore clone operators that are inserted by PyTorch autograd {"aten::col2im", op::translate_col2im}, - // aten::complex - Supported in limited set of patterns + {"aten::complex", op::translate_complex}, {"aten::concat", op::translate_cat}, + {"aten::concatenate", op::translate_cat}, {"aten::contiguous", op::skip_node}, // In openvino how tensors are stored in memory is internal plugin detail, // we assume all tensors are contiguous {"aten::conv_transpose1d", op::translate_conv_transposend}, @@ -457,6 +467,7 @@ const std::unordered_map get_supported_ops_ts() { {"aten::empty", op::translate_empty}, {"aten::empty_like", op::translate_empty_like}, {"aten::eq", op::translate_1to1_match_2_inputs_align_types}, + {"aten::equal", op::translate_1to1_match_2_inputs_align_types}, {"aten::erf", op::translate_erf}, {"aten::erfc", op::translate_erfc}, {"aten::exp", op::optional_out, 1>}, @@ -468,8 +479,8 @@ const std::unordered_map get_supported_ops_ts() { {"aten::fake_quantize_per_channel_affine", op::translate_fake_quantize_per_channel_affine}, {"aten::fake_quantize_per_tensor_affine", op::translate_fake_quantize_per_tensor_affine}, {"aten::feature_dropout", op::skip_node}, - // aten::fft_irfftn - Supported in limited set of patterns - // aten::fft_rfftn - Supported in limited set of patterns + {"aten::fft_irfftn", op::translate_fft_irfftn}, + {"aten::fft_rfftn", op::translate_fft_rfftn}, {"aten::fill", op::translate_fill}, {"aten::fill_diagonal", op::translate_fill_diagonal}, {"aten::flatten", op::quantizable_op}, @@ -496,11 +507,11 @@ const std::unordered_map get_supported_ops_ts() { {"aten::hardswish", op::quantizable_op>}, {"aten::hardtanh", op::quantizable_op}, {"aten::im2col", op::translate_im2col}, - // aten::imag - Supported in limited set of patterns + {"aten::imag", op::translate_imag}, // aten::index - Supported in limited set of patterns {"aten::index_copy_", op::inplace_op}, {"aten::index_fill_", op::inplace_op}, - {"aten::index_put_", op::inplace_op}, + {"aten::index_put", op::translate_index_put}, {"aten::index_add", op::translate_index_add}, {"aten::index_select", op::translate_index_select}, {"aten::instance_norm", op::translate_instance_norm}, @@ -543,6 +554,7 @@ const std::unordered_map get_supported_ops_ts() { {"aten::log2_", op::inplace_op}, {"aten::log10", op::optional_out}, {"aten::log10_", op::inplace_op}, + {"aten::logsumexp", op::translate_logsumexp}, {"aten::lstm", op::translate_lstm}, {"aten::lt", op::translate_1to1_match_2_inputs_align_types}, {"aten::masked_fill", op::translate_masked_fill}, @@ -604,7 +616,7 @@ const std::unordered_map get_supported_ops_ts() { {"aten::randint", op::translate_randint}, {"aten::randn", op::translate_randn}, {"aten::randn_like", op::translate_randn_like}, - // aten::real - Supported in limited set of patterns + {"aten::real", op::translate_real}, {"aten::reciprocal", op::optional_out}, {"aten::reciprocal_", op::inplace_op}, // aten::reflection_pad2d - Supported in limited set of patterns @@ -696,6 +708,8 @@ const std::unordered_map get_supported_ops_ts() { {"aten::var_mean", op::translate_var_mean}, {"aten::view", op::quantizable_op}, {"aten::view_as", op::translate_reshape_as}, + {"aten::view_as_complex", op::translate_view_as_complex}, + {"aten::view_as_real", op::translate_view_as_real}, {"aten::wait", op::skip_node}, {"aten::where", op::translate_where}, {"aten::zero", op::translate_zeros_like}, @@ -705,6 +719,7 @@ const std::unordered_map get_supported_ops_ts() { {"ov_ext::embedding", op::translate_embedding_ext}, {"ov_ext::conv1d", op::translate_conv1d_ext}, {"ov_ext::linear", op::translate_linear}, + {"prim::abs", op::translate_1to1_match_1_inputs}, {"prim::Constant", op::translate_constant}, {"prim::device", op::translate_constant}, // prim::DictConstruct - Supported in limited set of patterns @@ -979,6 +994,8 @@ const std::unordered_map get_supported_ops_fx() { {"aten.var.correction", op::translate_var_fx}, {"aten.var_mean.correction", op::translate_var_mean_fx}, {"aten.view.default", op::translate_reshape}, + {"aten.view_as_complex.default", op::translate_view_as_complex}, + {"aten.view_as_real.default", op::translate_view_as_real}, {"aten.where.self", op::translate_where}, {"aten.zeros.default", op::translate_zeros_fx}, {"aten.zeros.names", op::translate_zeros_fx}, diff --git a/src/frontends/pytorch/src/transforms/irfftn_complex_replacer.cpp b/src/frontends/pytorch/src/transforms/irfftn_complex_replacer.cpp deleted file mode 100644 index cb80987e4511ae..00000000000000 --- a/src/frontends/pytorch/src/transforms/irfftn_complex_replacer.cpp +++ /dev/null @@ -1,164 +0,0 @@ -// Copyright (C) 2018-2025 Intel Corporation -// SPDX-License-Identifier: Apache-2.0 -// - -#include "irfftn_complex_replacer.hpp" - -#include "openvino/core/rt_info.hpp" -#include "openvino/op/concat.hpp" -#include "openvino/op/convert.hpp" -#include "openvino/op/convert_like.hpp" -#include "openvino/op/equal.hpp" -#include "openvino/op/gather.hpp" -#include "openvino/op/irdft.hpp" -#include "openvino/op/multiply.hpp" -#include "openvino/op/range.hpp" -#include "openvino/op/reduce_prod.hpp" -#include "openvino/op/scatter_update.hpp" -#include "openvino/op/select.hpp" -#include "openvino/op/shape_of.hpp" -#include "openvino/op/sqrt.hpp" -#include "openvino/op/squeeze.hpp" -#include "openvino/op/subtract.hpp" -#include "openvino/op/unsqueeze.hpp" -#include "openvino/op/util/framework_node.hpp" -#include "openvino/pass/pattern/matcher.hpp" -#include "openvino/pass/pattern/op/wrap_type.hpp" -#include "utils.hpp" - -namespace ov { -namespace frontend { -namespace pytorch { -namespace pass { - -using namespace ov::pass; -using namespace ov::op; - -IRFFTNComplexReplacer::IRFFTNComplexReplacer() { - // Transformation used to replace combination of aten::complex -> aten::fft_irfftn torch operators. - // Pattern: aten::complex -> aten::fft_irfftn - auto fft_op = pattern::wrap_type(); - - ov::matcher_pass_callback irfftn_callback = [](pattern::Matcher& m) { - // "aten::fft_irfftn(Tensor self, int[1]? s=None, int[1]? dim=None, str? norm=None) -> Tensor" - auto irfftn_op = cast_fw_node(m.get_match_root(), "aten::fft_irfftn"); - if (!irfftn_op) { - return false; - } - auto const_neg_1 = v0::Constant::create(element::i32, Shape{1}, {-1}); - auto const_0 = v0::Constant::create(element::i32, Shape{1}, {0}); - auto const_scalar_0 = v0::Constant::create(element::i32, Shape{}, {0}); - auto const_1 = v0::Constant::create(element::i32, Shape{1}, {1}); - auto const_scalar_1 = v0::Constant::create(element::i32, Shape{}, {1}); - auto const_2 = v0::Constant::create(element::i32, Shape{1}, {2}); - - // Check whether input node being aten::complex. - auto fw_node_complex_input = cast_fw_node(irfftn_op->input_value(0).get_node_shared_ptr(), "aten::complex"); - if (!fw_node_complex_input) { - return false; - } - - // Concatenate real and imag parts over additional, last dimension. - auto real = std::make_shared(fw_node_complex_input->input_value(0), const_neg_1); - auto imag = std::make_shared(fw_node_complex_input->input_value(1), const_neg_1); - NodeVector complex = {real, imag}; - auto input = std::make_shared(complex, -1); - - // Input shape of complex number (excluding dimension created by concatenation of real and imag) - auto complex_input_shape = std::make_shared(fw_node_complex_input->input_value(0), element::i32); - auto input_rank = std::make_shared(complex_input_shape, element::i32); - auto input_rank_scalar = std::make_shared(input_rank); - - // Inputs can be either none or ListConstruct. Check whether input values should be used or should be set to - // default values. - bool dim_use_default = is_none_node(irfftn_op->input_value(2)); - bool s_use_default = is_none_node(irfftn_op->input_value(1)); - // Can be None constant, when used check s_use_default. - auto raw_s_input_maybe = concat_list_construct(irfftn_op->input_value(1)); - raw_s_input_maybe = std::make_shared(raw_s_input_maybe, element::i32); - - // Handle dim parameter containing vector of integers indicating dimensions to be transformed. - std::shared_ptr dim; - if (!dim_use_default) { - // Dim values is provided, load from input. - dim = std::make_shared(concat_list_construct(irfftn_op->input_value(2)), element::i32); - } else if (!s_use_default) { - // If dim is default and s is provided, use last s_len dimensions where s_len is length of s. - auto s_len = std::make_shared(raw_s_input_maybe, element::i32); - auto range_start = std::make_shared(input_rank, s_len); - auto range_start_scalar = std::make_shared(range_start); - dim = std::make_shared(range_start_scalar, input_rank_scalar, const_scalar_1, element::i32); - } else { - // Dim and s are set to default, use all of dimensions. - dim = std::make_shared(const_scalar_0, input_rank_scalar, const_scalar_1, element::i32); - } - - // Calculate default s values. Use full available size except last element, which is set to even value in last - // dimension: s[-1] = 2 * (complex_input_shape[dim[-1]]) - auto default_s_raw = std::make_shared(complex_input_shape, dim, const_0); - auto last_s = std::make_shared(default_s_raw, const_neg_1, const_0); - auto last_s_m_1 = std::make_shared(last_s, const_1); - auto s_upd = std::make_shared(last_s_m_1, const_2); - auto s_shape = std::make_shared(default_s_raw, element::i32); - auto last_s_idx = std::make_shared(s_shape, const_1); - auto default_s = std::make_shared(default_s_raw, last_s_idx, s_upd, const_0); - - // Handle s parameter containing vector of intigers indicating signal sizes for dimensions. - std::shared_ptr s; - if (!s_use_default) { - // Values for s were provided. Replace -1 values with default full size in given dimension. - auto full_s_cond = std::make_shared(raw_s_input_maybe, const_neg_1); - s = std::make_shared(full_s_cond, default_s, raw_s_input_maybe); - } else { - // Value for s was set to default. - s = default_s; - } - - // Handle norm parameter indicating normalization mode to use. Defaults to "backward". - std::string norm; - if (const auto& fw_node_mode = - ov::as_type_ptr(irfftn_op->input_value(3).get_node_shared_ptr())) { - const auto& attrs = fw_node_mode->get_attrs(); - if (attrs.find("string_value") != attrs.end()) { - norm = attrs.at("string_value"); - } else { - norm = "backward"; - } - } else { - add_exception_to_fw_node(irfftn_op, "aten::fft_irfftn: could not retrive value for norm attribute."); - return false; - } - - auto irdft = std::make_shared(input, dim, s); - - // Apply normalizations. - auto n_int = std::make_shared(s, const_0); - auto n = std::make_shared(n_int, irdft); - std::shared_ptr normalized_irfftn; - if (norm == "forward") { - normalized_irfftn = std::make_shared(irdft, n); - } else if (norm == "backward") { - normalized_irfftn = irdft; - } else if (norm == "ortho") { - auto sqrt_n = std::make_shared(n); - normalized_irfftn = std::make_shared(irdft, sqrt_n); - } else { - add_exception_to_fw_node( - irfftn_op, - "aten::fft_irfftn: unrecognized normalization mode. Only forward, backward and ortho are supported."); - return false; - } - - copy_runtime_info({irfftn_op, fw_node_complex_input}, normalized_irfftn); - normalized_irfftn->set_friendly_name(irfftn_op->get_friendly_name()); - replace_node(irfftn_op, normalized_irfftn); - return true; - }; - auto m = std::make_shared(fft_op, "ov::frontend::pytorch::pass::IRFFTNComplexReplacer"); - this->register_matcher(m, irfftn_callback); -}; - -} // namespace pass -} // namespace pytorch -} // namespace frontend -} // namespace ov diff --git a/src/frontends/pytorch/src/transforms/irfftn_complex_replacer.hpp b/src/frontends/pytorch/src/transforms/irfftn_complex_replacer.hpp deleted file mode 100644 index c75c6e51f92571..00000000000000 --- a/src/frontends/pytorch/src/transforms/irfftn_complex_replacer.hpp +++ /dev/null @@ -1,24 +0,0 @@ -// Copyright (C) 2018-2025 Intel Corporation -// SPDX-License-Identifier: Apache-2.0 -// - -#pragma once - -#include "openvino/pass/graph_rewrite.hpp" -#include "openvino/pass/pass.hpp" - -namespace ov { -namespace frontend { -namespace pytorch { -namespace pass { - -class IRFFTNComplexReplacer : public ov::pass::MatcherPass { -public: - OPENVINO_MATCHER_PASS_RTTI("ov::frontend::pytorch::pass::IRFFTNComplexReplacer"); - IRFFTNComplexReplacer(); -}; - -} // namespace pass -} // namespace pytorch -} // namespace frontend -} // namespace ov diff --git a/src/frontends/pytorch/src/transforms/rfftn_complex_replacer.cpp b/src/frontends/pytorch/src/transforms/rfftn_complex_replacer.cpp deleted file mode 100644 index b90e3121930c71..00000000000000 --- a/src/frontends/pytorch/src/transforms/rfftn_complex_replacer.cpp +++ /dev/null @@ -1,163 +0,0 @@ -// Copyright (C) 2018-2025 Intel Corporation -// SPDX-License-Identifier: Apache-2.0 -// - -#include "rfftn_complex_replacer.hpp" - -#include "openvino/core/rt_info.hpp" -#include "openvino/op/convert.hpp" -#include "openvino/op/convert_like.hpp" -#include "openvino/op/divide.hpp" -#include "openvino/op/equal.hpp" -#include "openvino/op/gather.hpp" -#include "openvino/op/range.hpp" -#include "openvino/op/rdft.hpp" -#include "openvino/op/reduce_prod.hpp" -#include "openvino/op/select.hpp" -#include "openvino/op/shape_of.hpp" -#include "openvino/op/slice.hpp" -#include "openvino/op/split.hpp" -#include "openvino/op/sqrt.hpp" -#include "openvino/op/squeeze.hpp" -#include "openvino/op/subtract.hpp" -#include "openvino/op/util/framework_node.hpp" -#include "openvino/pass/pattern/matcher.hpp" -#include "openvino/pass/pattern/op/wrap_type.hpp" -#include "utils.hpp" - -namespace ov { -namespace frontend { -namespace pytorch { -namespace pass { - -using namespace ov::pass; -using namespace ov::op; - -RFFTNComplexReplacer::RFFTNComplexReplacer() { - // Transformation used to replace combination of aten::fft_rfftn -> {aten::real, aten::imag} torch operators. - // Pattern: aten::fft_rfftn -> {aten::real, aten::imag} - auto fft_op = pattern::wrap_type(); - ov::matcher_pass_callback rfftn_callback = [](pattern::Matcher& m) { - // Schema: "aten::fft_rfftn(Tensor self, int[1]? s=None, int[1]? dim=None, str? norm=None) -> Tensor" - auto rfftn_op = cast_fw_node(m.get_match_root(), "aten::fft_rfftn"); - if (!rfftn_op) { - return false; - } - auto const_neg_1 = v0::Constant::create(element::i32, Shape{}, {-1}); - auto const_0 = v0::Constant::create(element::i32, Shape{}, {0}); - auto const_1 = v0::Constant::create(element::i32, Shape{}, {1}); - - auto input = rfftn_op->input_value(0); - auto input_shape = std::make_shared(input, element::i32); - auto input_rank = std::make_shared(input_shape, element::i32); - auto input_rank_scalar = std::make_shared(input_rank); - - // Inputs can be either none or ListConstruct. Check whether input values should be used or should be set to - // default values. - bool dim_use_default = is_none_node(rfftn_op->input_value(2)); - bool s_use_default = is_none_node(rfftn_op->input_value(1)); - // Can be None constant, when used check s_use_default. - auto raw_s_input_maybe = concat_list_construct(rfftn_op->input_value(1)); - raw_s_input_maybe = std::make_shared(raw_s_input_maybe, element::i32); - - // Handle dim parameter containing vector of intigers indicating dimensions to be transformed. - std::shared_ptr dim; - if (!dim_use_default) { - // Dim values is provided, load from input. - dim = std::make_shared(concat_list_construct(rfftn_op->input_value(2)), element::i32); - } else if (!s_use_default) { - // If dim is default and s is provided, use last s_len dimensions where s_len is length of s. - auto s_len = std::make_shared(raw_s_input_maybe, element::i32); - auto slice_start = std::make_shared(input_rank, s_len); - auto slice_start_scalar = std::make_shared(slice_start); - dim = std::make_shared(slice_start_scalar, input_rank_scalar, const_1, element::i32); - } else { - // Dim and s are set to default, use all of dimensions. - dim = std::make_shared(const_0, input_rank_scalar, const_1, element::i32); - } - - // Handle s parameter containing vector of intigers indicating signal sizes for dimensions. - std::shared_ptr s; - if (!s_use_default) { - // Values for s were provided. Replace -1 values with default full size in given dimension. - auto full_s_cond = std::make_shared(raw_s_input_maybe, const_neg_1); - auto full_s_values = std::make_shared(input_shape, dim, const_0); - s = std::make_shared(full_s_cond, full_s_values, raw_s_input_maybe); - } else { - // Value for s was set to default, use full size for all dimensions. - s = std::make_shared(input_shape, dim, const_0); - } - - // Handle norm parameter indicating normalization mode to use. Defaults to "backward". - std::string norm; - if (const auto& fw_node_mode = - ov::as_type_ptr(rfftn_op->input_value(3).get_node_shared_ptr())) { - const auto& attrs = fw_node_mode->get_attrs(); - if (attrs.find("string_value") != attrs.end()) { - norm = attrs.at("string_value"); - } else { - norm = "backward"; - } - } else { - add_exception_to_fw_node(rfftn_op, "aten::fft_rfftn: could not retrive value for norm attribute."); - return false; - } - - auto rdft = std::make_shared(input, dim, s); - - // Apply normalizations - auto n_int = std::make_shared(s, const_0); - auto n = std::make_shared(n_int, rdft); - std::shared_ptr normalized_rfftn; - if (norm == "forward") { - // Normalize by 1/n - normalized_rfftn = std::make_shared(rdft, n); - } else if (norm == "backward") { - // No normalization - normalized_rfftn = rdft; - } else if (norm == "ortho") { - // Normalize by 1/sqrt(n) - auto sqrt_n = std::make_shared(n); - normalized_rfftn = std::make_shared(rdft, sqrt_n); - } else { - add_exception_to_fw_node( - rfftn_op, - "aten::fft_rfftn: unrecognized normalization mode. Only forward, backward and ortho are supported."); - return false; - } - - // Replace outputs that are either torch operators aten::real or aten::imag. Apply squeeze to remove last - // dimension used to concatenate. - auto normalized_rfftn_splitted = std::make_shared(normalized_rfftn, const_neg_1, 2); - auto rfftn_outs = rfftn_op->get_users(); - bool rval = false; - for (auto& out : rfftn_outs) { - if (auto real_op = cast_fw_node(out, "aten::real")) { - auto squeezed = std::make_shared(normalized_rfftn_splitted->output(0), const_neg_1); - copy_runtime_info({rfftn_op, real_op}, squeezed); - squeezed->set_friendly_name(real_op->get_friendly_name()); - replace_node(real_op, squeezed); - rval = true; - } - if (auto imag_op = cast_fw_node(out, "aten::imag")) { - auto squeezed = std::make_shared(normalized_rfftn_splitted->output(1), const_neg_1); - copy_runtime_info({rfftn_op, imag_op}, squeezed); - squeezed->set_friendly_name(imag_op->get_friendly_name()); - replace_node(imag_op, squeezed); - rval = true; - } - } - add_exception_to_fw_node( - rfftn_op, - "aten::fft_rfftn: Unsupported output node. Only aten::real and aten::imag are supported."); - return rval; - }; - - auto m = std::make_shared(fft_op, "ov::frontend::pytorch::pass::RFFTNComplexReplacer"); - this->register_matcher(m, rfftn_callback); -}; - -} // namespace pass -} // namespace pytorch -} // namespace frontend -} // namespace ov diff --git a/src/frontends/pytorch/src/transforms/rfftn_complex_replacer.hpp b/src/frontends/pytorch/src/transforms/rfftn_complex_replacer.hpp deleted file mode 100644 index 5420b7c9a01a04..00000000000000 --- a/src/frontends/pytorch/src/transforms/rfftn_complex_replacer.hpp +++ /dev/null @@ -1,24 +0,0 @@ -// Copyright (C) 2018-2025 Intel Corporation -// SPDX-License-Identifier: Apache-2.0 -// - -#pragma once - -#include "openvino/pass/graph_rewrite.hpp" -#include "openvino/pass/pass.hpp" - -namespace ov { -namespace frontend { -namespace pytorch { -namespace pass { - -class RFFTNComplexReplacer : public ov::pass::MatcherPass { -public: - OPENVINO_MATCHER_PASS_RTTI("ov::frontend::pytorch::pass::RFFTNComplexReplacer"); - RFFTNComplexReplacer(); -}; - -} // namespace pass -} // namespace pytorch -} // namespace frontend -} // namespace ov diff --git a/src/frontends/pytorch/src/utils.cpp b/src/frontends/pytorch/src/utils.cpp index da0b5c5cd24d61..70ba4171770fbd 100644 --- a/src/frontends/pytorch/src/utils.cpp +++ b/src/frontends/pytorch/src/utils.cpp @@ -7,6 +7,7 @@ #include "op_table.hpp" #include "openvino/core/rt_info.hpp" #include "openvino/core/validation_util.hpp" +#include "openvino/frontend/complex_type_mark.hpp" #include "openvino/frontend/pytorch/decoder.hpp" #include "openvino/op/add.hpp" #include "openvino/op/broadcast.hpp" @@ -40,15 +41,24 @@ namespace pytorch { using namespace ov::op; -void num_inputs_check(const NodeContext& context, size_t min_inputs, size_t max_inputs) { +void num_inputs_check(const NodeContext& context, size_t min_inputs, size_t max_inputs, bool allow_complex) { auto num_inputs = context.get_input_size(); FRONT_END_OP_CONVERSION_CHECK(num_inputs >= min_inputs, "Got less inputs ", num_inputs, " than expected ", min_inputs); + if (!allow_complex) { + // verify that no input is complex + for (int i = 0; i < static_cast(std::min(num_inputs, max_inputs)); ++i) { + auto input = context.get_input(i); + auto complex_type_mark = as_type_ptr(input.get_node_shared_ptr()); + PYTORCH_OP_CONVERSION_CHECK(!complex_type_mark, "The operation doesn't allow complex type."); + } + } + // Check that additional inputs are all None, otherwise raise exception for (auto i = max_inputs; i < num_inputs; i++) { - FRONT_END_OP_CONVERSION_CHECK(context.input_is_none(i), "Got more inputs than expected."); + FRONT_END_OP_CONVERSION_CHECK(context.input_is_none(i), "Got more inputs than expected: ", i + 1); } } @@ -836,6 +846,16 @@ bool index_tensor_on_list(ov::pass::NodeRegistry& rg, return true; } +Output get_complex_shape(const NodeContext& context, const Output& complex_input) { + auto input_shape = context.mark_node(std::make_shared(complex_input, element::i32)); + + auto zero = v0::Constant::create(element::i32, Shape{1}, {0}); + auto stop = v0::Constant::create(element::i32, Shape{1}, {-1}); + auto step = v0::Constant::create(element::i32, Shape{1}, {1}); + // Removing last dim from shape + return context.mark_node(std::make_shared(input_shape, zero, stop, step, zero)); +} + } // namespace pytorch } // namespace frontend } // namespace ov diff --git a/src/frontends/pytorch/src/utils.hpp b/src/frontends/pytorch/src/utils.hpp index 5eb3f4aa4f64c0..ece73b3ea86ea1 100644 --- a/src/frontends/pytorch/src/utils.hpp +++ b/src/frontends/pytorch/src/utils.hpp @@ -35,7 +35,7 @@ const std::string& get_pytorch_prefix(); OPENVINO_ASSERT_HELPER(::ov::frontend::OpConversionFailure, "", (COND), get_pytorch_prefix(), __VA_ARGS__) #endif -void num_inputs_check(const NodeContext& context, size_t min_inputs, size_t max_inputs); +void num_inputs_check(const NodeContext& context, size_t min_inputs, size_t max_inputs, bool allow_complex = false); Output make_optional_bias(const Output& base_op, const NodeContext& context, @@ -136,6 +136,8 @@ bool index_tensor_on_list(ov::pass::NodeRegistry& rg, Output& new_output, bool& use_input_as_output); +Output get_complex_shape(const NodeContext& context, const Output& complex_input); + namespace op { template OutputVector inplace_op(const NodeContext& context) { diff --git a/src/frontends/tensorflow/src/frontend.cpp b/src/frontends/tensorflow/src/frontend.cpp index af609088679e14..e4e35c42b08b35 100644 --- a/src/frontends/tensorflow/src/frontend.cpp +++ b/src/frontends/tensorflow/src/frontend.cpp @@ -466,12 +466,11 @@ std::shared_ptr FrontEnd::convert(const ov::frontend::InputModel::Ptr // recommend to use openvino-tokenizers if some unconverted operations from tokenizers are met if (unsupported_ops_from_tokenizers.size() > 0) { - exception_message - << "\nEncountered unconverted operation(s) for which openvino-tokenizers package " - "provides conversion extension(s): " - << unsupported_ops_from_tokenizers - << ". Install OpenVINO Tokenizers, refer to the documentation: " - "https://docs.openvino.ai/2024/learn-openvino/llm_inference_guide/ov-tokenizers.html \n"; + exception_message << "\nEncountered unconverted operation(s) for which openvino-tokenizers package " + "provides conversion extension(s): " + << unsupported_ops_from_tokenizers + << ". Install OpenVINO Tokenizers, refer to the documentation: " + "https://docs.openvino.ai/2024/openvino-workflow-generative/ov-tokenizers.html \n"; } } diff --git a/src/frontends/tensorflow/tests/conversion.cpp b/src/frontends/tensorflow/tests/conversion.cpp index d705a26a147839..db95a045351779 100644 --- a/src/frontends/tensorflow/tests/conversion.cpp +++ b/src/frontends/tensorflow/tests/conversion.cpp @@ -1,4 +1,4 @@ -// Copyright (C) 2018-2021 Intel Corporation +// Copyright (C) 2018-2025 Intel Corporation // SPDX-License-Identifier: Apache-2.0 // diff --git a/src/frontends/tensorflow_common/src/op/tensor_scatter_add.cpp b/src/frontends/tensorflow_common/src/op/tensor_scatter_add.cpp index 382f6f1914e334..42a6834cc0007d 100644 --- a/src/frontends/tensorflow_common/src/op/tensor_scatter_add.cpp +++ b/src/frontends/tensorflow_common/src/op/tensor_scatter_add.cpp @@ -1,4 +1,4 @@ -// Copyright (C) 2018-2024 Intel Corporation +// Copyright (C) 2018-2025 Intel Corporation // SPDX-License-Identifier: Apache-2.0 // diff --git a/src/frontends/tensorflow_lite/tests/conversion.cpp b/src/frontends/tensorflow_lite/tests/conversion.cpp index cccae7494f85cb..56484a0b9dcf47 100644 --- a/src/frontends/tensorflow_lite/tests/conversion.cpp +++ b/src/frontends/tensorflow_lite/tests/conversion.cpp @@ -1,4 +1,4 @@ -// Copyright (C) 2018-2021 Intel Corporation +// Copyright (C) 2018-2025 Intel Corporation // SPDX-License-Identifier: Apache-2.0 // diff --git a/src/frontends/tests/frontend/shared/include/conversion_extension.hpp b/src/frontends/tests/frontend/shared/include/conversion_extension.hpp index f9932b7ca5352f..6df8f185b1b83d 100644 --- a/src/frontends/tests/frontend/shared/include/conversion_extension.hpp +++ b/src/frontends/tests/frontend/shared/include/conversion_extension.hpp @@ -1,4 +1,4 @@ -// Copyright (C) 2018-2021 Intel Corporation +// Copyright (C) 2018-2025 Intel Corporation // SPDX-License-Identifier: Apache-2.0 // diff --git a/src/frontends/tests/frontend/shared/src/conversion.cpp b/src/frontends/tests/frontend/shared/src/conversion.cpp index 1a545b92708d76..95200314fcd645 100644 --- a/src/frontends/tests/frontend/shared/src/conversion.cpp +++ b/src/frontends/tests/frontend/shared/src/conversion.cpp @@ -1,4 +1,4 @@ -// Copyright (C) 2018-2021 Intel Corporation +// Copyright (C) 2018-2025 Intel Corporation // SPDX-License-Identifier: Apache-2.0 // diff --git a/src/inference/dev_api/openvino/runtime/threading/istreams_executor.hpp b/src/inference/dev_api/openvino/runtime/threading/istreams_executor.hpp index efb9d41a4dd5a6..18e7216cf22e0d 100644 --- a/src/inference/dev_api/openvino/runtime/threading/istreams_executor.hpp +++ b/src/inference/dev_api/openvino/runtime/threading/istreams_executor.hpp @@ -150,7 +150,7 @@ class OPENVINO_RUNTIME_API IStreamsExecutor : virtual public ITaskExecutor { _cpu_pinning{cpu_pinning}, _cores_limit{cores_limit}, _streams_info_table{std::move(streams_info_table)}, - _rank{rank}, + _rank{std::move(rank)}, _add_lock(add_lock) { update_executor_config(_add_lock); } diff --git a/src/inference/include/openvino/runtime/intel_npu/properties.hpp b/src/inference/include/openvino/runtime/intel_npu/properties.hpp index 723a8b26f555d4..4d7d14a7ebf389 100644 --- a/src/inference/include/openvino/runtime/intel_npu/properties.hpp +++ b/src/inference/include/openvino/runtime/intel_npu/properties.hpp @@ -1,4 +1,4 @@ -// Copyright (C) 2018-2023 Intel Corporation +// Copyright (C) 2018-2025 Intel Corporation // SPDX-License-Identifier: Apache-2.0 // diff --git a/src/inference/src/dev/threading/cpu_streams_executor.cpp b/src/inference/src/dev/threading/cpu_streams_executor.cpp index a10709aa6db3df..bb47b813dce05f 100644 --- a/src/inference/src/dev/threading/cpu_streams_executor.cpp +++ b/src/inference/src/dev/threading/cpu_streams_executor.cpp @@ -36,7 +36,7 @@ struct CPUStreamsExecutor::Impl { : custom::task_scheduler_observer(arena), _mask{std::move(mask)}, _ncpus(ncpus), - _cpu_ids(cpu_ids) {} + _cpu_ids(std::move(cpu_ids)) {} void on_scheduler_entry(bool) override { pin_thread_to_vacant_core(tbb::this_task_arena::current_thread_index(), _threadBindingStep, @@ -167,7 +167,7 @@ struct CPUStreamsExecutor::Impl { _rank = _impl->_config.get_rank(); get_cur_stream_info(stream_id, _impl->_config.get_cpu_pinning(), - org_proc_type_table, + std::move(org_proc_type_table), _impl->_config.get_streams_info_table(), stream_type, concurrency, @@ -504,7 +504,12 @@ void CPUStreamsExecutor::cpu_reset() { CPUStreamsExecutor::CPUStreamsExecutor(const IStreamsExecutor::Config& config) : _impl{new Impl{config}} {} CPUStreamsExecutor::~CPUStreamsExecutor() { - cpu_reset(); + try { + cpu_reset(); + } catch (const ov::Exception&) { + // Destructor should not throw - catch needed for static analysis. + OPENVINO_THROW("Reset CPU state error."); + } { std::lock_guard lock(_impl->_mutex); _impl->_isStopped = true; diff --git a/src/inference/src/dev/threading/istreams_executor.cpp b/src/inference/src/dev/threading/istreams_executor.cpp index 59201baadfd387..663c7d138b397f 100644 --- a/src/inference/src/dev/threading/istreams_executor.cpp +++ b/src/inference/src/dev/threading/istreams_executor.cpp @@ -234,7 +234,7 @@ void IStreamsExecutor::Config::update_executor_config() { if (_thread_preferred_core_type == ov::hint::SchedulingCoreType::ECORE_ONLY) { stream_info[PROC_TYPE] = EFFICIENT_CORE_PROC; stream_info[NUMBER_OF_STREAMS] = _streams; - _streams_info_table.push_back(stream_info); + _streams_info_table.push_back(std::move(stream_info)); } else { int start = proc_type_table.size() > 1 ? 1 : 0; std::vector core_types; diff --git a/src/inference/src/os/lin/lin_system_conf.cpp b/src/inference/src/os/lin/lin_system_conf.cpp index a235227a4b56f0..f809f15a362943 100644 --- a/src/inference/src/os/lin/lin_system_conf.cpp +++ b/src/inference/src/os/lin/lin_system_conf.cpp @@ -140,7 +140,9 @@ CPU::CPU() { } std::string cache_info; std::getline(cache_file, cache_info); - node_info_table.emplace_back(std::move(cache_info)); + if (cache_info.size() > 0) { + node_info_table.emplace_back(std::move(cache_info)); + } node_index++; } }; diff --git a/src/plugins/auto/tests/functional/behavior/auto_func_test.hpp b/src/plugins/auto/tests/functional/behavior/auto_func_test.hpp index 69ab036f22e0af..b49fd6f43e243d 100644 --- a/src/plugins/auto/tests/functional/behavior/auto_func_test.hpp +++ b/src/plugins/auto/tests/functional/behavior/auto_func_test.hpp @@ -1,4 +1,4 @@ -// Copyright (C) 2018-2022 Intel Corporation +// Copyright (C) 2018-2025 Intel Corporation // SPDX-License-Identifier: Apache-2.0 // #pragma once diff --git a/src/plugins/auto/tests/functional/behavior/io_tensor.hpp b/src/plugins/auto/tests/functional/behavior/io_tensor.hpp index c4e000395f3eac..63942f86272d4c 100644 --- a/src/plugins/auto/tests/functional/behavior/io_tensor.hpp +++ b/src/plugins/auto/tests/functional/behavior/io_tensor.hpp @@ -1,4 +1,4 @@ -// Copyright (C) 2018-2022 Intel Corporation +// Copyright (C) 2018-2025 Intel Corporation // SPDX-License-Identifier: Apache-2.0 // #pragma once diff --git a/src/plugins/auto/tests/unit/include/auto_unit_test.hpp b/src/plugins/auto/tests/unit/include/auto_unit_test.hpp index 0b39b8e57dc8d2..af6aa58c163f4e 100644 --- a/src/plugins/auto/tests/unit/include/auto_unit_test.hpp +++ b/src/plugins/auto/tests/unit/include/auto_unit_test.hpp @@ -1,4 +1,4 @@ -// Copyright (C) 2018-2022 Intel Corporation +// Copyright (C) 2018-2025 Intel Corporation // SPDX-License-Identifier: Apache-2.0 // #pragma once diff --git a/src/plugins/auto/tests/unit/infer_request_schedule_policy_test.cpp b/src/plugins/auto/tests/unit/infer_request_schedule_policy_test.cpp index cf1ccda20491d3..f8946664579bdf 100644 --- a/src/plugins/auto/tests/unit/infer_request_schedule_policy_test.cpp +++ b/src/plugins/auto/tests/unit/infer_request_schedule_policy_test.cpp @@ -1,4 +1,4 @@ -// Copyright (C) 2018-2022 Intel Corporation +// Copyright (C) 2018-2025 Intel Corporation // SPDX-License-Identifier: Apache-2.0 // #include diff --git a/src/plugins/auto/tests/unit/meta_device_check_test.cpp b/src/plugins/auto/tests/unit/meta_device_check_test.cpp index 7881899d925f8c..36f5f57dd31229 100644 --- a/src/plugins/auto/tests/unit/meta_device_check_test.cpp +++ b/src/plugins/auto/tests/unit/meta_device_check_test.cpp @@ -1,4 +1,4 @@ -// Copyright (C) 2018-2024 Intel Corporation +// Copyright (C) 2018-2025 Intel Corporation // SPDX-License-Identifier: Apache-2.0 // diff --git a/src/plugins/hetero/tests/functional/hetero_tests.hpp b/src/plugins/hetero/tests/functional/hetero_tests.hpp index 98c2d487761b73..b3bb85ba78a842 100644 --- a/src/plugins/hetero/tests/functional/hetero_tests.hpp +++ b/src/plugins/hetero/tests/functional/hetero_tests.hpp @@ -1,4 +1,4 @@ -// Copyright (C) 2018-2022 Intel Corporation +// Copyright (C) 2018-2025 Intel Corporation // SPDX-License-Identifier: Apache-2.0 // #pragma once diff --git a/src/plugins/hetero/tests/functional/shared_tests_instances/behavior/ov_compiled_model/import_export.cpp b/src/plugins/hetero/tests/functional/shared_tests_instances/behavior/ov_compiled_model/import_export.cpp index 7b6730c4169109..9624edcf80b4d2 100644 --- a/src/plugins/hetero/tests/functional/shared_tests_instances/behavior/ov_compiled_model/import_export.cpp +++ b/src/plugins/hetero/tests/functional/shared_tests_instances/behavior/ov_compiled_model/import_export.cpp @@ -1,4 +1,4 @@ -// Copyright (C) 2018-2023 Intel Corporation +// Copyright (C) 2018-2025 Intel Corporation // SPDX-License-Identifier: Apache-2.0 // #include "behavior/compiled_model/import_export.hpp" diff --git a/src/plugins/hetero/tests/functional/shared_tests_instances/behavior/ov_compiled_model/properties.cpp b/src/plugins/hetero/tests/functional/shared_tests_instances/behavior/ov_compiled_model/properties.cpp index 11bd48ab42e8c0..4907c9af2f0420 100644 --- a/src/plugins/hetero/tests/functional/shared_tests_instances/behavior/ov_compiled_model/properties.cpp +++ b/src/plugins/hetero/tests/functional/shared_tests_instances/behavior/ov_compiled_model/properties.cpp @@ -1,4 +1,4 @@ -// Copyright (C) 2018-2023 Intel Corporation +// Copyright (C) 2018-2025 Intel Corporation // SPDX-License-Identifier: Apache-2.0 // diff --git a/src/plugins/hetero/tests/functional/shared_tests_instances/behavior/ov_infer_request/infer_request_dynamic.cpp b/src/plugins/hetero/tests/functional/shared_tests_instances/behavior/ov_infer_request/infer_request_dynamic.cpp index 711471b9855277..1a2d20d2f61052 100644 --- a/src/plugins/hetero/tests/functional/shared_tests_instances/behavior/ov_infer_request/infer_request_dynamic.cpp +++ b/src/plugins/hetero/tests/functional/shared_tests_instances/behavior/ov_infer_request/infer_request_dynamic.cpp @@ -1,4 +1,4 @@ -// Copyright (C) 2018-2023 Intel Corporation +// Copyright (C) 2018-2025 Intel Corporation // SPDX-License-Identifier: Apache-2.0 // diff --git a/src/plugins/hetero/tests/functional/shared_tests_instances/behavior/ov_infer_request/inference_chaining.cpp b/src/plugins/hetero/tests/functional/shared_tests_instances/behavior/ov_infer_request/inference_chaining.cpp index ed7d1fe42bdf8a..117b095fe2df87 100644 --- a/src/plugins/hetero/tests/functional/shared_tests_instances/behavior/ov_infer_request/inference_chaining.cpp +++ b/src/plugins/hetero/tests/functional/shared_tests_instances/behavior/ov_infer_request/inference_chaining.cpp @@ -1,4 +1,4 @@ -// Copyright (C) 2018-2023 Intel Corporation +// Copyright (C) 2018-2025 Intel Corporation // SPDX-License-Identifier: Apache-2.0 // diff --git a/src/plugins/hetero/tests/functional/shared_tests_instances/behavior/ov_infer_request/io_tensor.cpp b/src/plugins/hetero/tests/functional/shared_tests_instances/behavior/ov_infer_request/io_tensor.cpp index daffaaae81f873..3f4e45f265f16d 100644 --- a/src/plugins/hetero/tests/functional/shared_tests_instances/behavior/ov_infer_request/io_tensor.cpp +++ b/src/plugins/hetero/tests/functional/shared_tests_instances/behavior/ov_infer_request/io_tensor.cpp @@ -1,4 +1,4 @@ -// Copyright (C) 2018-2023 Intel Corporation +// Copyright (C) 2018-2025 Intel Corporation // SPDX-License-Identifier: Apache-2.0 // diff --git a/src/plugins/hetero/tests/functional/shared_tests_instances/behavior/ov_plugin/core_threading_tests.cpp b/src/plugins/hetero/tests/functional/shared_tests_instances/behavior/ov_plugin/core_threading_tests.cpp index 39dc277f25a11e..b0152a06b8ab0f 100644 --- a/src/plugins/hetero/tests/functional/shared_tests_instances/behavior/ov_plugin/core_threading_tests.cpp +++ b/src/plugins/hetero/tests/functional/shared_tests_instances/behavior/ov_plugin/core_threading_tests.cpp @@ -7,7 +7,7 @@ namespace { const Params params[] = { std::tuple{ov::test::utils::DEVICE_HETERO, - {{ov::device::priorities.name(), ov::test::utils::DEVICE_CPU}}}, + {{ov::device::priorities.name(), ov::test::utils::DEVICE_TEMPLATE}}}, }; } // namespace @@ -19,4 +19,4 @@ INSTANTIATE_TEST_SUITE_P(nightly_HETERO, INSTANTIATE_TEST_SUITE_P(HETERO_Streams, CoreThreadingTestsWithIter, testing::Combine(testing::ValuesIn(params), testing::Values(4), testing::Values(50)), - CoreThreadingTestsWithIter::getTestCaseName); \ No newline at end of file + CoreThreadingTestsWithIter::getTestCaseName); diff --git a/src/plugins/hetero/tests/functional/shared_tests_instances/behavior/ov_plugin/properties_tests.cpp b/src/plugins/hetero/tests/functional/shared_tests_instances/behavior/ov_plugin/properties_tests.cpp index 5b691e8ec83328..9f0f1e72cff6ce 100644 --- a/src/plugins/hetero/tests/functional/shared_tests_instances/behavior/ov_plugin/properties_tests.cpp +++ b/src/plugins/hetero/tests/functional/shared_tests_instances/behavior/ov_plugin/properties_tests.cpp @@ -1,4 +1,4 @@ -// Copyright (C) 2018-2023 Intel Corporation +// Copyright (C) 2018-2025 Intel Corporation // SPDX-License-Identifier: Apache-2.0 // diff --git a/src/plugins/intel_cpu/src/cpu_streams_calculation.cpp b/src/plugins/intel_cpu/src/cpu_streams_calculation.cpp index 6b68afffa711e7..8b2c7c620923fe 100644 --- a/src/plugins/intel_cpu/src/cpu_streams_calculation.cpp +++ b/src/plugins/intel_cpu/src/cpu_streams_calculation.cpp @@ -514,7 +514,7 @@ std::vector> get_streams_info_table( ALL_PROC); } else if (stream_info[PROC_TYPE] == MAIN_CORE_PROC) { if (stream_info[THREADS_PER_STREAM] == proc_socket_table[0][MAIN_CORE_PROC]) { - streams_info_table.push_back(stream_info); + streams_info_table.push_back(std::move(stream_info)); } else { stream_info[PROC_TYPE] = ALL_PROC; streams_info_table.push_back(stream_info); @@ -524,10 +524,10 @@ std::vector> get_streams_info_table( streams_info_table.push_back(stream_info); stream_info[PROC_TYPE] = HYPER_THREADING_PROC; stream_info[THREADS_PER_STREAM] = proc_socket_table[0][HYPER_THREADING_PROC]; - streams_info_table.push_back(stream_info); + streams_info_table.push_back(std::move(stream_info)); } } else { - streams_info_table.push_back(stream_info); + streams_info_table.push_back(std::move(stream_info)); } } diff --git a/src/plugins/intel_cpu/src/emitters/plugin/aarch64/jit_eltwise_emitters.cpp b/src/plugins/intel_cpu/src/emitters/plugin/aarch64/jit_eltwise_emitters.cpp index a2041718a14875..b1e64cd25ba0b4 100644 --- a/src/plugins/intel_cpu/src/emitters/plugin/aarch64/jit_eltwise_emitters.cpp +++ b/src/plugins/intel_cpu/src/emitters/plugin/aarch64/jit_eltwise_emitters.cpp @@ -1363,6 +1363,65 @@ void jit_is_nan_emitter::register_table_entries() { push_arg_entry_of("zero", 0x00000000, true); } +/// LESS /// +jit_less_emitter::jit_less_emitter(dnnl::impl::cpu::aarch64::jit_generator* host, + dnnl::impl::cpu::aarch64::cpu_isa_t host_isa, + const std::shared_ptr& node) + : jit_emitter(host, host_isa, node, get_arithmetic_binary_exec_precision(node)) { + prepare_table(); +} + +jit_less_emitter::jit_less_emitter(dnnl::impl::cpu::aarch64::jit_generator* host, + dnnl::impl::cpu::aarch64::cpu_isa_t host_isa, + const ov::element::Type exec_prc) + : jit_emitter(host, host_isa, exec_prc) { + prepare_table(); +} + +size_t jit_less_emitter::get_inputs_count() const { + return 2; +} + +size_t jit_less_emitter::get_aux_vecs_count() const { + return 1; +} + +size_t jit_less_emitter::get_aux_gprs_count() const { + return 1; +} + +void jit_less_emitter::emit_impl(const std::vector& in_vec_idxs, + const std::vector& out_vec_idxs) const { + if (host_isa_ == dnnl::impl::cpu::aarch64::asimd) { + emit_isa(in_vec_idxs, out_vec_idxs); + } else { + OV_CPU_JIT_EMITTER_THROW("Can't create jit eltwise kernel"); + } +} + +template +void jit_less_emitter::emit_isa(const std::vector& in_vec_idxs, const std::vector& out_vec_idxs) const { + OV_CPU_JIT_EMITTER_ASSERT(exec_prc_ == ov::element::f32, "unsupported precision: " + exec_prc_.to_string()); + + using TReg = typename dnnl::impl::cpu::aarch64::cpu_isa_traits::TReg; + const TReg src1 = TReg(in_vec_idxs[0]); + const TReg src2 = TReg(in_vec_idxs[1]); + const TReg dst = TReg(out_vec_idxs[0]); + const TReg aux = TReg(aux_vec_idxs[0]); + + h->fcmgt(dst.s, src2.s, src1.s); + h->ld1r(aux.s, table_val2("one")); + h->and_(dst.b16, dst.b16, aux.b16); +} + +void jit_less_emitter::register_table_entries() { + push_arg_entry_of("one", 0x3f800000, true); +} + +std::set> jit_less_emitter::get_supported_precisions(const std::shared_ptr& node) { + return {{element::f32, element::f32}}; +} + /// LESS_EQUAL /// jit_less_equal_emitter::jit_less_equal_emitter(dnnl::impl::cpu::aarch64::jit_generator* host, dnnl::impl::cpu::aarch64::cpu_isa_t host_isa, diff --git a/src/plugins/intel_cpu/src/emitters/plugin/aarch64/jit_eltwise_emitters.hpp b/src/plugins/intel_cpu/src/emitters/plugin/aarch64/jit_eltwise_emitters.hpp index c4c70c6651522d..5d0e00e2da42b0 100644 --- a/src/plugins/intel_cpu/src/emitters/plugin/aarch64/jit_eltwise_emitters.hpp +++ b/src/plugins/intel_cpu/src/emitters/plugin/aarch64/jit_eltwise_emitters.hpp @@ -608,6 +608,34 @@ class jit_is_inf_emitter : public jit_emitter { bool detect_positive; }; +class jit_less_emitter : public jit_emitter { +public: + jit_less_emitter(dnnl::impl::cpu::aarch64::jit_generator* host, + dnnl::impl::cpu::aarch64::cpu_isa_t host_isa, + const ov::element::Type exec_prc = ov::element::f32); + + jit_less_emitter(dnnl::impl::cpu::aarch64::jit_generator* host, + dnnl::impl::cpu::aarch64::cpu_isa_t host_isa, + const std::shared_ptr& n); + + size_t get_inputs_count() const override; + + size_t get_aux_vecs_count() const override; + + size_t get_aux_gprs_count() const override; + + static std::set> get_supported_precisions( + const std::shared_ptr& node = nullptr); + +private: + void emit_impl(const std::vector& in_vec_idxs, const std::vector& out_vec_idxs) const override; + + template + void emit_isa(const std::vector& in_vec_idxs, const std::vector& out_vec_idxs) const; + + void register_table_entries() override; +}; + class jit_less_equal_emitter : public jit_emitter { public: jit_less_equal_emitter(dnnl::impl::cpu::aarch64::jit_generator* host, diff --git a/src/plugins/intel_cpu/src/emitters/tpp/x64/jit_brgemm_emitter.cpp b/src/plugins/intel_cpu/src/emitters/tpp/x64/jit_brgemm_emitter.cpp index 0fcb394a8a5bde..e873d7f7aa98eb 100644 --- a/src/plugins/intel_cpu/src/emitters/tpp/x64/jit_brgemm_emitter.cpp +++ b/src/plugins/intel_cpu/src/emitters/tpp/x64/jit_brgemm_emitter.cpp @@ -3,6 +3,7 @@ // #include "jit_brgemm_emitter.hpp" + #include "emitters/snippets/x64/jit_snippets_emitters.hpp" #include "transformations/tpp/x64/op/brgemm.hpp" @@ -28,18 +29,15 @@ BrgemmTppEmitter::BrgemmTppEmitter(jit_generator* h, cpu_isa_t isa, const Expres const auto& input_1_desc = expr->get_input_port_descriptor(1); const auto& output_desc = expr->get_output_port_descriptor(0); - std::vector leading_dimensions {brgemm_node->get_input_stride(0), - brgemm_node->get_input_stride(1), - brgemm_node->get_output_stride(0)}; + std::vector leading_dimensions{brgemm_node->get_input_stride(0), + brgemm_node->get_input_stride(1), + brgemm_node->get_output_stride(0)}; auto in_0_prec = ov_to_xsmm_dtype(brgemm_node->get_input_element_type(0)); auto in_1_prec = ov_to_xsmm_dtype(brgemm_node->get_input_element_type(1)); - exec_dtype = in_0_prec == LIBXSMM_DATATYPE_I8 || in_0_prec == LIBXSMM_DATATYPE_U8 ? - LIBXSMM_DATATYPE_I32 : - LIBXSMM_DATATYPE_F32; - auto out_0_prec = exec_dtype == LIBXSMM_DATATYPE_I32 ? - LIBXSMM_DATATYPE_I32 : - LIBXSMM_DATATYPE_F32; + exec_dtype = in_0_prec == LIBXSMM_DATATYPE_I8 || in_0_prec == LIBXSMM_DATATYPE_U8 ? LIBXSMM_DATATYPE_I32 + : LIBXSMM_DATATYPE_F32; + auto out_0_prec = exec_dtype == LIBXSMM_DATATYPE_I32 ? LIBXSMM_DATATYPE_I32 : LIBXSMM_DATATYPE_F32; const auto beta = brgemm_node->get_beta(); OV_CPU_JIT_EMITTER_ASSERT(beta == 0 || beta == 1, "Detected unsupported beta value: " + std::to_string(beta)); @@ -54,18 +52,14 @@ BrgemmTppEmitter::BrgemmTppEmitter(jit_generator* h, cpu_isa_t isa, const Expres const auto N = static_cast(*subtensor_in1.rbegin()); const bool is_f32_gemm = in_0_prec == in_1_prec && in_0_prec == LIBXSMM_DATATYPE_F32; - const bool is_bf16_gemm = in_0_prec == in_1_prec && in_0_prec == LIBXSMM_DATATYPE_BF16; + const bool is_bf16_gemm = in_0_prec == in_1_prec && in_0_prec == LIBXSMM_DATATYPE_BF16; const bool is_i8_gemm = in_0_prec == LIBXSMM_DATATYPE_U8 || in_0_prec == LIBXSMM_DATATYPE_I8; - OV_CPU_JIT_EMITTER_ASSERT(is_f32_gemm || - (is_bf16_gemm && K % 2 == 0) || - (is_i8_gemm && K % 4 == 0), + OV_CPU_JIT_EMITTER_ASSERT(is_f32_gemm || (is_bf16_gemm && K % 2 == 0) || (is_i8_gemm && K % 4 == 0), "Unsupported parameter combination for kernel configuration"); - m_compile_flags = is_f32_gemm ? - LIBXSMM_GEMM_FLAGS('N', 'N') : - LIBXSMM_GEMM_VNNI_FLAGS('N', 'N', 'V', 'N') | - LIBXSMM_GEMM_FLAG_NO_SETUP_TILECONFIG | - LIBXSMM_GEMM_FLAG_NO_RESET_TILECONFIG; + m_compile_flags = is_f32_gemm ? LIBXSMM_GEMM_FLAGS('N', 'N') + : LIBXSMM_GEMM_VNNI_FLAGS('N', 'N', 'V', 'N') | + LIBXSMM_GEMM_FLAG_NO_SETUP_TILECONFIG | LIBXSMM_GEMM_FLAG_NO_RESET_TILECONFIG; if (beta == 0) m_compile_flags |= LIBXSMM_GEMM_FLAG_BETA_0; @@ -79,9 +73,15 @@ BrgemmTppEmitter::BrgemmTppEmitter(jit_generator* h, cpu_isa_t isa, const Expres m_compile_flags |= LIBXSMM_GEMM_FLAG_B_UNSIGNED; } - m_shape = libxsmm_create_gemm_shape(N, M, K, - io_strides[1], io_strides[0], io_strides[2], - in_1_prec, in_0_prec, out_0_prec, + m_shape = libxsmm_create_gemm_shape(N, + M, + K, + io_strides[1], + io_strides[0], + io_strides[2], + in_1_prec, + in_0_prec, + out_0_prec, exec_dtype); m_prefetching_flags = LIBXSMM_GEMM_PREFETCH_NONE; } @@ -91,7 +91,7 @@ std::set> BrgemmTppEmitter::get_supported_precisions( return {{element::f32, element::f32}}; } -void BrgemmTppEmitter::validate_arguments(const std::vector &in, const std::vector &out) const { +void BrgemmTppEmitter::validate_arguments(const std::vector& in, const std::vector& out) const { OV_CPU_JIT_EMITTER_ASSERT(in.size() == 2, "Expects 2 input regs, got" + std::to_string(in.size())); OV_CPU_JIT_EMITTER_ASSERT(out.size() == 1, "Expects 1 output reg, got" + std::to_string(out.size())); } @@ -100,7 +100,7 @@ const uintptr_t BrgemmTppEmitter::get_compiled_kernel_ptr() const { return COMPILE_TPP_KERNEL(libxsmm_dispatch_gemm(m_shape, m_compile_flags, m_prefetching_flags)); } -void BrgemmTppEmitter::execute_brgemm_kernel(libxsmm_gemmfunction brg_kernel, void *in0, void *in1, void *out0) { +void BrgemmTppEmitter::execute_brgemm_kernel(libxsmm_gemmfunction brg_kernel, void* in0, void* in1, void* out0) { libxsmm_gemm_param gemm_p; gemm_p.a.primary = in1; gemm_p.b.primary = in0; diff --git a/src/plugins/intel_cpu/src/emitters/tpp/x64/jit_scalar_emitter.cpp b/src/plugins/intel_cpu/src/emitters/tpp/x64/jit_scalar_emitter.cpp index 5b156100073534..fa38eacb4e870b 100644 --- a/src/plugins/intel_cpu/src/emitters/tpp/x64/jit_scalar_emitter.cpp +++ b/src/plugins/intel_cpu/src/emitters/tpp/x64/jit_scalar_emitter.cpp @@ -3,6 +3,7 @@ // #include "jit_scalar_emitter.hpp" + #include "emitters/snippets/x64/jit_snippets_emitters.hpp" using namespace Xbyak; diff --git a/src/plugins/intel_cpu/src/emitters/tpp/x64/jit_scalar_emitter.hpp b/src/plugins/intel_cpu/src/emitters/tpp/x64/jit_scalar_emitter.hpp index e8235f6b86e88c..c59153fdb3aaec 100644 --- a/src/plugins/intel_cpu/src/emitters/tpp/x64/jit_scalar_emitter.hpp +++ b/src/plugins/intel_cpu/src/emitters/tpp/x64/jit_scalar_emitter.hpp @@ -3,8 +3,8 @@ // #pragma once -#include "snippets/lowered/expression.hpp" #include "emitters/plugin/x64/jit_emitter.hpp" +#include "snippets/lowered/expression.hpp" namespace ov { namespace intel_cpu { @@ -13,11 +13,16 @@ class ScalarTppEmitter : public jit_emitter { ScalarTppEmitter(dnnl::impl::cpu::x64::jit_generator* h, dnnl::impl::cpu::x64::cpu_isa_t isa, const ov::snippets::lowered::ExpressionPtr& expr); - size_t get_inputs_num() const override {return 0;} - size_t aux_gprs_count() const override {return 1;} + size_t get_inputs_num() const override { + return 0; + } + size_t aux_gprs_count() const override { + return 1; + } + private: void emit_impl(const std::vector& in, const std::vector& out) const override; }; -} // namespace intel_cpu -} // namespace ov +} // namespace intel_cpu +} // namespace ov diff --git a/src/plugins/intel_cpu/src/memory_desc/empty_memory_desc.h b/src/plugins/intel_cpu/src/memory_desc/empty_memory_desc.h index c26cc6aa33a251..dac07c252e902a 100644 --- a/src/plugins/intel_cpu/src/memory_desc/empty_memory_desc.h +++ b/src/plugins/intel_cpu/src/memory_desc/empty_memory_desc.h @@ -1,4 +1,4 @@ -// Copyright (C) 2018-2023 Intel Corporation +// Copyright (C) 2018-2025 Intel Corporation // SPDX-License-Identifier: Apache-2.0 // diff --git a/src/plugins/intel_cpu/src/nodes/causal_mask_preprocess.cpp b/src/plugins/intel_cpu/src/nodes/causal_mask_preprocess.cpp index 93f5278b06a4a8..afc057bbe29e0b 100644 --- a/src/plugins/intel_cpu/src/nodes/causal_mask_preprocess.cpp +++ b/src/plugins/intel_cpu/src/nodes/causal_mask_preprocess.cpp @@ -1,4 +1,4 @@ -// Copyright (C) 2018-2023 Intel Corporation +// Copyright (C) 2018-2025 Intel Corporation // SPDX-License-Identifier: Apache-2.0 // diff --git a/src/plugins/intel_cpu/src/nodes/causal_mask_preprocess.h b/src/plugins/intel_cpu/src/nodes/causal_mask_preprocess.h index b35de8e25fcae9..da0aa4284382dd 100644 --- a/src/plugins/intel_cpu/src/nodes/causal_mask_preprocess.h +++ b/src/plugins/intel_cpu/src/nodes/causal_mask_preprocess.h @@ -1,4 +1,4 @@ -// Copyright (C) 2018-2023 Intel Corporation +// Copyright (C) 2018-2025 Intel Corporation // SPDX-License-Identifier: Apache-2.0 // diff --git a/src/plugins/intel_cpu/src/nodes/common/reorder_prim.cpp b/src/plugins/intel_cpu/src/nodes/common/reorder_prim.cpp index 2ee4c0a23bbdab..5223f6d90c0279 100644 --- a/src/plugins/intel_cpu/src/nodes/common/reorder_prim.cpp +++ b/src/plugins/intel_cpu/src/nodes/common/reorder_prim.cpp @@ -1,4 +1,4 @@ -// Copyright (C) 2018-2022 Intel Corporation +// Copyright (C) 2018-2025 Intel Corporation // SPDX-License-Identifier: Apache-2.0 // diff --git a/src/plugins/intel_cpu/src/nodes/common/reorder_prim.h b/src/plugins/intel_cpu/src/nodes/common/reorder_prim.h index 33e12b4045abf9..27774eb4557602 100644 --- a/src/plugins/intel_cpu/src/nodes/common/reorder_prim.h +++ b/src/plugins/intel_cpu/src/nodes/common/reorder_prim.h @@ -1,4 +1,4 @@ -// Copyright (C) 2018-2022 Intel Corporation +// Copyright (C) 2018-2025 Intel Corporation // SPDX-License-Identifier: Apache-2.0 // diff --git a/src/plugins/intel_cpu/src/nodes/deconv.cpp b/src/plugins/intel_cpu/src/nodes/deconv.cpp index 886497bd57cc29..4090244a17ec32 100644 --- a/src/plugins/intel_cpu/src/nodes/deconv.cpp +++ b/src/plugins/intel_cpu/src/nodes/deconv.cpp @@ -125,16 +125,43 @@ bool DeconvKey::operator==(const DeconvKey& rhs) const { * input. Since in case it exists, plugin should pass the input data to the shape inference function. * */ -class DeconfolutionShapeInferFactory : public ShapeInferFactory { +class DeconvolutionShapeInferFactory : public ShapeInferFactory { public: - DeconfolutionShapeInferFactory(std::shared_ptr op) : m_op(std::move(op)) {} + DeconvolutionShapeInferFactory(std::shared_ptr op) : m_op(std::move(op)) {} ShapeInferPtr makeShapeInfer() const override { - const auto port_mask = (m_op->get_input_size() > 2) ? PortMask(2) : EMPTY_PORT_MASK; - return make_shape_inference(m_op, port_mask); + return std::make_shared(m_op); } private: + class DeconvolutionShapeInfer : public IShapeInfer { + public: + DeconvolutionShapeInfer(const std::shared_ptr& op) + : m_shape_infer(make_shape_inference(op)), + m_port_mask((op->get_input_size() > 2) ? PortMask(2) : EMPTY_PORT_MASK) {} + + Result infer(const std::vector>& input_shapes, + const std::unordered_map& data_dependency) override { + return m_shape_infer->infer(input_shapes, data_dependency); + } + + const ov::CoordinateDiff& get_pads_begin() override { + return m_shape_infer->get_pads_begin(); + } + + const ov::CoordinateDiff& get_pads_end() override { + return m_shape_infer->get_pads_end(); + } + + port_mask_t get_port_mask() const override { + return m_port_mask; + }; + + private: + ShapeInferPtr m_shape_infer; + const port_mask_t m_port_mask; + }; + std::shared_ptr m_op; }; } // namespace @@ -165,7 +192,7 @@ bool Deconvolution::isSupportedOperation(const std::shared_ptr& } Deconvolution::Deconvolution(const std::shared_ptr& op, const GraphContext::CPtr& context) - : Node(op, context, DeconfolutionShapeInferFactory(op)) { + : Node(op, context, DeconvolutionShapeInferFactory(op)) { std::string errorMessage; if (!isSupportedOperation(op, errorMessage)) OPENVINO_THROW_NOT_IMPLEMENTED(errorMessage); diff --git a/src/plugins/intel_cpu/src/nodes/depth_to_space.cpp b/src/plugins/intel_cpu/src/nodes/depth_to_space.cpp index bf0823885ebc71..ed8f1776d6c974 100644 --- a/src/plugins/intel_cpu/src/nodes/depth_to_space.cpp +++ b/src/plugins/intel_cpu/src/nodes/depth_to_space.cpp @@ -14,8 +14,6 @@ #include "openvino/opsets/opset1.hpp" #include "utils/general_utils.h" -#define THROW_ERROR(...) OPENVINO_THROW("DepthToSpace layer with name '", getName(), "' ", __VA_ARGS__) - using namespace dnnl::impl; namespace ov { @@ -73,11 +71,11 @@ DepthToSpace::DepthToSpace(const std::shared_ptr& op, const GraphConte OPENVINO_THROW_NOT_IMPLEMENTED(errorMessage); } if (inputShapes.size() != 1 || outputShapes.size() != 1) - THROW_ERROR("has incorrect number of input/output edges!"); + THROW_CPU_NODE_ERR("has incorrect number of input/output edges!"); auto depthToSpace = ov::as_type_ptr(op); if (!depthToSpace) - THROW_ERROR("supports only opset1"); + THROW_CPU_NODE_ERR("supports only opset1"); const auto modeNgraph = depthToSpace->get_mode(); if (modeNgraph == ov::op::v0::DepthToSpace::DepthToSpaceMode::BLOCKS_FIRST) { @@ -85,22 +83,22 @@ DepthToSpace::DepthToSpace(const std::shared_ptr& op, const GraphConte } else if (modeNgraph == ov::op::v0::DepthToSpace::DepthToSpaceMode::DEPTH_FIRST) { attrs.mode = Mode::DEPTH_FIRST; } else { - THROW_ERROR("doesn't support mode: ", ov::as_string(modeNgraph)); + THROW_CPU_NODE_ERR("doesn't support mode: ", ov::as_string(modeNgraph)); } attrs.blockSize = depthToSpace->get_block_size(); if (attrs.blockSize == 0) - THROW_ERROR("has incorrect block_size parameter is zero!"); + THROW_CPU_NODE_ERR("has incorrect block_size parameter is zero!"); const size_t srcRank = getInputShapeAtPort(0).getRank(); const size_t dstRank = getOutputShapeAtPort(0).getRank(); if (srcRank < 3) - THROW_ERROR("has incorrect number of input dimensions"); + THROW_CPU_NODE_ERR("has incorrect number of input dimensions"); if (srcRank > 5) - THROW_ERROR("doesn't support dimensions with rank greater than 5"); + THROW_CPU_NODE_ERR("doesn't support dimensions with rank greater than 5"); if (srcRank != dstRank) - THROW_ERROR("has incorrect number of input/output dimensions"); + THROW_CPU_NODE_ERR("has incorrect number of input/output dimensions"); const size_t nSpatialDims = srcRank - 2; attrs.blockStep = static_cast(std::pow(attrs.blockSize, nSpatialDims)); @@ -164,11 +162,11 @@ void DepthToSpace::createPrimitive() { auto dstMemPtr = getDstMemoryAtPort(0); auto srcMemPtr = getSrcMemoryAtPort(0); if (!dstMemPtr) - THROW_ERROR("has null destination memory"); + THROW_CPU_NODE_ERR("has null destination memory"); if (!srcMemPtr) - THROW_ERROR("has null input memory"); + THROW_CPU_NODE_ERR("has null input memory"); if (getSelectedPrimitiveDescriptor() == nullptr) - THROW_ERROR("has unidentified preferable primitive descriptor"); + THROW_CPU_NODE_ERR("has unidentified preferable primitive descriptor"); const auto& memoryDesc = srcMemPtr->getDesc(); attrs.dataSize = memoryDesc.getPrecision().size(); @@ -305,7 +303,7 @@ void DepthToSpace::DepthToSpaceExecutor::exec(const MemoryPtr& srcMemPtr, const void DepthToSpace::execute(const dnnl::stream& strm) { if (!execPtr) { - THROW_ERROR("doesn't have a compiled executor."); + THROW_CPU_NODE_ERR("doesn't have a compiled executor."); } int MB = getSrcMemoryAtPort(0)->getStaticDims()[0]; diff --git a/src/plugins/intel_cpu/src/nodes/executors/aarch64/jit_eltwise.cpp b/src/plugins/intel_cpu/src/nodes/executors/aarch64/jit_eltwise.cpp index d5b893b67bf2b1..8d5e905f10e86a 100644 --- a/src/plugins/intel_cpu/src/nodes/executors/aarch64/jit_eltwise.cpp +++ b/src/plugins/intel_cpu/src/nodes/executors/aarch64/jit_eltwise.cpp @@ -38,6 +38,7 @@ bool JitEltwiseExecutor::isSupported(const Algorithm& algorithm, Algorithm::EltwiseIsFinite, Algorithm::EltwiseIsInf, Algorithm::EltwiseIsNaN, + Algorithm::EltwiseLess, Algorithm::EltwiseLessEqual, Algorithm::EltwiseLogicalAnd, Algorithm::EltwiseLogicalOr, diff --git a/src/plugins/intel_cpu/src/nodes/executors/acl/acl_eltwise.cpp b/src/plugins/intel_cpu/src/nodes/executors/acl/acl_eltwise.cpp index 7a8e431b606227..b104ca7d44aa24 100644 --- a/src/plugins/intel_cpu/src/nodes/executors/acl/acl_eltwise.cpp +++ b/src/plugins/intel_cpu/src/nodes/executors/acl/acl_eltwise.cpp @@ -1,4 +1,4 @@ -// Copyright (C) 2018-2022 Intel Corporation +// Copyright (C) 2018-2025 Intel Corporation // SPDX-License-Identifier: Apache-2.0 // diff --git a/src/plugins/intel_cpu/src/nodes/executors/acl/acl_eltwise.hpp b/src/plugins/intel_cpu/src/nodes/executors/acl/acl_eltwise.hpp index 1aae396f25a0fe..dfb09c3a896a04 100644 --- a/src/plugins/intel_cpu/src/nodes/executors/acl/acl_eltwise.hpp +++ b/src/plugins/intel_cpu/src/nodes/executors/acl/acl_eltwise.hpp @@ -1,4 +1,4 @@ -// Copyright (C) 2018-2022 Intel Corporation +// Copyright (C) 2018-2025 Intel Corporation // SPDX-License-Identifier: Apache-2.0 // diff --git a/src/plugins/intel_cpu/src/nodes/executors/acl/acl_utils.cpp b/src/plugins/intel_cpu/src/nodes/executors/acl/acl_utils.cpp index 6c3799da70bfda..e6b8242210c57d 100644 --- a/src/plugins/intel_cpu/src/nodes/executors/acl/acl_utils.cpp +++ b/src/plugins/intel_cpu/src/nodes/executors/acl/acl_utils.cpp @@ -1,4 +1,4 @@ -// Copyright (C) 2018-2023 Intel Corporation +// Copyright (C) 2018-2025 Intel Corporation // SPDX-License-Identifier: Apache-2.0 // diff --git a/src/plugins/intel_cpu/src/nodes/executors/convert.cpp b/src/plugins/intel_cpu/src/nodes/executors/convert.cpp index cf11633e662e07..3dae01f201e2dd 100644 --- a/src/plugins/intel_cpu/src/nodes/executors/convert.cpp +++ b/src/plugins/intel_cpu/src/nodes/executors/convert.cpp @@ -1,4 +1,4 @@ -// Copyright (C) 2018-2022 Intel Corporation +// Copyright (C) 2018-2025 Intel Corporation // SPDX-License-Identifier: Apache-2.0 // diff --git a/src/plugins/intel_cpu/src/nodes/executors/convert.hpp b/src/plugins/intel_cpu/src/nodes/executors/convert.hpp index 85cd64e26c643c..56c5ba02d4f147 100644 --- a/src/plugins/intel_cpu/src/nodes/executors/convert.hpp +++ b/src/plugins/intel_cpu/src/nodes/executors/convert.hpp @@ -1,4 +1,4 @@ -// Copyright (C) 2018-2022 Intel Corporation +// Copyright (C) 2018-2025 Intel Corporation // SPDX-License-Identifier: Apache-2.0 // diff --git a/src/plugins/intel_cpu/src/nodes/executors/deconv.hpp b/src/plugins/intel_cpu/src/nodes/executors/deconv.hpp index 44731d0648d039..5b28c47e2e11fb 100644 --- a/src/plugins/intel_cpu/src/nodes/executors/deconv.hpp +++ b/src/plugins/intel_cpu/src/nodes/executors/deconv.hpp @@ -1,4 +1,4 @@ -// Copyright (C) 2018-2022 Intel Corporation +// Copyright (C) 2018-2025 Intel Corporation // SPDX-License-Identifier: Apache-2.0 // diff --git a/src/plugins/intel_cpu/src/nodes/executors/deconv_list.hpp b/src/plugins/intel_cpu/src/nodes/executors/deconv_list.hpp index 45e71acd476bb6..e725a3b244e02a 100644 --- a/src/plugins/intel_cpu/src/nodes/executors/deconv_list.hpp +++ b/src/plugins/intel_cpu/src/nodes/executors/deconv_list.hpp @@ -1,4 +1,4 @@ -// Copyright (C) 2018-2022 Intel Corporation +// Copyright (C) 2018-2025 Intel Corporation // SPDX-License-Identifier: Apache-2.0 // diff --git a/src/plugins/intel_cpu/src/nodes/executors/dnnl/dnnl_convolution_primitive.hpp b/src/plugins/intel_cpu/src/nodes/executors/dnnl/dnnl_convolution_primitive.hpp index c342f5106c221d..55c66c6fa1cbbb 100644 --- a/src/plugins/intel_cpu/src/nodes/executors/dnnl/dnnl_convolution_primitive.hpp +++ b/src/plugins/intel_cpu/src/nodes/executors/dnnl/dnnl_convolution_primitive.hpp @@ -1,4 +1,4 @@ -// Copyright (C) 2018-2022 Intel Corporation +// Copyright (C) 2018-2025 Intel Corporation // SPDX-License-Identifier: Apache-2.0 // diff --git a/src/plugins/intel_cpu/src/nodes/executors/dnnl/dnnl_fullyconnected_primitive.hpp b/src/plugins/intel_cpu/src/nodes/executors/dnnl/dnnl_fullyconnected_primitive.hpp index 9afcfac56b14e9..849d7122d45726 100644 --- a/src/plugins/intel_cpu/src/nodes/executors/dnnl/dnnl_fullyconnected_primitive.hpp +++ b/src/plugins/intel_cpu/src/nodes/executors/dnnl/dnnl_fullyconnected_primitive.hpp @@ -1,4 +1,4 @@ -// Copyright (C) 2018-2022 Intel Corporation +// Copyright (C) 2018-2025 Intel Corporation // SPDX-License-Identifier: Apache-2.0 // diff --git a/src/plugins/intel_cpu/src/nodes/executors/dnnl/dnnl_matmul_primitive.hpp b/src/plugins/intel_cpu/src/nodes/executors/dnnl/dnnl_matmul_primitive.hpp index 38ceb9922eff70..25e3dcf6ae6421 100644 --- a/src/plugins/intel_cpu/src/nodes/executors/dnnl/dnnl_matmul_primitive.hpp +++ b/src/plugins/intel_cpu/src/nodes/executors/dnnl/dnnl_matmul_primitive.hpp @@ -1,4 +1,4 @@ -// Copyright (C) 2018-2022 Intel Corporation +// Copyright (C) 2018-2025 Intel Corporation // SPDX-License-Identifier: Apache-2.0 // diff --git a/src/plugins/intel_cpu/src/nodes/executors/eltwise.cpp b/src/plugins/intel_cpu/src/nodes/executors/eltwise.cpp index 31ffd979662f8c..649e0d0f058bc0 100644 --- a/src/plugins/intel_cpu/src/nodes/executors/eltwise.cpp +++ b/src/plugins/intel_cpu/src/nodes/executors/eltwise.cpp @@ -1,4 +1,4 @@ -// Copyright (C) 2018-2022 Intel Corporation +// Copyright (C) 2018-2025 Intel Corporation // SPDX-License-Identifier: Apache-2.0mvn // diff --git a/src/plugins/intel_cpu/src/nodes/executors/eltwise.hpp b/src/plugins/intel_cpu/src/nodes/executors/eltwise.hpp index 95ff85bb8bf851..02a044d89b6959 100644 --- a/src/plugins/intel_cpu/src/nodes/executors/eltwise.hpp +++ b/src/plugins/intel_cpu/src/nodes/executors/eltwise.hpp @@ -1,4 +1,4 @@ -// Copyright (C) 2018-2022 Intel Corporation +// Copyright (C) 2018-2025 Intel Corporation // SPDX-License-Identifier: Apache-2.0 // diff --git a/src/plugins/intel_cpu/src/nodes/executors/eltwise_list.cpp b/src/plugins/intel_cpu/src/nodes/executors/eltwise_list.cpp index 5b9479bdf502b6..bfc54e11d42934 100644 --- a/src/plugins/intel_cpu/src/nodes/executors/eltwise_list.cpp +++ b/src/plugins/intel_cpu/src/nodes/executors/eltwise_list.cpp @@ -1,4 +1,4 @@ -// Copyright (C) 2018-2022 Intel Corporation +// Copyright (C) 2018-2025 Intel Corporation // SPDX-License-Identifier: Apache-2.0 // diff --git a/src/plugins/intel_cpu/src/nodes/executors/eltwise_list.hpp b/src/plugins/intel_cpu/src/nodes/executors/eltwise_list.hpp index f970d79c3ed1b2..3d976fa94d8c1e 100644 --- a/src/plugins/intel_cpu/src/nodes/executors/eltwise_list.hpp +++ b/src/plugins/intel_cpu/src/nodes/executors/eltwise_list.hpp @@ -1,4 +1,4 @@ -// Copyright (C) 2018-2022 Intel Corporation +// Copyright (C) 2018-2025 Intel Corporation // SPDX-License-Identifier: Apache-2.0 // diff --git a/src/plugins/intel_cpu/src/nodes/executors/executor.hpp b/src/plugins/intel_cpu/src/nodes/executors/executor.hpp index 1d0e4c877ff8e5..cf0e8fed14be2b 100644 --- a/src/plugins/intel_cpu/src/nodes/executors/executor.hpp +++ b/src/plugins/intel_cpu/src/nodes/executors/executor.hpp @@ -1,4 +1,4 @@ -// Copyright (C) 2018-2022 Intel Corporation +// Copyright (C) 2018-2025 Intel Corporation // SPDX-License-Identifier: Apache-2.0 // diff --git a/src/plugins/intel_cpu/src/nodes/executors/executor_implementation.hpp b/src/plugins/intel_cpu/src/nodes/executors/executor_implementation.hpp index 375016038f2b68..6189fac38c06d5 100644 --- a/src/plugins/intel_cpu/src/nodes/executors/executor_implementation.hpp +++ b/src/plugins/intel_cpu/src/nodes/executors/executor_implementation.hpp @@ -1,4 +1,4 @@ -// Copyright (C) 2018-2022 Intel Corporation +// Copyright (C) 2018-2025 Intel Corporation // SPDX-License-Identifier: Apache-2.0 // diff --git a/src/plugins/intel_cpu/src/nodes/executors/fullyconnected_implementations.cpp b/src/plugins/intel_cpu/src/nodes/executors/fullyconnected_implementations.cpp index 792aacf54a118a..3b702844850744 100644 --- a/src/plugins/intel_cpu/src/nodes/executors/fullyconnected_implementations.cpp +++ b/src/plugins/intel_cpu/src/nodes/executors/fullyconnected_implementations.cpp @@ -1,4 +1,4 @@ -// Copyright (C) 2018-2022 Intel Corporation +// Copyright (C) 2018-2025 Intel Corporation // SPDX-License-Identifier: Apache-2.0 // diff --git a/src/plugins/intel_cpu/src/nodes/executors/graph_emitter.hpp b/src/plugins/intel_cpu/src/nodes/executors/graph_emitter.hpp index 2f1ca6600bbd14..f89e35409008a4 100644 --- a/src/plugins/intel_cpu/src/nodes/executors/graph_emitter.hpp +++ b/src/plugins/intel_cpu/src/nodes/executors/graph_emitter.hpp @@ -1,4 +1,4 @@ -// Copyright (C) 2018-2022 Intel Corporation +// Copyright (C) 2018-2025 Intel Corporation // SPDX-License-Identifier: Apache-2.0 // diff --git a/src/plugins/intel_cpu/src/nodes/executors/interpolate_list.cpp b/src/plugins/intel_cpu/src/nodes/executors/interpolate_list.cpp index 21ae249757bf9c..43a567b874a4ac 100644 --- a/src/plugins/intel_cpu/src/nodes/executors/interpolate_list.cpp +++ b/src/plugins/intel_cpu/src/nodes/executors/interpolate_list.cpp @@ -1,4 +1,4 @@ -// Copyright (C) 2018-2022 Intel Corporation +// Copyright (C) 2018-2025 Intel Corporation // SPDX-License-Identifier: Apache-2.0 // diff --git a/src/plugins/intel_cpu/src/nodes/executors/mlas/mlas_gemm.hpp b/src/plugins/intel_cpu/src/nodes/executors/mlas/mlas_gemm.hpp index 42be857ba9dead..3e43bda24119ee 100644 --- a/src/plugins/intel_cpu/src/nodes/executors/mlas/mlas_gemm.hpp +++ b/src/plugins/intel_cpu/src/nodes/executors/mlas/mlas_gemm.hpp @@ -1,4 +1,4 @@ -// Copyright (C) 2018-2022 Intel Corporation +// Copyright (C) 2018-2025 Intel Corporation // SPDX-License-Identifier: Apache-2.0 // #pragma once diff --git a/src/plugins/intel_cpu/src/nodes/executors/mvn.cpp b/src/plugins/intel_cpu/src/nodes/executors/mvn.cpp index 2c66b9ce56af14..d64e1faf5fa5c8 100644 --- a/src/plugins/intel_cpu/src/nodes/executors/mvn.cpp +++ b/src/plugins/intel_cpu/src/nodes/executors/mvn.cpp @@ -1,4 +1,4 @@ -// Copyright (C) 2018-2022 Intel Corporation +// Copyright (C) 2018-2025 Intel Corporation // SPDX-License-Identifier: Apache-2.0 // diff --git a/src/plugins/intel_cpu/src/nodes/executors/mvn.hpp b/src/plugins/intel_cpu/src/nodes/executors/mvn.hpp index 2b08dc2a320b5d..0ff25d1f3dd59f 100644 --- a/src/plugins/intel_cpu/src/nodes/executors/mvn.hpp +++ b/src/plugins/intel_cpu/src/nodes/executors/mvn.hpp @@ -1,4 +1,4 @@ -// Copyright (C) 2018-2022 Intel Corporation +// Copyright (C) 2018-2025 Intel Corporation // SPDX-License-Identifier: Apache-2.0 // diff --git a/src/plugins/intel_cpu/src/nodes/executors/mvn_list.cpp b/src/plugins/intel_cpu/src/nodes/executors/mvn_list.cpp index 99a55d79f58177..b96a2e3c655de7 100644 --- a/src/plugins/intel_cpu/src/nodes/executors/mvn_list.cpp +++ b/src/plugins/intel_cpu/src/nodes/executors/mvn_list.cpp @@ -1,4 +1,4 @@ -// Copyright (C) 2018-2022 Intel Corporation +// Copyright (C) 2018-2025 Intel Corporation // SPDX-License-Identifier: Apache-2.0 // diff --git a/src/plugins/intel_cpu/src/nodes/executors/mvn_list.hpp b/src/plugins/intel_cpu/src/nodes/executors/mvn_list.hpp index 59d0447965a803..1cff58995addce 100644 --- a/src/plugins/intel_cpu/src/nodes/executors/mvn_list.hpp +++ b/src/plugins/intel_cpu/src/nodes/executors/mvn_list.hpp @@ -1,4 +1,4 @@ -// Copyright (C) 2018-2022 Intel Corporation +// Copyright (C) 2018-2025 Intel Corporation // SPDX-License-Identifier: Apache-2.0 // diff --git a/src/plugins/intel_cpu/src/nodes/executors/pooling.hpp b/src/plugins/intel_cpu/src/nodes/executors/pooling.hpp index 325ae17f161c93..5af8ad8b48d32e 100644 --- a/src/plugins/intel_cpu/src/nodes/executors/pooling.hpp +++ b/src/plugins/intel_cpu/src/nodes/executors/pooling.hpp @@ -1,4 +1,4 @@ -// Copyright (C) 2018-2022 Intel Corporation +// Copyright (C) 2018-2025 Intel Corporation // SPDX-License-Identifier: Apache-2.0 // diff --git a/src/plugins/intel_cpu/src/nodes/executors/pooling_list.hpp b/src/plugins/intel_cpu/src/nodes/executors/pooling_list.hpp index 1cf34912e2293f..a9e2ca13c1621c 100644 --- a/src/plugins/intel_cpu/src/nodes/executors/pooling_list.hpp +++ b/src/plugins/intel_cpu/src/nodes/executors/pooling_list.hpp @@ -1,4 +1,4 @@ -// Copyright (C) 2018-2022 Intel Corporation +// Copyright (C) 2018-2025 Intel Corporation // SPDX-License-Identifier: Apache-2.0 // diff --git a/src/plugins/intel_cpu/src/nodes/executors/transpose.cpp b/src/plugins/intel_cpu/src/nodes/executors/transpose.cpp index ddf4cf20034d92..278e6e7b16d668 100644 --- a/src/plugins/intel_cpu/src/nodes/executors/transpose.cpp +++ b/src/plugins/intel_cpu/src/nodes/executors/transpose.cpp @@ -1,4 +1,4 @@ -// Copyright (C) 2018-2022 Intel Corporation +// Copyright (C) 2018-2025 Intel Corporation // SPDX-License-Identifier: Apache-2.0 // diff --git a/src/plugins/intel_cpu/src/nodes/executors/transpose.hpp b/src/plugins/intel_cpu/src/nodes/executors/transpose.hpp index 6e569e62b65a19..2f1101a7a1ec54 100644 --- a/src/plugins/intel_cpu/src/nodes/executors/transpose.hpp +++ b/src/plugins/intel_cpu/src/nodes/executors/transpose.hpp @@ -1,4 +1,4 @@ -// Copyright (C) 2018-2022 Intel Corporation +// Copyright (C) 2018-2025 Intel Corporation // SPDX-License-Identifier: Apache-2.0 // diff --git a/src/plugins/intel_cpu/src/nodes/eye.cpp b/src/plugins/intel_cpu/src/nodes/eye.cpp index 873d07673c8990..411a77260aa7d6 100644 --- a/src/plugins/intel_cpu/src/nodes/eye.cpp +++ b/src/plugins/intel_cpu/src/nodes/eye.cpp @@ -12,8 +12,6 @@ #include "shape_inference/shape_inference.hpp" #include "utils/bfloat16.hpp" -#define THROW_ERROR(...) OPENVINO_THROW(NameFromType(getType()), " node with name '", getName(), "' ", __VA_ARGS__) - namespace ov { namespace intel_cpu { namespace node { @@ -31,22 +29,8 @@ bool Eye::isSupportedOperation(const std::shared_ptr& op, std::s return true; } -namespace { -class EyeShapeInferFactory : public ShapeInferFactory { -public: - EyeShapeInferFactory(std::shared_ptr op) : m_op(std::move(op)) {} - ShapeInferPtr makeShapeInfer() const override { - return (m_op->get_input_size() == 4) ? make_shape_inference(m_op) - : make_shape_inference(m_op, PortMask(Eye::ROWS_NUM, Eye::COLS_NUM)); - } - -private: - std::shared_ptr m_op; -}; -} // namespace - Eye::Eye(const std::shared_ptr& op, const GraphContext::CPtr& context) - : Node(op, context, EyeShapeInferFactory(op)) { + : Node(op, context, NgraphShapeInferFactory(op)) { std::string errorMessage; if (!isSupportedOperation(op, errorMessage)) { OPENVINO_THROW_NOT_IMPLEMENTED(errorMessage); diff --git a/src/plugins/intel_cpu/src/nodes/gather.cpp b/src/plugins/intel_cpu/src/nodes/gather.cpp index e72901d7d43e62..f349990f56f620 100644 --- a/src/plugins/intel_cpu/src/nodes/gather.cpp +++ b/src/plugins/intel_cpu/src/nodes/gather.cpp @@ -24,8 +24,6 @@ using namespace dnnl::impl::cpu; -#define THROW_ERROR(...) OPENVINO_THROW(getTypeStr(), " node with name '", getName(), "' ", __VA_ARGS__) - namespace ov { namespace intel_cpu { namespace node { @@ -69,7 +67,7 @@ Gather::Gather(const std::shared_ptr& op, const GraphContext::CPtr& co if (one_of(op->get_input_size(), 4u, 5u) && op->get_output_size() == 1u) { compressed = true; } else if (op->get_input_size() != 3 || op->get_output_size() != 1) { - THROW_ERROR("has incorrect number of input/output edges!"); + THROW_CPU_NODE_ERR("has incorrect number of input/output edges!"); } const auto& dataShape = getInputShapeAtPort(GATHER_DATA); @@ -80,7 +78,7 @@ Gather::Gather(const std::shared_ptr& op, const GraphContext::CPtr& co isIdxShapeStat = idxShape.isStatic(); const auto indicesRank = idxShape.getRank(); if (dataSrcRank == 0lu || indicesRank == 0lu) - THROW_ERROR("has incorrect input parameters ranks."); + THROW_CPU_NODE_ERR("has incorrect input parameters ranks."); if (ov::is_type(op)) { batchDims = static_cast(ov::as_type_ptr(op)->get_batch_dims()); @@ -104,7 +102,7 @@ Gather::Gather(const std::shared_ptr& op, const GraphContext::CPtr& co if (batchDims < 0) batchDims += indicesRank; if (batchDims < 0 || batchDims > std::min(static_cast(dataSrcRank), static_cast(indicesRank))) - THROW_ERROR("has incorrect batch_dims ", batchDims, "!"); + THROW_CPU_NODE_ERR("has incorrect batch_dims ", batchDims, "!"); if (ov::is_type(op->get_input_node_ptr(GATHER_AXIS))) { isAxisInputConst = true; @@ -112,7 +110,7 @@ Gather::Gather(const std::shared_ptr& op, const GraphContext::CPtr& co if (axis < 0) axis += dataSrcRank; if (axis < 0 || axis >= dataSrcRank || batchDims > axis) - THROW_ERROR("has incorrect input parameter axis value: ", axis); + THROW_CPU_NODE_ERR("has incorrect input parameter axis value: ", axis); } if (auto indices = ov::as_type(op->get_input_node_ptr(GATHER_INDICES))) { @@ -339,12 +337,12 @@ bool Gather::needPrepareParams() const { void Gather::prepareParams() { auto dataMemPtr = getSrcMemoryAtPort(GATHER_DATA); if (!dataMemPtr || !dataMemPtr->isDefined()) - THROW_ERROR(" has undefined input data memory."); + THROW_CPU_NODE_ERR("has undefined input data memory."); auto idxMemPtr = getSrcMemoryAtPort(GATHER_INDICES); if (!idxMemPtr || !idxMemPtr->isDefined()) - THROW_ERROR(" has undefined input indices memory."); + THROW_CPU_NODE_ERR("has undefined input indices memory."); if (getSelectedPrimitiveDescriptor() == nullptr) - THROW_ERROR(" has unidentified preferable primitive descriptor."); + THROW_CPU_NODE_ERR("has unidentified preferable primitive descriptor."); // short 1D vector fast execution impl (typical in shape infer subgraph) canOptimize1DCase = false; @@ -363,7 +361,7 @@ void Gather::prepareParams() { if (axis < 0) axis += dataSrcRank; if (axis < 0 || axis >= dataSrcRank || batchDims > axis) - THROW_ERROR("has incorrect input parameter axis value: ", axis); + THROW_CPU_NODE_ERR("has incorrect input parameter axis value: ", axis); } if (!isDataShapeStat || !isAxisInputConst) { @@ -553,7 +551,7 @@ void Gather::executeDynamicImpl(const dnnl::stream& strm) { void Gather::initShortParams(threadExecParams& p, const uint64_t start) { if (!jitKernel) - THROW_ERROR("has uninitialized kernel in function initShortParams."); + THROW_CPU_NODE_ERR("has uninitialized kernel in function initShortParams."); const uint64_t idxElPerVec = jitKernel->getIdxElPerVec(); if (afterAxisSize == 1) { // Elementwise gather. diff --git a/src/plugins/intel_cpu/src/nodes/gather_elements.cpp b/src/plugins/intel_cpu/src/nodes/gather_elements.cpp index 7a494d184ce9c1..29bc32370d03de 100644 --- a/src/plugins/intel_cpu/src/nodes/gather_elements.cpp +++ b/src/plugins/intel_cpu/src/nodes/gather_elements.cpp @@ -38,19 +38,19 @@ GatherElements::GatherElements(const std::shared_ptr& op, const GraphC OPENVINO_THROW_NOT_IMPLEMENTED(errorMessage); } if (inputShapes.size() != 2 || outputShapes.size() != 1) - THROW_CPU_NODE_ERR(" has invalid number of input/output edges."); + THROW_CPU_NODE_ERR("has invalid number of input/output edges."); const auto dataRank = getInputShapeAtPort(dataIndex_).getRank(); const auto indicesRank = getInputShapeAtPort(indicesIndex_).getRank(); if (dataRank != indicesRank) - THROW_CPU_NODE_ERR(" has invalid input shapes. Inputs 'Data' and 'Indices' must have equal ranks."); + THROW_CPU_NODE_ERR("has invalid input shapes. Inputs 'Data' and 'Indices' must have equal ranks."); auto gatherElementsOp = ov::as_type_ptr(op); auto axis = gatherElementsOp->get_axis(); if (axis < 0) axis += dataRank; if (axis < 0 || axis >= static_cast(dataRank)) - THROW_CPU_NODE_ERR(" has invalid axis attribute: ", axis); + THROW_CPU_NODE_ERR("has invalid axis attribute: ", axis); axis_ = axis; } @@ -78,12 +78,12 @@ void GatherElements::initSupportedPrimitiveDescriptors() { sizeof(element_type_traits::value_type), sizeof(element_type_traits::value_type), sizeof(element_type_traits::value_type))) { - THROW_CPU_NODE_ERR(" has unsupported 'inputData' input precision: ", inDataPrecision); + THROW_CPU_NODE_ERR("has unsupported 'inputData' input precision: ", inDataPrecision); } ov::element::Type indicesPrecision = getOriginalInputPrecisionAtPort(indicesIndex_); if (!one_of(indicesPrecision, ov::element::i32, ov::element::i64)) { - THROW_CPU_NODE_ERR(" has unsupported 'indices' input precision: ", indicesPrecision); + THROW_CPU_NODE_ERR("has unsupported 'indices' input precision: ", indicesPrecision); } dataTypeSize_ = inDataPrecision.size(); diff --git a/src/plugins/intel_cpu/src/nodes/gather_nd.cpp b/src/plugins/intel_cpu/src/nodes/gather_nd.cpp index 1124bec41632b8..8df99882adc9cf 100644 --- a/src/plugins/intel_cpu/src/nodes/gather_nd.cpp +++ b/src/plugins/intel_cpu/src/nodes/gather_nd.cpp @@ -14,8 +14,6 @@ #include "openvino/core/parallel.hpp" #include "utils/general_utils.h" -#define THROW_ERROR(...) OPENVINO_THROW("GatherND layer with name '", getName(), "' ", __VA_ARGS__) - namespace ov { namespace intel_cpu { namespace node { @@ -43,7 +41,7 @@ GatherND::GatherND(const std::shared_ptr& op, const GraphContext::CPtr } if (inputShapes.size() != 2 && outputShapes.size() != 1) - THROW_ERROR("has invalid number of input/output edges."); + THROW_CPU_NODE_ERR("has invalid number of input/output edges."); const size_t dataInputRank = getInputShapeAtPort(GATHERND_DATA).getRank(); const size_t indicesInputRank = getInputShapeAtPort(GATHERND_INDEXES).getRank(); @@ -53,10 +51,10 @@ GatherND::GatherND(const std::shared_ptr& op, const GraphContext::CPtr } else if (auto gatherNdOp = ov::as_type_ptr(op)) { attrs.batchDims = gatherNdOp->get_batch_dims(); } else { - THROW_ERROR("has support only opset5."); + THROW_CPU_NODE_ERR("has support only opset5."); } if (attrs.batchDims >= std::min(dataInputRank, indicesInputRank)) - THROW_ERROR("has invalid batch_dims attribute: ", attrs.batchDims); + THROW_CPU_NODE_ERR("has invalid batch_dims attribute: ", attrs.batchDims); } void GatherND::initSupportedPrimitiveDescriptors() { @@ -68,7 +66,7 @@ void GatherND::initSupportedPrimitiveDescriptors() { sizeof(element_type_traits::value_type), sizeof(element_type_traits::value_type), sizeof(element_type_traits::value_type))) { - THROW_ERROR("has unsupported 'data' input precision: ", inDataPrecision); + THROW_CPU_NODE_ERR("has unsupported 'data' input precision: ", inDataPrecision); } attrs.dataSize = inDataPrecision.size(); @@ -80,7 +78,7 @@ void GatherND::initSupportedPrimitiveDescriptors() { ov::element::u16, ov::element::i8, ov::element::u8)) { - THROW_ERROR("has unsupported 'indices' input precision: ", indicesPrecision); + THROW_CPU_NODE_ERR("has unsupported 'indices' input precision: ", indicesPrecision); } addSupportedPrimDesc({{LayoutType::ncsp, inDataPrecision}, {LayoutType::ncsp, ov::element::i32}}, @@ -93,13 +91,13 @@ void GatherND::prepareParams() { auto idxMemPtr = getSrcMemoryAtPort(GATHERND_INDEXES); auto dstMemPtr = getDstMemoryAtPort(0); if (!srcMemPtr || !srcMemPtr->isDefined()) - THROW_ERROR(" has undefined input memory of 'data'."); + THROW_CPU_NODE_ERR("has undefined input memory of 'data'."); if (!idxMemPtr || !idxMemPtr->isDefined()) - THROW_ERROR(" has undefined input memory of 'indices'."); + THROW_CPU_NODE_ERR("has undefined input memory of 'indices'."); if (!dstMemPtr || !dstMemPtr->isDefined()) - THROW_ERROR(" has undefined output memory."); + THROW_CPU_NODE_ERR("has undefined output memory."); if (getSelectedPrimitiveDescriptor() == nullptr) - THROW_ERROR(" has unidentified preferable primitive descriptor."); + THROW_CPU_NODE_ERR("has unidentified preferable primitive descriptor."); attrs.srcDims = srcMemPtr->getStaticDims(); attrs.srcStrides = srcMemPtr->getDescWithType()->getStrides(); @@ -141,7 +139,7 @@ GatherND::GatherNDExecutor::GatherNDExecutor(const GatherNDAttributes& attrs) void GatherND::execute(const dnnl::stream& strm) { if (!execPtr) - THROW_ERROR("has not compiled executor."); + THROW_CPU_NODE_ERR("has not compiled executor."); execPtr->exec(getSrcMemoryAtPort(GATHERND_DATA), getSrcMemoryAtPort(GATHERND_INDEXES), getDstMemoryAtPort(0)); } diff --git a/src/plugins/intel_cpu/src/nodes/grid_sample.cpp b/src/plugins/intel_cpu/src/nodes/grid_sample.cpp index 0e25c64acfe534..7a8eb1088453c7 100644 --- a/src/plugins/intel_cpu/src/nodes/grid_sample.cpp +++ b/src/plugins/intel_cpu/src/nodes/grid_sample.cpp @@ -14,8 +14,6 @@ using namespace ov::intel_cpu::node; using namespace dnnl::impl::cpu; #endif // OPENVINO_ARCH_X86_64 -#define THROW_ERROR(...) OPENVINO_THROW(getTypeStr(), " node with name '", getName(), "' ", __VA_ARGS__) - bool GridSample::isSupportedOperation(const std::shared_ptr& op, std::string& errorMessage) noexcept { try { if (!ov::is_type(op)) { diff --git a/src/plugins/intel_cpu/src/nodes/interaction.cpp b/src/plugins/intel_cpu/src/nodes/interaction.cpp index 13c846da6e2bea..d1ffcb3546754a 100644 --- a/src/plugins/intel_cpu/src/nodes/interaction.cpp +++ b/src/plugins/intel_cpu/src/nodes/interaction.cpp @@ -28,8 +28,6 @@ namespace ov { namespace intel_cpu { namespace node { -#define THROW_ERROR(...) OPENVINO_THROW(getTypeStr(), " node with name '", getName(), "' ", __VA_ARGS__) - #if defined(OPENVINO_ARCH_X86_64) template @@ -346,7 +344,7 @@ void Interaction::prepareParams() { moveFeatureKernel->create_ker(); moveInteractKernel->create_ker(); } else { - THROW_ERROR("cannot create jit eltwise kernel"); + THROW_CPU_NODE_ERR("cannot create jit eltwise kernel"); } #ifdef CPU_DEBUG_CAPS if (prim) { diff --git a/src/plugins/intel_cpu/src/nodes/kernels/aarch64/jit_uni_eltwise_generic.cpp b/src/plugins/intel_cpu/src/nodes/kernels/aarch64/jit_uni_eltwise_generic.cpp index 66db416ec7c732..5e69cfb36b5462 100644 --- a/src/plugins/intel_cpu/src/nodes/kernels/aarch64/jit_uni_eltwise_generic.cpp +++ b/src/plugins/intel_cpu/src/nodes/kernels/aarch64/jit_uni_eltwise_generic.cpp @@ -670,6 +670,7 @@ std::shared_ptr jit_uni_eltwise_generic::create_eltwise_emitte OV_CASE(Algorithm::EltwiseHswish, ov::intel_cpu::aarch64::jit_hswish_emitter), OV_CASE(Algorithm::EltwiseIsFinite, ov::intel_cpu::aarch64::jit_is_finite_emitter), OV_CASE(Algorithm::EltwiseIsInf, ov::intel_cpu::aarch64::jit_is_inf_emitter), + OV_CASE(Algorithm::EltwiseLess, ov::intel_cpu::aarch64::jit_less_emitter), OV_CASE(Algorithm::EltwiseLessEqual, ov::intel_cpu::aarch64::jit_less_equal_emitter), OV_CASE(Algorithm::EltwiseLogicalAnd, ov::intel_cpu::aarch64::jit_logical_and_emitter), OV_CASE(Algorithm::EltwiseLogicalOr, ov::intel_cpu::aarch64::jit_logical_or_emitter), @@ -863,6 +864,7 @@ std::set> eltwise_precision_helper::get_supported_pre OV_CASE(Algorithm::EltwiseIsFinite, jit_is_finite_emitter), OV_CASE(Algorithm::EltwiseIsInf, jit_is_inf_emitter), OV_CASE(Algorithm::EltwiseIsNaN, jit_is_nan_emitter), + OV_CASE(Algorithm::EltwiseLess, jit_less_emitter), OV_CASE(Algorithm::EltwiseLessEqual, jit_less_equal_emitter), OV_CASE(Algorithm::EltwiseLogicalAnd, jit_logical_and_emitter), OV_CASE(Algorithm::EltwiseLogicalOr, jit_logical_or_emitter), diff --git a/src/plugins/intel_cpu/src/nodes/mha.cpp b/src/plugins/intel_cpu/src/nodes/mha.cpp index e1f4a774011dc9..43867cd99b2b01 100644 --- a/src/plugins/intel_cpu/src/nodes/mha.cpp +++ b/src/plugins/intel_cpu/src/nodes/mha.cpp @@ -25,8 +25,6 @@ using namespace dnnl::impl::cpu::x64; using namespace dnnl::impl::cpu::x64::matmul; using namespace Xbyak; -#define THROW_ERROR(...) OPENVINO_THROW(getTypeStr(), " node with name '", getName(), "' ", __VA_ARGS__) - namespace ov { namespace intel_cpu { namespace node { @@ -879,7 +877,7 @@ void MHA::init_brgemm(brgemmCtx& ctx, std::unique_ptr& brgKerne ctx.K, &strides); if (status != dnnl_success) { - THROW_ERROR("cannot be executed due to invalid brgconv params"); + THROW_CPU_NODE_ERR("cannot be executed due to invalid brgconv params"); } ctx.is_with_amx = use_amx; @@ -893,11 +891,11 @@ void MHA::init_brgemm(brgemmCtx& ctx, std::unique_ptr& brgKerne brgemm_kernel_t* brgKernel_ = nullptr; status = brgemm_kernel_create(&brgKernel_, brgDesc); if (status != dnnl_success) { - THROW_ERROR("cannot be executed due to invalid brgconv params"); + THROW_CPU_NODE_ERR("cannot be executed due to invalid brgconv params"); } brgKernel.reset(brgKernel_); #else - THROW_ERROR("is not supported on non-x86_64"); + THROW_CPU_NODE_ERR("is not supported on non-x86_64"); #endif // OPENVINO_ARCH_X86_64 } @@ -972,7 +970,7 @@ void MHA::init_brgemm_copy_b(std::unique_ptr& brgCop #if defined(OPENVINO_ARCH_X86_64) auto ret = create_brgemm_matmul_copy_b(brgCopyKernel, &brgCopyKernelConf); if (ret != dnnl::impl::status_t::dnnl_success) - THROW_ERROR("cannot create_brgemm_matmul_copy_b kernel, dnnl_status: ", ret); + THROW_CPU_NODE_ERR("cannot create_brgemm_matmul_copy_b kernel, dnnl_status: ", ret); #endif // OPENVINO_ARCH_X86_64 } @@ -1204,7 +1202,7 @@ void MHA::prepareParams() { } #endif // OPENVINO_ARCH_X86_64 if (!mulAddSoftmaxKernel) { - THROW_ERROR("cannot create jit eltwise kernel"); + THROW_CPU_NODE_ERR("cannot create jit eltwise kernel"); } } @@ -1228,7 +1226,7 @@ void MHA::prepareParams() { } #endif // OPENVINO_ARCH_X86_64 if (!convertReorderKernel) { - THROW_ERROR("cannot create jit eltwise kernel"); + THROW_CPU_NODE_ERR("cannot create jit eltwise kernel"); } } @@ -1255,7 +1253,7 @@ void MHA::prepareParams() { #endif // OPENVINO_ARCH_X86_64 if (!convertTransposeKernel) { - THROW_ERROR("cannot create jit eltwise kernel"); + THROW_CPU_NODE_ERR("cannot create jit eltwise kernel"); } } @@ -1312,7 +1310,7 @@ void MHA::callBrgemm(brgemmCtx& ctx, brgemm_kernel_execute(brgKernel.get(), 1, pin0, pin1, nullptr, pout, wsp); } #else - THROW_ERROR("is not supported on non-x64 platforms"); + THROW_CPU_NODE_ERR("is not supported on non-x64 platforms"); #endif // OPENVINO_ARCH_X86_64 } @@ -1547,7 +1545,7 @@ void MHA::execute(const dnnl::stream& strm) { } else if (inputPrecisions[1] == ov::element::i8) { mhaImpl(); } else { - THROW_ERROR("doesn't support provided input precisions"); + THROW_CPU_NODE_ERR("doesn't support provided input precisions"); } } diff --git a/src/plugins/intel_cpu/src/nodes/normalize.cpp b/src/plugins/intel_cpu/src/nodes/normalize.cpp index e416781cdf69a2..13322254ab4ee1 100644 --- a/src/plugins/intel_cpu/src/nodes/normalize.cpp +++ b/src/plugins/intel_cpu/src/nodes/normalize.cpp @@ -35,7 +35,6 @@ using namespace Xbyak; #if defined(OPENVINO_ARCH_X86_64) # define GET_OFF(field) offsetof(jit_normalize_call_args, field) #endif -#define THROW_ERROR(...) OPENVINO_THROW("NormalizeL2 layer with name '", getName(), "' ", __VA_ARGS__) namespace ov { namespace intel_cpu { @@ -782,10 +781,10 @@ NormalizeL2::NormalizeL2(const std::shared_ptr& op, const GraphContext } if (inputShapes.size() != 2 || outputShapes.size() != 1) - THROW_ERROR(" has incorrect number of input/output edges"); + THROW_CPU_NODE_ERR("has incorrect number of input/output edges"); if (getInputShapeAtPort(DATA).getRank() > 4 || getInputShapeAtPort(DATA).getRank() < 2) { - THROW_ERROR("has invalid input shape. Normalize supports from 2D to 4D blobs."); + THROW_CPU_NODE_ERR("has invalid input shape. Normalize supports from 2D to 4D blobs."); } auto norm = ov::as_type_ptr(op); @@ -825,7 +824,7 @@ void NormalizeL2::initSupportedPrimitiveDescriptors() { ov::element::f16, ov::element::i8, ov::element::u8)) { - THROW_ERROR("has unsupported input precision: ", inputPrecision); + THROW_CPU_NODE_ERR("has unsupported input precision: ", inputPrecision); } if (!one_of(outputPrecision, ov::element::f32, @@ -833,7 +832,7 @@ void NormalizeL2::initSupportedPrimitiveDescriptors() { ov::element::f16, ov::element::i8, ov::element::u8)) { - THROW_ERROR("has unsupported output precision: ", outputPrecision); + THROW_CPU_NODE_ERR("has unsupported output precision: ", outputPrecision); } attrs.input_prec = inputPrecision; @@ -914,11 +913,11 @@ void NormalizeL2::createPrimitive() { auto dstMemPtr = getDstMemoryAtPort(DATA); auto srcMemPtr = getSrcMemoryAtPort(DATA); if (!dstMemPtr) - THROW_ERROR("can't get destination memory"); + THROW_CPU_NODE_ERR("can't get destination memory"); if (!srcMemPtr) - THROW_ERROR("can't get input memory"); + THROW_CPU_NODE_ERR("can't get input memory"); if (getSelectedPrimitiveDescriptor() == nullptr) - THROW_ERROR("has nullable preferable primitive descriptor"); + THROW_CPU_NODE_ERR("has nullable preferable primitive descriptor"); if (!attrs.cornerCase) { if (srcMemPtr->getDesc().hasLayoutType(LayoutType::ncsp)) { @@ -930,7 +929,7 @@ void NormalizeL2::createPrimitive() { } else if (srcMemPtr->getDesc().hasLayoutType(LayoutType::nspc)) { attrs.layout = LayoutType::nspc; } else { - THROW_ERROR("has selected layout which is not supported"); + THROW_CPU_NODE_ERR("has selected layout which is not supported"); } } @@ -972,7 +971,7 @@ void NormalizeL2::executeDynamicImpl(const dnnl::stream& strm) { void NormalizeL2::execute(const dnnl::stream& strm) { if (!execPtr) - THROW_ERROR("doesn't have a compiled executor."); + THROW_CPU_NODE_ERR("doesn't have a compiled executor."); const uint8_t* src_ptr = getSrcDataAtPortAs(DATA); uint8_t* dst_ptr = getDstDataAtPortAs(DATA); diff --git a/src/plugins/intel_cpu/src/nodes/priorbox.cpp b/src/plugins/intel_cpu/src/nodes/priorbox.cpp index d1a2acd05d1a7a..3bf6a47797e044 100644 --- a/src/plugins/intel_cpu/src/nodes/priorbox.cpp +++ b/src/plugins/intel_cpu/src/nodes/priorbox.cpp @@ -14,8 +14,6 @@ #include "openvino/opsets/opset1.hpp" #include "shape_inference/custom/priorbox.hpp" -#define THROW_ERROR(...) OPENVINO_THROW("PriorBox layer with name '", getName(), "': ", __VA_ARGS__) - namespace ov { namespace intel_cpu { namespace node { @@ -69,7 +67,7 @@ PriorBox::PriorBox(const std::shared_ptr& op, const GraphContext::CPtr exist = false; if (std::fabs(aspect_ratio_item) < std::numeric_limits::epsilon()) { - THROW_ERROR("Aspect_ratio param can't be equal to zero"); + THROW_CPU_NODE_ERR("has aspect_ratio param can't be equal to zero"); } for (float _aspect_ratio : aspect_ratio) { @@ -94,7 +92,7 @@ PriorBox::PriorBox(const std::shared_ptr& op, const GraphContext::CPtr if (attrs.variance.size() == 1 || attrs.variance.size() == 4) { for (float i : attrs.variance) { if (i < 0) { - THROW_ERROR("Variance must be > 0."); + THROW_CPU_NODE_ERR("variance must be > 0."); } variance.push_back(i); @@ -102,7 +100,7 @@ PriorBox::PriorBox(const std::shared_ptr& op, const GraphContext::CPtr } else if (attrs.variance.empty()) { variance.push_back(0.1f); } else { - THROW_ERROR("Wrong number of variance values. Not less than 1 and more than 4 variance values."); + THROW_CPU_NODE_ERR("has wrong number of variance values. Not less than 1 and more than 4 variance values."); } } diff --git a/src/plugins/intel_cpu/src/nodes/reference.cpp b/src/plugins/intel_cpu/src/nodes/reference.cpp index c7f1bbe30ff574..3283f7a43253ab 100644 --- a/src/plugins/intel_cpu/src/nodes/reference.cpp +++ b/src/plugins/intel_cpu/src/nodes/reference.cpp @@ -12,22 +12,10 @@ namespace ov { namespace intel_cpu { -class ReferenceShapeInferFactory : public ShapeInferFactory { -public: - ReferenceShapeInferFactory(std::shared_ptr op) : m_op{std::move(op)} {} - - ShapeInferPtr makeShapeInfer() const override { - return make_shape_inference(m_op, FULL_PORT_MASK); - } - -private: - std::shared_ptr m_op; -}; - namespace node { Reference::Reference(const std::shared_ptr& op, const GraphContext::CPtr& context, std::string errorMessage) - : Node(op, context, ReferenceShapeInferFactory(op)), + : Node(op, context, NgraphShapeInferFactory(op)), ovCoreNode(op), additionalErrorMessage(std::move(errorMessage)) { if (!op->has_evaluate()) { @@ -61,7 +49,9 @@ void Reference::initSupportedPrimitiveDescriptors() { addSupportedPrimDesc(inputConfigurators, outputConfigurators, impl_desc_type::ref); } -void Reference::createPrimitive() {} +void Reference::createPrimitive() { + hasOutputShapeDataDependency = isDynamicNode() && outputShapeDataDependency(); +} void Reference::execute(const dnnl::stream& strm) { auto inputs = prepareInputs(); @@ -72,6 +62,14 @@ void Reference::execute(const dnnl::stream& strm) { } void Reference::executeDynamicImpl(const dnnl::stream& strm) { + if (!hasOutputShapeDataDependency) { + // if there is no data dependency for the output shape, we can execute the operation as is, similar to the + // static case, since the shapes are already calculated + execute(strm); + return; + } + + // if there is data dependency, we need to perform shape inference first auto inputs = prepareInputs(); ov::TensorVector outputs; auto result = Node::shapeInfer(); @@ -125,7 +123,9 @@ bool Reference::created() const { } bool Reference::needShapeInfer() const { - return false; + // If there is data dependency for the output shape, let's assume the node has internal dynamism (in general case), + // so we postpone the shape inference until the actual execution + return !hasOutputShapeDataDependency && Node::needShapeInfer(); } ov::TensorVector Reference::prepareInputs() const { diff --git a/src/plugins/intel_cpu/src/nodes/reference.h b/src/plugins/intel_cpu/src/nodes/reference.h index 782c55716506a8..f0a37ae6529f5f 100644 --- a/src/plugins/intel_cpu/src/nodes/reference.h +++ b/src/plugins/intel_cpu/src/nodes/reference.h @@ -36,6 +36,7 @@ class Reference : public Node { private: const std::shared_ptr ovCoreNode; const std::string additionalErrorMessage; + bool hasOutputShapeDataDependency = false; // flag to cache the output shape data dependency check result }; } // namespace node diff --git a/src/plugins/intel_cpu/src/nodes/space_to_depth.cpp b/src/plugins/intel_cpu/src/nodes/space_to_depth.cpp index 859944161d48b9..0384dabc63d73c 100644 --- a/src/plugins/intel_cpu/src/nodes/space_to_depth.cpp +++ b/src/plugins/intel_cpu/src/nodes/space_to_depth.cpp @@ -15,8 +15,6 @@ #include "openvino/util/pp.hpp" #include "utils/general_utils.h" -#define THROW_ERROR(...) OPENVINO_THROW("SpaceToDepth layer with name '", getName(), "' ", __VA_ARGS__) - using namespace dnnl; using namespace dnnl::impl; @@ -76,11 +74,11 @@ SpaceToDepth::SpaceToDepth(const std::shared_ptr& op, const GraphConte OPENVINO_THROW_NOT_IMPLEMENTED(errorMessage); } if (inputShapes.size() != 1 || outputShapes.size() != 1) - THROW_ERROR("has incorrect number of input/output edges!"); + THROW_CPU_NODE_ERR("has incorrect number of input/output edges!"); auto spaceToDepth = ov::as_type_ptr(op); if (!spaceToDepth) - THROW_ERROR("supports only opset1"); + THROW_CPU_NODE_ERR("supports only opset1"); const auto modeNgraph = spaceToDepth->get_mode(); if (modeNgraph == ov::op::v0::SpaceToDepth::SpaceToDepthMode::BLOCKS_FIRST) { @@ -88,21 +86,21 @@ SpaceToDepth::SpaceToDepth(const std::shared_ptr& op, const GraphConte } else if (modeNgraph == ov::op::v0::SpaceToDepth::SpaceToDepthMode::DEPTH_FIRST) { attrs.mode = Mode::DEPTH_FIRST; } else { - THROW_ERROR("doesn't support mode: ", ov::as_string(modeNgraph)); + THROW_CPU_NODE_ERR("doesn't support mode: ", ov::as_string(modeNgraph)); } attrs.blockSize = spaceToDepth->get_block_size(); if (attrs.blockSize == 0) - THROW_ERROR("has incorrect block_size parameter is zero!"); + THROW_CPU_NODE_ERR("has incorrect block_size parameter is zero!"); const size_t srcRank = getInputShapeAtPort(0).getRank(); const size_t dstRank = getOutputShapeAtPort(0).getRank(); if (srcRank < 3) - THROW_ERROR("has incorrect number of input dimensions"); + THROW_CPU_NODE_ERR("has incorrect number of input dimensions"); if (srcRank > 5) - THROW_ERROR("doesn't support dimensions with rank greater than 5"); + THROW_CPU_NODE_ERR("doesn't support dimensions with rank greater than 5"); if (srcRank != dstRank) - THROW_ERROR("has incorrect number of input/output dimensions"); + THROW_CPU_NODE_ERR("has incorrect number of input/output dimensions"); attrs.nSpatialDims = srcRank - 2; attrs.blockStep = static_cast(std::pow(attrs.blockSize, attrs.nSpatialDims)); } @@ -164,11 +162,11 @@ void SpaceToDepth::createPrimitive() { auto dstMemPtr = getDstMemoryAtPort(0); auto srcMemPtr = getSrcMemoryAtPort(0); if (!dstMemPtr) - THROW_ERROR("has null destination memory"); + THROW_CPU_NODE_ERR("has null destination memory"); if (!srcMemPtr) - THROW_ERROR("has null input memory"); + THROW_CPU_NODE_ERR("has null input memory"); if (getSelectedPrimitiveDescriptor() == nullptr) - THROW_ERROR("has unidentified preferable primitive descriptor"); + THROW_CPU_NODE_ERR("has unidentified preferable primitive descriptor"); const auto& memoryDesc = srcMemPtr->getDesc(); attrs.dataSize = memoryDesc.getPrecision().size(); @@ -301,7 +299,7 @@ void SpaceToDepth::SpaceToDepthExecutor::exec(const uint8_t* srcData, uint8_t* d void SpaceToDepth::execute(const dnnl::stream& strm) { if (!execPtr) { - THROW_ERROR("doesn't have a compiled executor."); + THROW_CPU_NODE_ERR("doesn't have a compiled executor."); } const uint8_t* srcData = getSrcDataAtPortAs(0); uint8_t* dstData = getDstDataAtPortAs(0); diff --git a/src/plugins/intel_cpu/src/nodes/split.cpp b/src/plugins/intel_cpu/src/nodes/split.cpp index 59ab2776ba884b..af8295cbe98a9e 100644 --- a/src/plugins/intel_cpu/src/nodes/split.cpp +++ b/src/plugins/intel_cpu/src/nodes/split.cpp @@ -19,8 +19,6 @@ #include "utils/general_utils.h" #include "utils/ngraph_utils.hpp" -#define THROW_ERROR(...) OPENVINO_THROW("Split layer with name '", getName(), "' ", __VA_ARGS__) - using namespace dnnl; namespace ov { @@ -74,7 +72,7 @@ Split::Split(const std::shared_ptr& op, const GraphContext::CPtr& cont axis += inRank; } if (axis >= static_cast(inRank)) { - THROW_ERROR("Split node with name '", op->get_friendly_name(), "' has invalid value of axis parameter: ", axis); + THROW_CPU_NODE_ERR("has invalid value of axis parameter: ", axis); } this->axis = axis; } @@ -92,14 +90,14 @@ void Split::initSupportedPrimitiveDescriptors() { for (size_t i = 0; i < outputShapes.size(); i++) { const auto& o_Dims = outputShapes[i].getDims(); if (dstFirstDims.size() != o_Dims.size()) { - THROW_ERROR("only supports output blobs with equal number of dimensions"); + THROW_CPU_NODE_ERR("only supports output blobs with equal number of dimensions"); } for (size_t j = 0; j < dstFirstDims.size(); j++) { if (j == axis) continue; if (!dimsEqualWeak(o_Dims[j], dstFirstDims[j])) - THROW_ERROR("has incorrect output dimensions"); + THROW_CPU_NODE_ERR("has incorrect output dimensions"); } } @@ -256,7 +254,7 @@ void Split::createPrimitive() { void Split::prepareParams() { const auto& srcMemPtr = getSrcMemoryAtPort(0); if (!srcMemPtr || !srcMemPtr->isDefined()) { - THROW_ERROR("has undefined input memory"); + THROW_CPU_NODE_ERR("has undefined input memory"); } if (!constSplitLengths) { @@ -271,7 +269,7 @@ void Split::prepareParams() { for (size_t port = 0; port < outputShapes.size(); ++port) { const auto& outMemPtr = this->getDstMemoryAtPort(port); if (!outMemPtr || !outMemPtr->isDefined()) { - THROW_ERROR("has undefined destination memory"); + THROW_CPU_NODE_ERR("has undefined destination memory"); } if (outMemPtr->getShape().hasZeroDims()) { @@ -301,7 +299,7 @@ void Split::execute(const dnnl::stream& strm) { } if (dstMemPtrs.empty()) - THROW_ERROR("Output data pointers have not been initialized."); + THROW_CPU_NODE_ERR("Output data pointers have not been initialized."); const auto& srcMem = getParentEdgeAt(0)->getMemory(); @@ -323,7 +321,7 @@ void Split::initOptimalPrimitiveDescriptor() { Node::initOptimalPrimitiveDescriptor(); auto selected_pd = getSelectedPrimitiveDescriptor(); if (selected_pd == nullptr) - THROW_ERROR("Preferable primitive descriptor is not set."); + THROW_CPU_NODE_ERR("Preferable primitive descriptor is not set."); auto config = selected_pd->getConfig(); canUseOptimizedNspc2Ncsp = false; @@ -487,7 +485,7 @@ std::vector Split::getRawDstMemPtrs() const { for (size_t i = 0; i < dstMemPtrs.size(); ++i) { result[i] = dstMemPtrs[i].second->getDataAs(); if (!result[i]) { - THROW_ERROR("can't get child edge indx ", dstMemPtrs[i].first, " data."); + THROW_CPU_NODE_ERR("can't get child edge indx ", dstMemPtrs[i].first, " data."); } } return result; diff --git a/src/plugins/intel_cpu/src/nodes/tensoriterator.cpp b/src/plugins/intel_cpu/src/nodes/tensoriterator.cpp index fbd6361eca53fc..cffde3a81d23dd 100644 --- a/src/plugins/intel_cpu/src/nodes/tensoriterator.cpp +++ b/src/plugins/intel_cpu/src/nodes/tensoriterator.cpp @@ -25,8 +25,6 @@ namespace ov { namespace intel_cpu { namespace node { -#define THROW_ERROR(...) OPENVINO_THROW(getTypeStr(), " layer with name '", getName(), "' ", __VA_ARGS__) - static NodeConfig make_plain_config(const std::shared_ptr& op) { NodeConfig config; @@ -435,7 +433,7 @@ TensorIterator::TensorIterator(const std::shared_ptr& op, const GraphC void TensorIterator::getSupportedDescriptors() { auto tiOp = ov::as_type_ptr(ngraphOp); if (!tiOp) { - THROW_ERROR("cannot be cast to ov::op::util::SubGraphOp"); + THROW_CPU_NODE_ERR("cannot be cast to ov::op::util::SubGraphOp"); } const std::shared_ptr body = tiOp->get_function(); sub_graph.CreateGraph(body, context); @@ -519,7 +517,7 @@ void TensorIterator::getSupportedDescriptors() { -1, 1}); } else { - THROW_ERROR("has incorrect type of the input description."); + THROW_CPU_NODE_ERR("has incorrect type of the input description."); } } @@ -537,7 +535,7 @@ void TensorIterator::getSupportedDescriptors() { } else if (auto ti = ov::as_type_ptr(ngraphOp)) { algorithm = Algorithm::TensorIteratorCommon; } else { - THROW_ERROR("isn't supported!"); + THROW_CPU_NODE_ERR("isn't supported!"); } } @@ -894,11 +892,11 @@ int TensorIterator::getNumIteration(const std::vector& inputPortMap, const auto getNumIterations = [this](const PortMap& rule, const std::vector& dimensions) -> int { const auto axis = rule.axis; if (axis < 0 || static_cast(axis) >= dimensions.size()) { - THROW_ERROR(": Invalid \"axis\" value in an iteration component: ", - rule.axis, - ", dimensions number = ", - dimensions.size(), - " (out of range)"); + THROW_CPU_NODE_ERR(": Invalid \"axis\" value in an iteration component: ", + rule.axis, + ", dimensions number = ", + dimensions.size(), + " (out of range)"); } const auto space = dimensions[axis]; const int start = static_cast((rule.start < 0 ? (space + 1) : 0) + rule.start); @@ -906,7 +904,9 @@ int TensorIterator::getNumIteration(const std::vector& inputPortMap, const auto stride = rule.stride; if (stride == 0) { - THROW_ERROR(": Invalid \"stride\" value in an iteration component: ", rule.stride, " (infinite loop)"); + THROW_CPU_NODE_ERR(": Invalid \"stride\" value in an iteration component: ", + rule.stride, + " (infinite loop)"); } const auto step = std::abs(stride); @@ -914,21 +914,21 @@ int TensorIterator::getNumIteration(const std::vector& inputPortMap, const auto dst = stride < 0 ? start : end; const auto length = dst - src; if (src < 0 || src >= dst || dst > static_cast(space) || length < step) { - THROW_ERROR(": Invalid \"start\",\"stride\",\"end\" values in an iteration component", - ": \"start\" = ", - rule.start, - ", \"stride\" = ", - rule.stride, - ", \"end\" = ", - rule.end); + THROW_CPU_NODE_ERR(": Invalid \"start\",\"stride\",\"end\" values in an iteration component", + ": \"start\" = ", + rule.start, + ", \"stride\" = ", + rule.stride, + ", \"end\" = ", + rule.end); } if (length % step != 0) { - THROW_ERROR(": Each iteration must be the same size: length (", - length, - ") is not divisible by step (", - step, - ")"); + THROW_CPU_NODE_ERR(": Each iteration must be the same size: length (", + length, + ") is not divisible by step (", + step, + ")"); } return static_cast(length / step); @@ -943,11 +943,11 @@ int TensorIterator::getNumIteration(const std::vector& inputPortMap, } if (rule.from < 0 || rule.from >= static_cast(inputShapes.size())) { - THROW_ERROR(": Invalid \"from\" value: \"from\" = ", - rule.from, - " inputs number = ", - inputShapes.size(), - " (out of range)"); + THROW_CPU_NODE_ERR(": Invalid \"from\" value: \"from\" = ", + rule.from, + " inputs number = ", + inputShapes.size(), + " (out of range)"); } const auto currentNumIterations = getNumIterations(rule, dims); @@ -955,10 +955,10 @@ int TensorIterator::getNumIteration(const std::vector& inputPortMap, isDefault = false; numIterations = currentNumIterations; } else if (numIterations != currentNumIterations) { - THROW_ERROR(": There are at least two different iterations numbers: ", - numIterations, - " and ", - currentNumIterations); + THROW_CPU_NODE_ERR(": There are at least two different iterations numbers: ", + numIterations, + " and ", + currentNumIterations); } } @@ -972,11 +972,11 @@ int TensorIterator::getNumIteration(const std::vector& inputPortMap, continue; if (rule.from < 0 || rule.from >= static_cast(outputShapes.size())) { - THROW_ERROR(": Invalid \"from\" value: \"from\" = ", - rule.from, - " inputs number = ", - outputShapes.size(), - " (out of range)"); + THROW_CPU_NODE_ERR(": Invalid \"from\" value: \"from\" = ", + rule.from, + " inputs number = ", + outputShapes.size(), + " (out of range)"); } const auto currentNumIterations = getNumIterations(rule, dims); @@ -984,10 +984,10 @@ int TensorIterator::getNumIteration(const std::vector& inputPortMap, isDefault = false; numIterations = currentNumIterations; } else if (numIterations != currentNumIterations) { - THROW_ERROR(": There are at least two different iterations numbers: ", - numIterations, - " and ", - currentNumIterations); + THROW_CPU_NODE_ERR(": There are at least two different iterations numbers: ", + numIterations, + " and ", + currentNumIterations); } } diff --git a/src/plugins/intel_cpu/src/nodes/unique.cpp b/src/plugins/intel_cpu/src/nodes/unique.cpp index 391e1967a8c682..5a5888090ef6ee 100644 --- a/src/plugins/intel_cpu/src/nodes/unique.cpp +++ b/src/plugins/intel_cpu/src/nodes/unique.cpp @@ -14,8 +14,6 @@ using namespace ov::intel_cpu; using namespace ov::intel_cpu::node; -#define THROW_ERROR(...) OPENVINO_THROW(getTypeStr(), " node with name '", getName(), "' ", __VA_ARGS__) - bool Unique::isSupportedOperation(const std::shared_ptr& op, std::string& errorMessage) noexcept { try { if (!ov::is_type(op)) { @@ -41,7 +39,7 @@ Unique::Unique(const std::shared_ptr& op, const GraphContext::CPtr& co } if (!one_of(op->get_input_size(), 1u, 2u) || op->get_output_size() != 4) - THROW_ERROR("has incorrect number of input/output edges."); + THROW_CPU_NODE_ERR("has incorrect number of input/output edges."); for (int i = 0; i < 4; i++) { definedOutputs[i] = !op->get_output_target_inputs(i).empty(); @@ -55,8 +53,8 @@ Unique::Unique(const std::shared_ptr& op, const GraphContext::CPtr& co axis += op->get_input_partial_shape(IN_DATA).rank().get_length(); } if (axis < 0 || axis >= op->get_input_partial_shape(IN_DATA).rank().get_length()) { - THROW_ERROR("has invalid axis value: ", - ov::as_type(op->get_input_node_ptr(AXIS))->cast_vector()[0]); + THROW_CPU_NODE_ERR("has invalid axis value: ", + ov::as_type(op->get_input_node_ptr(AXIS))->cast_vector()[0]); } } else { flattened = true; @@ -93,18 +91,18 @@ void Unique::createPrimitive() { void Unique::prepareParams() { auto dataMemPtr = getSrcMemoryAtPort(IN_DATA); if (!dataMemPtr) { - THROW_ERROR(" has null input data memory."); + THROW_CPU_NODE_ERR("has null input data memory."); } for (int i = 0; i < 4; i++) { if (definedOutputs[i]) { auto dstMemPtr = getDstMemoryAtPort(i); if (!dstMemPtr) { - THROW_ERROR(" has null output memory at port ", i); + THROW_CPU_NODE_ERR("has null output memory at port ", i); } } } if (getSelectedPrimitiveDescriptor() == nullptr) { - THROW_ERROR(" has unidentified preferable primitive descriptor."); + THROW_CPU_NODE_ERR("has unidentified preferable primitive descriptor."); } size_t srcLen = 1; diff --git a/src/plugins/intel_cpu/src/shape_inference/shape_inference.cpp b/src/plugins/intel_cpu/src/shape_inference/shape_inference.cpp index 5ba7e7173792fd..ba7832aef71fab 100644 --- a/src/plugins/intel_cpu/src/shape_inference/shape_inference.cpp +++ b/src/plugins/intel_cpu/src/shape_inference/shape_inference.cpp @@ -234,8 +234,7 @@ class ShapeInferFallback : public ShapeInferBase { ov::optional> infer(const std::vector& input_shapes, const ov::ITensorAccessor& tensor_accessor) override { - auto op = m_node.get(); - std::vector output_shapes; + const auto op = m_node.get(); std::shared_ptr local_op; ov::OutputVector new_inputs; @@ -252,7 +251,7 @@ class ShapeInferFallback : public ShapeInferBase { local_op = op->clone_with_new_inputs(new_inputs); local_op->validate_and_infer_types(); - output_shapes.resize(local_op->get_output_size()); + std::vector output_shapes(local_op->get_output_size()); for (size_t i = 0; i < output_shapes.size(); ++i) { const auto& partial_shape = local_op->get_output_partial_shape(i); @@ -265,6 +264,11 @@ class ShapeInferFallback : public ShapeInferBase { return {std::move(output_shapes)}; } + + port_mask_t get_port_mask() const override { + // For fallback return full port mask to try get data for all node's inputs + return FULL_PORT_MASK; + } }; template @@ -610,34 +614,6 @@ const IStaticShapeInferFactory::TRegistry IStaticShapeInferFactory::registry{ #undef _OV_OP_SHAPE_INFER_MASK_REG #undef _OV_OP_SHAPE_INFER_VA_REG -class ShapeInferCustomMask : public IShapeInfer { -public: - ShapeInferCustomMask(ShapeInferPtr shape_infer, port_mask_t port_mask) - : m_shape_infer{std::move(shape_infer)}, - m_port_mask{port_mask} {} - - Result infer(const std::vector>& input_shapes, - const std::unordered_map& data_dependency) override { - return m_shape_infer->infer(input_shapes, data_dependency); - } - - const ov::CoordinateDiff& get_pads_begin() override { - return m_shape_infer->get_pads_begin(); - } - - const ov::CoordinateDiff& get_pads_end() override { - return m_shape_infer->get_pads_end(); - } - - port_mask_t get_port_mask() const override { - return m_port_mask; - } - -private: - const ShapeInferPtr m_shape_infer; - const port_mask_t m_port_mask; -}; - std::shared_ptr make_shape_inference(std::shared_ptr op) { if (auto shape_infer = IStaticShapeInferFactory::make(op->get_type_info(), op)) { return shape_infer; @@ -652,8 +628,5 @@ std::shared_ptr make_shape_inference(std::shared_ptr op, IShapeInfer::port_mask_t port_mask) { - return std::make_shared(make_shape_inference(std::move(op)), port_mask); -} } // namespace intel_cpu } // namespace ov diff --git a/src/plugins/intel_cpu/src/shape_inference/shape_inference.hpp b/src/plugins/intel_cpu/src/shape_inference/shape_inference.hpp index 21b36e76ddd9a7..cb937127b219f0 100644 --- a/src/plugins/intel_cpu/src/shape_inference/shape_inference.hpp +++ b/src/plugins/intel_cpu/src/shape_inference/shape_inference.hpp @@ -32,6 +32,5 @@ class IStaticShapeInfer : public IShapeInfer { }; std::shared_ptr make_shape_inference(std::shared_ptr op); -ShapeInferPtr make_shape_inference(std::shared_ptr op, IShapeInfer::port_mask_t port_mask); } // namespace intel_cpu } // namespace ov diff --git a/src/plugins/intel_cpu/src/transformations/cpu_opset/common/op/causal_mask_preprocess.cpp b/src/plugins/intel_cpu/src/transformations/cpu_opset/common/op/causal_mask_preprocess.cpp index a0ea60b9a20a63..9cc83310cd8059 100644 --- a/src/plugins/intel_cpu/src/transformations/cpu_opset/common/op/causal_mask_preprocess.cpp +++ b/src/plugins/intel_cpu/src/transformations/cpu_opset/common/op/causal_mask_preprocess.cpp @@ -1,4 +1,4 @@ -// Copyright (C) 2018-2023 Intel Corporation +// Copyright (C) 2018-2025 Intel Corporation // SPDX-License-Identifier: Apache-2.0 // #include "causal_mask_preprocess.hpp" diff --git a/src/plugins/intel_cpu/src/transformations/cpu_opset/common/op/causal_mask_preprocess.hpp b/src/plugins/intel_cpu/src/transformations/cpu_opset/common/op/causal_mask_preprocess.hpp index 7628aea386e4e7..19636d0529c681 100644 --- a/src/plugins/intel_cpu/src/transformations/cpu_opset/common/op/causal_mask_preprocess.hpp +++ b/src/plugins/intel_cpu/src/transformations/cpu_opset/common/op/causal_mask_preprocess.hpp @@ -1,4 +1,4 @@ -// Copyright (C) 2018-2023 Intel Corporation +// Copyright (C) 2018-2025 Intel Corporation // SPDX-License-Identifier: Apache-2.0 // diff --git a/src/plugins/intel_cpu/src/transformations/cpu_opset/common/pass/causal_mask_preprocess_fusion.cpp b/src/plugins/intel_cpu/src/transformations/cpu_opset/common/pass/causal_mask_preprocess_fusion.cpp index e2bcac397af164..7e562104f99d08 100644 --- a/src/plugins/intel_cpu/src/transformations/cpu_opset/common/pass/causal_mask_preprocess_fusion.cpp +++ b/src/plugins/intel_cpu/src/transformations/cpu_opset/common/pass/causal_mask_preprocess_fusion.cpp @@ -1,4 +1,4 @@ -// Copyright (C) 2018-2023 Intel Corporation +// Copyright (C) 2018-2025 Intel Corporation // SPDX-License-Identifier: Apache-2.0 // diff --git a/src/plugins/intel_cpu/src/transformations/cpu_opset/common/pass/causal_mask_preprocess_fusion.hpp b/src/plugins/intel_cpu/src/transformations/cpu_opset/common/pass/causal_mask_preprocess_fusion.hpp index 4a46a042722a12..16fcc4dd03c24e 100644 --- a/src/plugins/intel_cpu/src/transformations/cpu_opset/common/pass/causal_mask_preprocess_fusion.hpp +++ b/src/plugins/intel_cpu/src/transformations/cpu_opset/common/pass/causal_mask_preprocess_fusion.hpp @@ -1,4 +1,4 @@ -// Copyright (C) 2018-2023 Intel Corporation +// Copyright (C) 2018-2025 Intel Corporation // SPDX-License-Identifier: Apache-2.0 // diff --git a/src/plugins/intel_cpu/src/transformations/cpu_opset/common/pass/fc_bias_fusion.cpp b/src/plugins/intel_cpu/src/transformations/cpu_opset/common/pass/fc_bias_fusion.cpp index d92d2d3627b65b..4d913c4ced102c 100644 --- a/src/plugins/intel_cpu/src/transformations/cpu_opset/common/pass/fc_bias_fusion.cpp +++ b/src/plugins/intel_cpu/src/transformations/cpu_opset/common/pass/fc_bias_fusion.cpp @@ -1,4 +1,4 @@ -// Copyright (C) 2018-2023 Intel Corporation +// Copyright (C) 2018-2025 Intel Corporation // SPDX-License-Identifier: Apache-2.0 // diff --git a/src/plugins/intel_cpu/src/transformations/cpu_opset/common/pass/fc_bias_fusion.hpp b/src/plugins/intel_cpu/src/transformations/cpu_opset/common/pass/fc_bias_fusion.hpp index 5fadd183dfd694..b3ccb3f36d85cf 100644 --- a/src/plugins/intel_cpu/src/transformations/cpu_opset/common/pass/fc_bias_fusion.hpp +++ b/src/plugins/intel_cpu/src/transformations/cpu_opset/common/pass/fc_bias_fusion.hpp @@ -1,4 +1,4 @@ -// Copyright (C) 2018-2023 Intel Corporation +// Copyright (C) 2018-2025 Intel Corporation // SPDX-License-Identifier: Apache-2.0 // diff --git a/src/plugins/intel_cpu/src/transformations/snippets/x64/op/brgemm_copy_b.cpp b/src/plugins/intel_cpu/src/transformations/snippets/x64/op/brgemm_copy_b.cpp index df05ce5d539f46..7267e4355de1d6 100644 --- a/src/plugins/intel_cpu/src/transformations/snippets/x64/op/brgemm_copy_b.cpp +++ b/src/plugins/intel_cpu/src/transformations/snippets/x64/op/brgemm_copy_b.cpp @@ -1,4 +1,4 @@ -// Copyright (C) 2018-2022 Intel Corporation +// Copyright (C) 2018-2025 Intel Corporation // SPDX-License-Identifier: Apache-2.0 // diff --git a/src/plugins/intel_cpu/src/transformations/snippets/x64/op/brgemm_copy_b.hpp b/src/plugins/intel_cpu/src/transformations/snippets/x64/op/brgemm_copy_b.hpp index bf327784503352..e789c59e21dc4d 100644 --- a/src/plugins/intel_cpu/src/transformations/snippets/x64/op/brgemm_copy_b.hpp +++ b/src/plugins/intel_cpu/src/transformations/snippets/x64/op/brgemm_copy_b.hpp @@ -1,4 +1,4 @@ -// Copyright (C) 2018-2022 Intel Corporation +// Copyright (C) 2018-2025 Intel Corporation // SPDX-License-Identifier: Apache-2.0 // diff --git a/src/plugins/intel_cpu/src/transformations/snippets/x64/op/brgemm_cpu.hpp b/src/plugins/intel_cpu/src/transformations/snippets/x64/op/brgemm_cpu.hpp index ddc21e8ddb59d3..b70e8fe122aea7 100644 --- a/src/plugins/intel_cpu/src/transformations/snippets/x64/op/brgemm_cpu.hpp +++ b/src/plugins/intel_cpu/src/transformations/snippets/x64/op/brgemm_cpu.hpp @@ -1,4 +1,4 @@ -// Copyright (C) 2018-2022 Intel Corporation +// Copyright (C) 2018-2025 Intel Corporation // SPDX-License-Identifier: Apache-2.0 // diff --git a/src/plugins/intel_cpu/src/transformations/snippets/x64/pass/brgemm_to_brgemm_cpu.cpp b/src/plugins/intel_cpu/src/transformations/snippets/x64/pass/brgemm_to_brgemm_cpu.cpp index 48456b8220300a..e0a87ca288bac1 100644 --- a/src/plugins/intel_cpu/src/transformations/snippets/x64/pass/brgemm_to_brgemm_cpu.cpp +++ b/src/plugins/intel_cpu/src/transformations/snippets/x64/pass/brgemm_to_brgemm_cpu.cpp @@ -1,4 +1,4 @@ -// Copyright (C) 2018-2022 Intel Corporation +// Copyright (C) 2018-2025 Intel Corporation // SPDX-License-Identifier: Apache-2.0 // diff --git a/src/plugins/intel_cpu/src/transformations/snippets/x64/pass/brgemm_to_brgemm_cpu.hpp b/src/plugins/intel_cpu/src/transformations/snippets/x64/pass/brgemm_to_brgemm_cpu.hpp index 245f83c13c3466..177c6a466765e4 100644 --- a/src/plugins/intel_cpu/src/transformations/snippets/x64/pass/brgemm_to_brgemm_cpu.hpp +++ b/src/plugins/intel_cpu/src/transformations/snippets/x64/pass/brgemm_to_brgemm_cpu.hpp @@ -1,4 +1,4 @@ -// Copyright (C) 2018-2022 Intel Corporation +// Copyright (C) 2018-2025 Intel Corporation // SPDX-License-Identifier: Apache-2.0 // diff --git a/src/plugins/intel_cpu/src/transformations/tpp/x64/op/brgemm.cpp b/src/plugins/intel_cpu/src/transformations/tpp/x64/op/brgemm.cpp index d9f0bc947db958..ba10db13dbdc98 100644 --- a/src/plugins/intel_cpu/src/transformations/tpp/x64/op/brgemm.cpp +++ b/src/plugins/intel_cpu/src/transformations/tpp/x64/op/brgemm.cpp @@ -1,52 +1,62 @@ -// Copyright (C) 2018-2023 Intel Corporation +// Copyright (C) 2018-2025 Intel Corporation // SPDX-License-Identifier: Apache-2.0 // #include "brgemm.hpp" + #include "snippets/itt.hpp" -#include "snippets/utils/utils.hpp" #include "snippets/lowered/port_descriptor.hpp" +#include "snippets/utils/utils.hpp" #include "utils/general_utils.h" - namespace ov { namespace intel_cpu { namespace tpp { namespace op { -BrgemmTPP::BrgemmTPP(const Output& A, const Output& B, - const size_t offset_a, const size_t offset_b, const size_t offset_c, - std::vector layout_a, std::vector layout_b, std::vector layout_c, +BrgemmTPP::BrgemmTPP(const Output& A, + const Output& B, + const size_t offset_a, + const size_t offset_b, + const size_t offset_c, + std::vector layout_a, + std::vector layout_b, + std::vector layout_c, const float beta) : MemoryAccess(std::set{0, 1}, std::set{0}), modifier::TensorProcessingPrimitive(), - Brgemm(A, B, - offset_a, offset_b, offset_c, - std::move(layout_a), std::move(layout_b), std::move(layout_c)) { + Brgemm(A, B, offset_a, offset_b, offset_c, std::move(layout_a), std::move(layout_b), std::move(layout_c)) { set_beta(beta); } -BrgemmTPP::BrgemmTPP(const Output& A, const Output& B, - const PortDescriptor& desc_a, const PortDescriptor& desc_b, const PortDescriptor& desc_c, - std::vector layout_a, std::vector layout_b, std::vector layout_c, +BrgemmTPP::BrgemmTPP(const Output& A, + const Output& B, + const PortDescriptor& desc_a, + const PortDescriptor& desc_b, + const PortDescriptor& desc_c, + std::vector layout_a, + std::vector layout_b, + std::vector layout_c, const float beta) : MemoryAccess(PortMap{{0, desc_a}, {1, desc_b}}, PortMap{{0, desc_c}}), modifier::TensorProcessingPrimitive(), - Brgemm(A, B, - desc_a, desc_b, desc_c, - std::move(layout_a), std::move(layout_b), std::move(layout_c)) { + Brgemm(A, B, desc_a, desc_b, desc_c, std::move(layout_a), std::move(layout_b), std::move(layout_c)) { set_beta(beta); } std::shared_ptr BrgemmTPP::clone_with_new_inputs(const OutputVector& new_args) const { INTERNAL_OP_SCOPE(BrgemmTPP_clone_with_new_inputs); check_new_args_count(this, new_args); - return std::make_shared(new_args.at(0), new_args.at(1), - get_input_port_descriptor(0), get_input_port_descriptor(1), get_output_port_descriptor(0), - snippets::lowered::PortDescriptorUtils::get_port_descriptor_ptr(input(0))->get_layout(), - snippets::lowered::PortDescriptorUtils::get_port_descriptor_ptr(input(1))->get_layout(), - snippets::lowered::PortDescriptorUtils::get_port_descriptor_ptr(output(0))->get_layout(), - m_beta); + return std::make_shared( + new_args.at(0), + new_args.at(1), + get_input_port_descriptor(0), + get_input_port_descriptor(1), + get_output_port_descriptor(0), + snippets::lowered::PortDescriptorUtils::get_port_descriptor_ptr(input(0))->get_layout(), + snippets::lowered::PortDescriptorUtils::get_port_descriptor_ptr(input(1))->get_layout(), + snippets::lowered::PortDescriptorUtils::get_port_descriptor_ptr(output(0))->get_layout(), + m_beta); } bool BrgemmTPP::visit_attributes(AttributeVisitor& visitor) { @@ -55,7 +65,7 @@ bool BrgemmTPP::visit_attributes(AttributeVisitor& visitor) { return Brgemm::visit_attributes(visitor); } -} // namespace op -} // namespace tpp -} // namespace intel_cpu -} // namespace ov +} // namespace op +} // namespace tpp +} // namespace intel_cpu +} // namespace ov diff --git a/src/plugins/intel_cpu/src/transformations/tpp/x64/op/brgemm.hpp b/src/plugins/intel_cpu/src/transformations/tpp/x64/op/brgemm.hpp index c9199c3c7f82df..cda7f58afebea8 100644 --- a/src/plugins/intel_cpu/src/transformations/tpp/x64/op/brgemm.hpp +++ b/src/plugins/intel_cpu/src/transformations/tpp/x64/op/brgemm.hpp @@ -1,11 +1,11 @@ -// Copyright (C) 2018-2022 Intel Corporation +// Copyright (C) 2018-2025 Intel Corporation // SPDX-License-Identifier: Apache-2.0 // #pragma once -#include "transformations/snippets/x64/op/brgemm_cpu.hpp" #include "modifiers.hpp" +#include "transformations/snippets/x64/op/brgemm_cpu.hpp" namespace ov { namespace intel_cpu { @@ -22,13 +22,23 @@ class BrgemmTPP : virtual public modifier::TensorProcessingPrimitive, public sni public: OPENVINO_OP("Brgemm", "TppOpset", snippets::op::Brgemm); - BrgemmTPP(const Output& A, const Output& B, - size_t offset_a = 0, size_t offset_b = 0, size_t offset_c = 0, - std::vector layout_a = {}, std::vector layout_b = {}, std::vector layout_c = {}, + BrgemmTPP(const Output& A, + const Output& B, + size_t offset_a = 0, + size_t offset_b = 0, + size_t offset_c = 0, + std::vector layout_a = {}, + std::vector layout_b = {}, + std::vector layout_c = {}, float beta = 1); - BrgemmTPP(const Output& A, const Output& B, - const PortDescriptor& desc_a, const PortDescriptor& desc_b, const PortDescriptor& desc_c, - std::vector layout_a = {}, std::vector layout_b = {}, std::vector layout_c = {}, + BrgemmTPP(const Output& A, + const Output& B, + const PortDescriptor& desc_a, + const PortDescriptor& desc_b, + const PortDescriptor& desc_c, + std::vector layout_a = {}, + std::vector layout_b = {}, + std::vector layout_c = {}, float beta = 1); BrgemmTPP() = default; @@ -36,14 +46,18 @@ class BrgemmTPP : virtual public modifier::TensorProcessingPrimitive, public sni bool visit_attributes(AttributeVisitor& visitor) override; - float get_beta() const { return m_beta; } - void set_beta(float beta) { m_beta = beta; } + float get_beta() const { + return m_beta; + } + void set_beta(float beta) { + m_beta = beta; + } private: float m_beta = 0.f; }; -} // namespace op -} // namespace tpp -} // namespace intel_cpu -} // namespace ov +} // namespace op +} // namespace tpp +} // namespace intel_cpu +} // namespace ov diff --git a/src/plugins/intel_cpu/src/transformations/tpp/x64/op/descriptor.cpp b/src/plugins/intel_cpu/src/transformations/tpp/x64/op/descriptor.cpp index a5f297a491af8b..7cfbba2aeb5be3 100644 --- a/src/plugins/intel_cpu/src/transformations/tpp/x64/op/descriptor.cpp +++ b/src/plugins/intel_cpu/src/transformations/tpp/x64/op/descriptor.cpp @@ -11,63 +11,63 @@ namespace op { std::ostream& operator<<(std::ostream& os, const OpDescTPP& od) { switch (od.m_arity) { - case OpDescTPP::ARITY::ZERO: - os << "ARG#" << static_cast(od.m_value); + case OpDescTPP::ARITY::ZERO: + os << "ARG#" << static_cast(od.m_value); + break; + case OpDescTPP::ARITY::UNARY: + switch (static_cast(od.m_value)) { + case LIBXSMM_MELTW_TYPE_UNARY_EXP: + os << "EXP"; break; - case OpDescTPP::ARITY::UNARY: - switch (static_cast(od.m_value)) { - case LIBXSMM_MELTW_TYPE_UNARY_EXP: - os << "EXP"; - break; - case LIBXSMM_MELTW_TYPE_UNARY_X2: - os << "SQ"; - break; - case LIBXSMM_MELTW_TYPE_UNARY_SQRT: - os << "SQRT"; - break; - case LIBXSMM_MELTW_TYPE_UNARY_RELU: - os << "RELU"; - break; - case LIBXSMM_MELTW_TYPE_UNARY_RECIPROCAL: - os << "RECIPROCAL"; - break; - case LIBXSMM_MELTW_TYPE_UNARY_REDUCE_X_OP_ADD: - os << "REDUCE_ADD"; - break; - case LIBXSMM_MELTW_TYPE_UNARY_REDUCE_X_OP_MAX: - os << "REDUCE_MAX"; - break; - default: - OPENVINO_THROW("Unsupported TPP Unary op type for serialization"); - } + case LIBXSMM_MELTW_TYPE_UNARY_X2: + os << "SQ"; break; - case OpDescTPP::ARITY::BINARY: - switch (static_cast(od.m_value)) { - case LIBXSMM_MELTW_TYPE_BINARY_ADD: - os << "ADD"; - break; - case LIBXSMM_MELTW_TYPE_BINARY_SUB: - os << "SUB"; - break; - case LIBXSMM_MELTW_TYPE_BINARY_MUL: - os << "MUL"; - break; - case LIBXSMM_MELTW_TYPE_BINARY_DIV: - os << "DIV"; - break; - default: - OPENVINO_THROW("Unsupported TPP Binary op type for serialization"); - } + case LIBXSMM_MELTW_TYPE_UNARY_SQRT: + os << "SQRT"; break; - case OpDescTPP::ARITY::UNDEFINED: - os << "Undefined"; + case LIBXSMM_MELTW_TYPE_UNARY_RELU: + os << "RELU"; + break; + case LIBXSMM_MELTW_TYPE_UNARY_RECIPROCAL: + os << "RECIPROCAL"; + break; + case LIBXSMM_MELTW_TYPE_UNARY_REDUCE_X_OP_ADD: + os << "REDUCE_ADD"; + break; + case LIBXSMM_MELTW_TYPE_UNARY_REDUCE_X_OP_MAX: + os << "REDUCE_MAX"; + break; + default: + OPENVINO_THROW("Unsupported TPP Unary op type for serialization"); + } + break; + case OpDescTPP::ARITY::BINARY: + switch (static_cast(od.m_value)) { + case LIBXSMM_MELTW_TYPE_BINARY_ADD: + os << "ADD"; + break; + case LIBXSMM_MELTW_TYPE_BINARY_SUB: + os << "SUB"; + break; + case LIBXSMM_MELTW_TYPE_BINARY_MUL: + os << "MUL"; + break; + case LIBXSMM_MELTW_TYPE_BINARY_DIV: + os << "DIV"; break; default: - OPENVINO_THROW("Unhandled ARITY"); + OPENVINO_THROW("Unsupported TPP Binary op type for serialization"); + } + break; + case OpDescTPP::ARITY::UNDEFINED: + os << "Undefined"; + break; + default: + OPENVINO_THROW("Unhandled ARITY"); } return os; } -} // namespace op -} // namespace tpp -} // namespace intel_cpu -} // namespace ov +} // namespace op +} // namespace tpp +} // namespace intel_cpu +} // namespace ov diff --git a/src/plugins/intel_cpu/src/transformations/tpp/x64/op/descriptor.hpp b/src/plugins/intel_cpu/src/transformations/tpp/x64/op/descriptor.hpp index e6aac272a905b7..f205c5f58bde46 100644 --- a/src/plugins/intel_cpu/src/transformations/tpp/x64/op/descriptor.hpp +++ b/src/plugins/intel_cpu/src/transformations/tpp/x64/op/descriptor.hpp @@ -14,16 +14,20 @@ namespace op { class OpDescTPP { public: // Note: zero arity represent equation arguments - enum class ARITY {UNDEFINED, UNARY, BINARY, ZERO}; + enum class ARITY { UNDEFINED, UNARY, BINARY, ZERO }; OpDescTPP() = default; // Note: for zero arity op_type is interpreted as the argument index (op inputs and args have different order) OpDescTPP(ARITY arity, int arg_idx) : m_arity(arity), m_value{arg_idx}, m_flags{0} { OPENVINO_ASSERT(m_arity == ARITY::ZERO, "Only zero-arity op descs could be created directly"); } - explicit OpDescTPP(libxsmm_meltw_binary_type op_type, libxsmm_bitfield flags = LIBXSMM_MELTW_FLAG_BINARY_NONE) : - m_arity{ARITY::BINARY}, m_value{op_type}, m_flags{flags} {} - explicit OpDescTPP(libxsmm_meltw_unary_type op_type, libxsmm_bitfield flags = LIBXSMM_MELTW_FLAG_UNARY_NONE) : - m_arity{ARITY::UNARY}, m_value{op_type}, m_flags{flags} {} + explicit OpDescTPP(libxsmm_meltw_binary_type op_type, libxsmm_bitfield flags = LIBXSMM_MELTW_FLAG_BINARY_NONE) + : m_arity{ARITY::BINARY}, + m_value{op_type}, + m_flags{flags} {} + explicit OpDescTPP(libxsmm_meltw_unary_type op_type, libxsmm_bitfield flags = LIBXSMM_MELTW_FLAG_UNARY_NONE) + : m_arity{ARITY::UNARY}, + m_value{op_type}, + m_flags{flags} {} operator libxsmm_meltw_binary_type() const { OPENVINO_ASSERT(m_arity == ARITY::BINARY, "Unsupported TPP OpDesc conversion"); return static_cast(m_value); @@ -36,17 +40,21 @@ class OpDescTPP { OPENVINO_ASSERT(m_arity == ARITY::ZERO, "Unsupported TPP OpDesc conversion"); return m_value; } - ARITY get_arity() const { return m_arity; } - libxsmm_bitfield get_flags() const { return m_flags; } + ARITY get_arity() const { + return m_arity; + } + libxsmm_bitfield get_flags() const { + return m_flags; + } friend std::ostream& operator<<(std::ostream& os, const OpDescTPP& od); private: - const ARITY m_arity {ARITY::UNDEFINED}; - const int m_value {-1}; - const libxsmm_bitfield m_flags {0}; + const ARITY m_arity{ARITY::UNDEFINED}; + const int m_value{-1}; + const libxsmm_bitfield m_flags{0}; }; -} // namespace op -} // namespace tpp -} // namespace intel_cpu -} // namespace ov +} // namespace op +} // namespace tpp +} // namespace intel_cpu +} // namespace ov diff --git a/src/plugins/intel_cpu/src/transformations/tpp/x64/op/eltwise.cpp b/src/plugins/intel_cpu/src/transformations/tpp/x64/op/eltwise.cpp index 1df57fdd5a8f4f..b9491d556c8292 100644 --- a/src/plugins/intel_cpu/src/transformations/tpp/x64/op/eltwise.cpp +++ b/src/plugins/intel_cpu/src/transformations/tpp/x64/op/eltwise.cpp @@ -1,4 +1,4 @@ -// Copyright (C) 2018-2023 Intel Corporation +// Copyright (C) 2018-2025 Intel Corporation // SPDX-License-Identifier: Apache-2.0 // @@ -9,31 +9,28 @@ namespace intel_cpu { namespace tpp { namespace op { -#define GENERAL_AUX_METHODS(OP, OP_TYPE, ...) \ - std::shared_ptr OP::clone_with_new_inputs(const OutputVector& new_args) const {\ - check_new_args_count(this, new_args);\ - const auto& new_op = std::make_shared(__VA_ARGS__);\ - new_op->clone_memory_access_ports(*this);\ - return new_op;\ -} \ - bool OP::visit_attributes(AttributeVisitor& visitor) {\ - return OP_TYPE::visit_attributes(visitor);\ -}\ +#define GENERAL_AUX_METHODS(OP, OP_TYPE, ...) \ + std::shared_ptr OP::clone_with_new_inputs(const OutputVector& new_args) const { \ + check_new_args_count(this, new_args); \ + const auto& new_op = std::make_shared(__VA_ARGS__); \ + new_op->clone_memory_access_ports(*this); \ + return new_op; \ + } \ + bool OP::visit_attributes(AttributeVisitor& visitor) { return OP_TYPE::visit_attributes(visitor); } // Note: Unary Ops don't require broadcasting flags update => no need to override validate_and_infer_types -#define BINARY_AUX_METHODS(BINARY_OP, OV_OP) GENERAL_AUX_METHODS(BINARY_OP, BinaryEltwiseTPP, new_args.at(0), new_args.at(1), this->get_autob())\ -void BINARY_OP::validate_and_infer_types() {\ - OV_OP::validate_and_infer_types();\ - m_flags = get_broadcasting_flags(get_input_partial_shape(0), get_input_partial_shape(1));\ -} +#define BINARY_AUX_METHODS(BINARY_OP, OV_OP) \ + GENERAL_AUX_METHODS(BINARY_OP, BinaryEltwiseTPP, new_args.at(0), new_args.at(1), this->get_autob()) \ + void BINARY_OP::validate_and_infer_types() { \ + OV_OP::validate_and_infer_types(); \ + m_flags = get_broadcasting_flags(get_input_partial_shape(0), get_input_partial_shape(1)); \ + } #define UNARY_AUX_METHODS(UNARY_OP) GENERAL_AUX_METHODS(UNARY_OP, UnaryEltwiseTPP, new_args.at(0)) bool EltwiseTPP::is_supported(const std::shared_ptr& node) { - return ov::is_type(node) || - ov::is_type(node) || - ov::is_type(node) || - ov::is_type(node); + return ov::is_type(node) || ov::is_type(node) || + ov::is_type(node) || ov::is_type(node); } bool EltwiseTPP::visit_attributes(AttributeVisitor& visitor) { @@ -46,13 +43,14 @@ BinaryEltwiseTPP::BinaryEltwiseTPP(libxsmm_meltw_binary_type op_type) : EltwiseT ctor_initialize(std::set{0, 1}, std::set{0}); } - - -libxsmm_bitfield BinaryEltwiseTPP::get_broadcasting_flags(const ov::PartialShape& pshape_0, const ov::PartialShape& pshape_1) { - return get_broadcasting_flags(snippets::utils::pshape_to_vdims(pshape_0), snippets::utils::pshape_to_vdims(pshape_1)); +libxsmm_bitfield BinaryEltwiseTPP::get_broadcasting_flags(const ov::PartialShape& pshape_0, + const ov::PartialShape& pshape_1) { + return get_broadcasting_flags(snippets::utils::pshape_to_vdims(pshape_0), + snippets::utils::pshape_to_vdims(pshape_1)); } -libxsmm_bitfield BinaryEltwiseTPP::get_broadcasting_flags(const snippets::VectorDims& shape_0, const snippets::VectorDims& shape_1) { +libxsmm_bitfield BinaryEltwiseTPP::get_broadcasting_flags(const snippets::VectorDims& shape_0, + const snippets::VectorDims& shape_1) { auto get_subshape = [](const snippets::VectorDims& shape) { snippets::VectorDims subshape(2, 1); for (size_t i = 0; i < std::min(subshape.size(), shape.size()); i++) { @@ -63,8 +61,7 @@ libxsmm_bitfield BinaryEltwiseTPP::get_broadcasting_flags(const snippets::Vector snippets::VectorDims subshape_0 = get_subshape(shape_0); snippets::VectorDims subshape_1 = get_subshape(shape_1); - if (snippets::utils::is_dynamic_vdims(subshape_0) || - snippets::utils::is_dynamic_vdims(subshape_1)) + if (snippets::utils::is_dynamic_vdims(subshape_0) || snippets::utils::is_dynamic_vdims(subshape_1)) return LIBXSMM_MELTW_FLAG_BINARY_NONE; if (subshape_0 == subshape_1) { return LIBXSMM_MELTW_FLAG_BINARY_NONE; @@ -99,62 +96,64 @@ UnaryEltwiseTPP::UnaryEltwiseTPP(libxsmm_meltw_unary_type op_type) : EltwiseTPP( } Add::Add(const Output& arg0, const Output& arg1, const AutoBroadcastSpec& auto_broadcast) -: BinaryEltwiseTPP(LIBXSMM_MELTW_TYPE_BINARY_ADD), ov::op::v1::Add(arg0, arg1, auto_broadcast) { + : BinaryEltwiseTPP(LIBXSMM_MELTW_TYPE_BINARY_ADD), + ov::op::v1::Add(arg0, arg1, auto_broadcast) { m_flags = get_broadcasting_flags(arg0.get_partial_shape(), arg1.get_partial_shape()); } BINARY_AUX_METHODS(Add, ov::op::v1::Add) Subtract::Subtract(const Output& arg0, const Output& arg1, const AutoBroadcastSpec& auto_broadcast) - : BinaryEltwiseTPP(LIBXSMM_MELTW_TYPE_BINARY_SUB), ov::op::v1::Subtract(arg0, arg1, auto_broadcast) { + : BinaryEltwiseTPP(LIBXSMM_MELTW_TYPE_BINARY_SUB), + ov::op::v1::Subtract(arg0, arg1, auto_broadcast) { m_flags = get_broadcasting_flags(arg0.get_partial_shape(), arg1.get_partial_shape()); } BINARY_AUX_METHODS(Subtract, ov::op::v1::Subtract) Multiply::Multiply(const Output& arg0, const Output& arg1, const AutoBroadcastSpec& auto_broadcast) - : BinaryEltwiseTPP(LIBXSMM_MELTW_TYPE_BINARY_MUL), ov::op::v1::Multiply(arg0, arg1, auto_broadcast) { + : BinaryEltwiseTPP(LIBXSMM_MELTW_TYPE_BINARY_MUL), + ov::op::v1::Multiply(arg0, arg1, auto_broadcast) { m_flags = get_broadcasting_flags(arg0.get_partial_shape(), arg1.get_partial_shape()); } BINARY_AUX_METHODS(Multiply, ov::op::v1::Multiply) Divide::Divide(const Output& arg0, const Output& arg1, const AutoBroadcastSpec& auto_broadcast) - : BinaryEltwiseTPP(LIBXSMM_MELTW_TYPE_BINARY_DIV), ov::op::v1::Divide(arg0, arg1, auto_broadcast) { + : BinaryEltwiseTPP(LIBXSMM_MELTW_TYPE_BINARY_DIV), + ov::op::v1::Divide(arg0, arg1, auto_broadcast) { m_flags = get_broadcasting_flags(arg0.get_partial_shape(), arg1.get_partial_shape()); } BINARY_AUX_METHODS(Divide, ov::op::v1::Divide) -Exp::Exp(const Output& arg0) : UnaryEltwiseTPP(LIBXSMM_MELTW_TYPE_UNARY_EXP), ov::op::v0::Exp(arg0) { -} +Exp::Exp(const Output& arg0) : UnaryEltwiseTPP(LIBXSMM_MELTW_TYPE_UNARY_EXP), ov::op::v0::Exp(arg0) {} UNARY_AUX_METHODS(Exp) -Relu::Relu(const Output& arg0) : UnaryEltwiseTPP(LIBXSMM_MELTW_TYPE_UNARY_RELU), ov::op::v0::Relu(arg0) { -} +Relu::Relu(const Output& arg0) : UnaryEltwiseTPP(LIBXSMM_MELTW_TYPE_UNARY_RELU), ov::op::v0::Relu(arg0) {} UNARY_AUX_METHODS(Relu) -Reciprocal::Reciprocal(const Output& arg) : - UnaryEltwiseTPP(LIBXSMM_MELTW_TYPE_UNARY_RECIPROCAL), ov::snippets::op::PowerStatic(arg, -1.f) { -} +Reciprocal::Reciprocal(const Output& arg) + : UnaryEltwiseTPP(LIBXSMM_MELTW_TYPE_UNARY_RECIPROCAL), + ov::snippets::op::PowerStatic(arg, -1.f) {} UNARY_AUX_METHODS(Reciprocal) -Square::Square(const Output& arg) : - UnaryEltwiseTPP(LIBXSMM_MELTW_TYPE_UNARY_X2), ov::snippets::op::PowerStatic(arg, 2.f) { -} +Square::Square(const Output& arg) + : UnaryEltwiseTPP(LIBXSMM_MELTW_TYPE_UNARY_X2), + ov::snippets::op::PowerStatic(arg, 2.f) {} UNARY_AUX_METHODS(Square) -SquareRoot::SquareRoot(const Output& arg) : - UnaryEltwiseTPP(LIBXSMM_MELTW_TYPE_UNARY_SQRT), ov::snippets::op::PowerStatic(arg, 0.5f) { -} +SquareRoot::SquareRoot(const Output& arg) + : UnaryEltwiseTPP(LIBXSMM_MELTW_TYPE_UNARY_SQRT), + ov::snippets::op::PowerStatic(arg, 0.5f) {} UNARY_AUX_METHODS(SquareRoot) -} // namespace op -} // namespace tpp -} // namespace intel_cpu -} // namespace ov +} // namespace op +} // namespace tpp +} // namespace intel_cpu +} // namespace ov diff --git a/src/plugins/intel_cpu/src/transformations/tpp/x64/op/eltwise.hpp b/src/plugins/intel_cpu/src/transformations/tpp/x64/op/eltwise.hpp index a61668c2a04328..7338450ff8257d 100644 --- a/src/plugins/intel_cpu/src/transformations/tpp/x64/op/eltwise.hpp +++ b/src/plugins/intel_cpu/src/transformations/tpp/x64/op/eltwise.hpp @@ -4,18 +4,17 @@ #pragma once +#include "descriptor.hpp" #include "modifiers.hpp" #include "openvino/op/add.hpp" -#include "openvino/op/subtract.hpp" -#include "openvino/op/multiply.hpp" #include "openvino/op/divide.hpp" #include "openvino/op/exp.hpp" +#include "openvino/op/multiply.hpp" #include "openvino/op/relu.hpp" +#include "openvino/op/subtract.hpp" #include "snippets/op/powerstatic.hpp" #include "snippets/utils/utils.hpp" -#include "descriptor.hpp" - namespace ov { namespace intel_cpu { namespace tpp { @@ -27,17 +26,20 @@ class EltwiseTPP : public modifier::TensorProcessingPrimitive { public: static bool is_supported(const std::shared_ptr& node); bool visit_attributes(AttributeVisitor& visitor); - virtual OpDescTPP get_op_desc() const = 0; + virtual OpDescTPP get_op_desc() const = 0; }; class BinaryEltwiseTPP : public EltwiseTPP { public: BinaryEltwiseTPP(libxsmm_meltw_binary_type op_type); - OpDescTPP get_op_desc() const override { return OpDescTPP(m_op_type, m_flags); } + OpDescTPP get_op_desc() const override { + return OpDescTPP(m_op_type, m_flags); + } protected: static libxsmm_bitfield get_broadcasting_flags(const ov::PartialShape& pshape_0, const ov::PartialShape& pshape_1); - static libxsmm_bitfield get_broadcasting_flags(const snippets::VectorDims& pshape_0, const snippets::VectorDims& pshape_1); + static libxsmm_bitfield get_broadcasting_flags(const snippets::VectorDims& pshape_0, + const snippets::VectorDims& pshape_1); libxsmm_bitfield m_flags; libxsmm_meltw_binary_type m_op_type; }; @@ -45,7 +47,10 @@ class BinaryEltwiseTPP : public EltwiseTPP { class UnaryEltwiseTPP : public EltwiseTPP { public: UnaryEltwiseTPP(libxsmm_meltw_unary_type op_type); - OpDescTPP get_op_desc() const override { return OpDescTPP(m_op_type); } + OpDescTPP get_op_desc() const override { + return OpDescTPP(m_op_type); + } + private: libxsmm_meltw_unary_type m_op_type; }; @@ -110,7 +115,6 @@ class Reciprocal : public UnaryEltwiseTPP, public ov::snippets::op::PowerStatic bool visit_attributes(AttributeVisitor& visitor) override; }; - class Square : public UnaryEltwiseTPP, public ov::snippets::op::PowerStatic { public: OPENVINO_OP("Square", "TppOpset", snippets::op::PowerStatic); @@ -127,7 +131,7 @@ class SquareRoot : public UnaryEltwiseTPP, public ov::snippets::op::PowerStatic bool visit_attributes(AttributeVisitor& visitor) override; }; -} // namespace op -} // namespace tpp -} // namespace intel_cpu -} // namespace ov +} // namespace op +} // namespace tpp +} // namespace intel_cpu +} // namespace ov diff --git a/src/plugins/intel_cpu/src/transformations/tpp/x64/op/equation.cpp b/src/plugins/intel_cpu/src/transformations/tpp/x64/op/equation.cpp index 8a22aa400cc16c..04306ca8f8b6c5 100644 --- a/src/plugins/intel_cpu/src/transformations/tpp/x64/op/equation.cpp +++ b/src/plugins/intel_cpu/src/transformations/tpp/x64/op/equation.cpp @@ -9,9 +9,10 @@ namespace intel_cpu { namespace tpp { namespace op { -EquationTPP::EquationTPP(const OutputVector& arguments, std::vector op_descs) : - modifier::TensorProcessingPrimitive(), ov::op::Op(arguments), - m_op_descs(std::move(op_descs)) { +EquationTPP::EquationTPP(const OutputVector& arguments, std::vector op_descs) + : modifier::TensorProcessingPrimitive(), + ov::op::Op(arguments), + m_op_descs(std::move(op_descs)) { // Initialize input/output ports as memory access ports std::set ma_iport_idx; for (size_t i = 0; i < get_input_size(); i++) @@ -43,13 +44,14 @@ void EquationTPP::validate_and_infer_types() { for (size_t i = 1; i < get_input_size(); i++) { OPENVINO_ASSERT(element::Type::merge(etype, etype, get_input_element_type(i)), "Incompatible element types in TPP equation"); - OPENVINO_ASSERT(ov::PartialShape::broadcast_merge_into(shape, get_input_partial_shape(i), ov::op::AutoBroadcastType::NUMPY), - "Incompatible element types in TPP equation"); + OPENVINO_ASSERT( + ov::PartialShape::broadcast_merge_into(shape, get_input_partial_shape(i), ov::op::AutoBroadcastType::NUMPY), + "Incompatible element types in TPP equation"); } set_output_type(0, etype, shape); } -} // namespace op -} // namespace tpp -} // namespace intel_cpu -} // namespace ov +} // namespace op +} // namespace tpp +} // namespace intel_cpu +} // namespace ov diff --git a/src/plugins/intel_cpu/src/transformations/tpp/x64/op/equation.hpp b/src/plugins/intel_cpu/src/transformations/tpp/x64/op/equation.hpp index 4ba53393336ad4..bf16f149b415de 100644 --- a/src/plugins/intel_cpu/src/transformations/tpp/x64/op/equation.hpp +++ b/src/plugins/intel_cpu/src/transformations/tpp/x64/op/equation.hpp @@ -4,9 +4,9 @@ #pragma once +#include "descriptor.hpp" #include "modifiers.hpp" #include "openvino/op/op.hpp" -#include "descriptor.hpp" namespace ov { namespace intel_cpu { @@ -20,13 +20,15 @@ class EquationTPP : public modifier::TensorProcessingPrimitive, public ov::op::O std::shared_ptr clone_with_new_inputs(const OutputVector& new_args) const override; void validate_and_infer_types() override; bool visit_attributes(AttributeVisitor& visitor) override; - const std::vector& get_op_descs() { return m_op_descs; } + const std::vector& get_op_descs() { + return m_op_descs; + } private: std::vector m_op_descs; }; -} // namespace op -} // namespace tpp -} // namespace intel_cpu -} // namespace ov +} // namespace op +} // namespace tpp +} // namespace intel_cpu +} // namespace ov diff --git a/src/plugins/intel_cpu/src/transformations/tpp/x64/op/factory.cpp b/src/plugins/intel_cpu/src/transformations/tpp/x64/op/factory.cpp index 3fdcd30e7c4eb6..173c12173d7835 100644 --- a/src/plugins/intel_cpu/src/transformations/tpp/x64/op/factory.cpp +++ b/src/plugins/intel_cpu/src/transformations/tpp/x64/op/factory.cpp @@ -1,12 +1,13 @@ -// Copyright (C) 2018-2023 Intel Corporation +// Copyright (C) 2018-2025 Intel Corporation // SPDX-License-Identifier: Apache-2.0 // #include "factory.hpp" + #include "eltwise.hpp" -#include "reduce.hpp" #include "openvino/pass/pattern/op/wrap_type.hpp" #include "ov_ops/type_relaxed.hpp" +#include "reduce.hpp" namespace ov { namespace intel_cpu { @@ -38,37 +39,39 @@ struct CustomPowerStaticBuilder : public NodeFactory::TPPCustomBuilder { } }; -} // namespace -#define CREATE_UNARY_TPP_NODE(tpp_node_type) \ - [](const std::shared_ptr& node) -> std::shared_ptr { \ +} // namespace +#define CREATE_UNARY_TPP_NODE(tpp_node_type) \ + [](const std::shared_ptr& node) -> std::shared_ptr { \ return std::make_shared(node->get_input_source_output(0)); \ } -#define CREATE_BINARY_TPP_NODE(tpp_node_type) \ - [](const std::shared_ptr& node) -> std::shared_ptr { \ - return std::make_shared(node->get_input_source_output(0), node->get_input_source_output(1), node->get_autob()); \ +#define CREATE_BINARY_TPP_NODE(tpp_node_type) \ + [](const std::shared_ptr& node) -> std::shared_ptr { \ + return std::make_shared(node->get_input_source_output(0), \ + node->get_input_source_output(1), \ + node->get_autob()); \ } -#define CREATE_REDUCE_TPP_NODE(tpp_node_type) \ - [](const std::shared_ptr& node) -> std::shared_ptr { \ - const auto& reduce = ov::as_type_ptr(node); \ - OPENVINO_ASSERT(reduce, "Attempt to create TPP Reduce from invalid node"); \ +#define CREATE_REDUCE_TPP_NODE(tpp_node_type) \ + [](const std::shared_ptr& node) -> std::shared_ptr { \ + const auto& reduce = ov::as_type_ptr(node); \ + OPENVINO_ASSERT(reduce, "Attempt to create TPP Reduce from invalid node"); \ return std::make_shared(reduce->get_input_source_output(0), reduce->get_axis()); \ } -std::unordered_map NodeFactory::m_direct_mapping { +std::unordered_map NodeFactory::m_direct_mapping{ {ov::op::v1::Add::get_type_info_static(), CREATE_BINARY_TPP_NODE(Add)}, {ov::op::v1::Subtract::get_type_info_static(), CREATE_BINARY_TPP_NODE(Subtract)}, {ov::op::v1::Multiply::get_type_info_static(), CREATE_BINARY_TPP_NODE(Multiply)}, {ov::op::v1::Divide::get_type_info_static(), CREATE_BINARY_TPP_NODE(Divide)}, {ov::op::v0::Exp::get_type_info_static(), CREATE_UNARY_TPP_NODE(Exp)}, {ov::op::v0::Relu::get_type_info_static(), CREATE_UNARY_TPP_NODE(Relu)}, - // Note that we don't support conversion from ngraph ops here, since they have a broader semantics (e.g. multiple axis provided at a secont input) + // Note that we don't support conversion from ngraph ops here, since they have a broader semantics (e.g. multiple + // axis provided at a secont input) {ov::snippets::op::ReduceMax::get_type_info_static(), CREATE_REDUCE_TPP_NODE(ReduceMax)}, {ov::snippets::op::ReduceSum::get_type_info_static(), CREATE_REDUCE_TPP_NODE(ReduceSum)}, }; - std::vector NodeFactory::m_custom_mapping{CustomPowerStaticBuilder()}; std::shared_ptr NodeFactory::create(const std::shared_ptr& n) { @@ -95,13 +98,16 @@ bool NodeFactory::is_supported(const std::shared_ptr& n) { // Note: verify that TypeRelaxed property is maintained (mismatched input precisions) // after low precisions are enabled (ticket: 132328) const auto& ins = n->inputs(); - auto is_fp32_input = [](const ov::Input& in){ return in.get_element_type() == element::f32; }; + auto is_fp32_input = [](const ov::Input& in) { + return in.get_element_type() == element::f32; + }; const bool all_inputs_fp32 = std::all_of(ins.begin(), ins.end(), is_fp32_input); return (m_direct_mapping.count(n->get_type_info()) || - std::any_of(m_custom_mapping.begin(), m_custom_mapping.end(), matches)) && all_inputs_fp32; + std::any_of(m_custom_mapping.begin(), m_custom_mapping.end(), matches)) && + all_inputs_fp32; } -} // namespace op -} // namespace tpp -} // namespace intel_cpu -} // namespace ov +} // namespace op +} // namespace tpp +} // namespace intel_cpu +} // namespace ov diff --git a/src/plugins/intel_cpu/src/transformations/tpp/x64/op/factory.hpp b/src/plugins/intel_cpu/src/transformations/tpp/x64/op/factory.hpp index b3090ebdec47e2..c7292770d3eb63 100644 --- a/src/plugins/intel_cpu/src/transformations/tpp/x64/op/factory.hpp +++ b/src/plugins/intel_cpu/src/transformations/tpp/x64/op/factory.hpp @@ -1,11 +1,11 @@ -// Copyright (C) 2018-2023 Intel Corporation +// Copyright (C) 2018-2025 Intel Corporation // SPDX-License-Identifier: Apache-2.0 // #pragma once -#include "openvino/op/op.hpp" #include "openvino/core/type.hpp" +#include "openvino/op/op.hpp" namespace ov { namespace intel_cpu { @@ -21,11 +21,12 @@ class NodeFactory { tpp_matcher matcher; tpp_builder builder; }; + private: static std::unordered_map m_direct_mapping; static std::vector m_custom_mapping; }; -} // namespace op -} // namespace tpp -} // namespace intel_cpu -} // namespace ov +} // namespace op +} // namespace tpp +} // namespace intel_cpu +} // namespace ov diff --git a/src/plugins/intel_cpu/src/transformations/tpp/x64/op/modifiers.hpp b/src/plugins/intel_cpu/src/transformations/tpp/x64/op/modifiers.hpp index 507276a1c2c898..558bc0216879c8 100644 --- a/src/plugins/intel_cpu/src/transformations/tpp/x64/op/modifiers.hpp +++ b/src/plugins/intel_cpu/src/transformations/tpp/x64/op/modifiers.hpp @@ -1,4 +1,4 @@ -// Copyright (C) 2018-2022 Intel Corporation +// Copyright (C) 2018-2025 Intel Corporation // SPDX-License-Identifier: Apache-2.0 // @@ -16,19 +16,19 @@ namespace modifier { * @ingroup snippets */ class TensorProcessingPrimitive : virtual public snippets::modifier::MemoryAccess { - public: - void clone_memory_access_ports(const TensorProcessingPrimitive& other) { - m_input_ports = other.m_input_ports; - m_output_ports = other.m_output_ports; - } - static bool visit_attributes(AttributeVisitor& visitor) { - std::string modifier{"TPP"}; - visitor.on_attribute("modifier", modifier); - return true; - } +public: + void clone_memory_access_ports(const TensorProcessingPrimitive& other) { + m_input_ports = other.m_input_ports; + m_output_ports = other.m_output_ports; + } + static bool visit_attributes(AttributeVisitor& visitor) { + std::string modifier{"TPP"}; + visitor.on_attribute("modifier", modifier); + return true; + } }; -} // namespace modifier -} // namespace tpp -} // namespace intel_cpu -} // namespace ov +} // namespace modifier +} // namespace tpp +} // namespace intel_cpu +} // namespace ov diff --git a/src/plugins/intel_cpu/src/transformations/tpp/x64/op/reduce.cpp b/src/plugins/intel_cpu/src/transformations/tpp/x64/op/reduce.cpp index 63119623856bc7..b928620706c8b0 100644 --- a/src/plugins/intel_cpu/src/transformations/tpp/x64/op/reduce.cpp +++ b/src/plugins/intel_cpu/src/transformations/tpp/x64/op/reduce.cpp @@ -1,4 +1,4 @@ -// Copyright (C) 2018-2023 Intel Corporation +// Copyright (C) 2018-2025 Intel Corporation // SPDX-License-Identifier: Apache-2.0 // @@ -10,8 +10,8 @@ namespace tpp { namespace op { ReduceMax::ReduceMax(const Output& arg, size_t axis) - : UnaryEltwiseTPP(LIBXSMM_MELTW_TYPE_UNARY_REDUCE_X_OP_MAX), ov::snippets::op::ReduceMax(arg, axis) { -} + : UnaryEltwiseTPP(LIBXSMM_MELTW_TYPE_UNARY_REDUCE_X_OP_MAX), + ov::snippets::op::ReduceMax(arg, axis) {} std::shared_ptr ReduceMax::clone_with_new_inputs(const OutputVector& new_args) const { check_new_args_count(this, new_args); @@ -26,8 +26,8 @@ bool ReduceMax::visit_attributes(AttributeVisitor& visitor) { } ReduceSum::ReduceSum(const Output& arg, size_t axis) - : UnaryEltwiseTPP(LIBXSMM_MELTW_TYPE_UNARY_REDUCE_X_OP_ADD), ov::snippets::op::ReduceSum(arg, axis) { -} + : UnaryEltwiseTPP(LIBXSMM_MELTW_TYPE_UNARY_REDUCE_X_OP_ADD), + ov::snippets::op::ReduceSum(arg, axis) {} std::shared_ptr ReduceSum::clone_with_new_inputs(const OutputVector& new_args) const { check_new_args_count(this, new_args); @@ -41,7 +41,7 @@ bool ReduceSum::visit_attributes(AttributeVisitor& visitor) { return UnaryEltwiseTPP::visit_attributes(visitor); } -} // namespace op -} // namespace tpp -} // namespace intel_cpu -} // namespace ov +} // namespace op +} // namespace tpp +} // namespace intel_cpu +} // namespace ov diff --git a/src/plugins/intel_cpu/src/transformations/tpp/x64/op/reduce.hpp b/src/plugins/intel_cpu/src/transformations/tpp/x64/op/reduce.hpp index 9542c4ec90b0b6..07ed321abc7ff5 100644 --- a/src/plugins/intel_cpu/src/transformations/tpp/x64/op/reduce.hpp +++ b/src/plugins/intel_cpu/src/transformations/tpp/x64/op/reduce.hpp @@ -1,15 +1,13 @@ -// Copyright (C) 2018-2023 Intel Corporation +// Copyright (C) 2018-2025 Intel Corporation // SPDX-License-Identifier: Apache-2.0 // #pragma once -#include "modifiers.hpp" #include "eltwise.hpp" -#include "snippets/op/reduce.hpp" - - #include "libxsmm_typedefs.h" +#include "modifiers.hpp" +#include "snippets/op/reduce.hpp" namespace ov { namespace intel_cpu { @@ -24,6 +22,7 @@ class ReduceMax : public UnaryEltwiseTPP, public ov::snippets::op::ReduceMax { ReduceMax(const Output& arg, size_t axis); std::shared_ptr clone_with_new_inputs(const OutputVector& new_args) const override; bool visit_attributes(AttributeVisitor& visitor) override; + private: libxsmm_meltw_binary_type m_op_type; }; @@ -34,11 +33,12 @@ class ReduceSum : public UnaryEltwiseTPP, public ov::snippets::op::ReduceSum { ReduceSum(const Output& arg, size_t axis); std::shared_ptr clone_with_new_inputs(const OutputVector& new_args) const override; bool visit_attributes(AttributeVisitor& visitor) override; + private: libxsmm_meltw_binary_type m_op_type; }; -} // namespace op -} // namespace tpp -} // namespace intel_cpu -} // namespace ov +} // namespace op +} // namespace tpp +} // namespace intel_cpu +} // namespace ov diff --git a/src/plugins/intel_cpu/src/transformations/tpp/x64/op/scalar.cpp b/src/plugins/intel_cpu/src/transformations/tpp/x64/op/scalar.cpp index 566a2a5afde658..5855481efd1d60 100644 --- a/src/plugins/intel_cpu/src/transformations/tpp/x64/op/scalar.cpp +++ b/src/plugins/intel_cpu/src/transformations/tpp/x64/op/scalar.cpp @@ -1,8 +1,9 @@ -// Copyright (C) 2018-2023 Intel Corporation +// Copyright (C) 2018-2025 Intel Corporation // SPDX-License-Identifier: Apache-2.0 // #include "scalar.hpp" + #include "modifiers.hpp" namespace ov { @@ -21,11 +22,11 @@ std::shared_ptr Scalar::clone_with_new_inputs(const OutputVector& new_args bool Scalar::visit_attributes(AttributeVisitor& visitor) { modifier::TensorProcessingPrimitive::visit_attributes(visitor); - return snippets::op::Scalar::visit_attributes(visitor);; + return snippets::op::Scalar::visit_attributes(visitor); + ; } - -} // namespace op -} // namespace tpp -} // namespace intel_cpu -} // namespace ov +} // namespace op +} // namespace tpp +} // namespace intel_cpu +} // namespace ov diff --git a/src/plugins/intel_cpu/src/transformations/tpp/x64/op/scalar.hpp b/src/plugins/intel_cpu/src/transformations/tpp/x64/op/scalar.hpp index f9578c20fb13f5..9807dbfafa31d0 100644 --- a/src/plugins/intel_cpu/src/transformations/tpp/x64/op/scalar.hpp +++ b/src/plugins/intel_cpu/src/transformations/tpp/x64/op/scalar.hpp @@ -1,11 +1,11 @@ -// Copyright (C) 2018-2023 Intel Corporation +// Copyright (C) 2018-2025 Intel Corporation // SPDX-License-Identifier: Apache-2.0 // #pragma once -#include "modifiers.hpp" #include "eltwise.hpp" +#include "modifiers.hpp" #include "snippets/op/reduce.hpp" namespace ov { @@ -26,7 +26,7 @@ class Scalar : public ov::snippets::op::Scalar { bool visit_attributes(AttributeVisitor& visitor) override; }; -} // namespace op -} // namespace tpp -} // namespace intel_cpu -} // namespace ov +} // namespace op +} // namespace tpp +} // namespace intel_cpu +} // namespace ov diff --git a/src/plugins/intel_cpu/src/transformations/tpp/x64/pass/brgemm_to_brgemm_tpp.cpp b/src/plugins/intel_cpu/src/transformations/tpp/x64/pass/brgemm_to_brgemm_tpp.cpp index 53992b1e67da9c..c042373f054fa2 100644 --- a/src/plugins/intel_cpu/src/transformations/tpp/x64/pass/brgemm_to_brgemm_tpp.cpp +++ b/src/plugins/intel_cpu/src/transformations/tpp/x64/pass/brgemm_to_brgemm_tpp.cpp @@ -1,23 +1,19 @@ -// Copyright (C) 2018-2022 Intel Corporation +// Copyright (C) 2018-2025 Intel Corporation // SPDX-License-Identifier: Apache-2.0 // -#include "snippets/itt.hpp" - #include "brgemm_to_brgemm_tpp.hpp" -#include "snippets/utils/utils.hpp" -#include "snippets/op/brgemm.hpp" -#include "transformations/tpp/x64/op/brgemm.hpp" - +#include "cpu_shape.h" #include "openvino/core/rt_info.hpp" -#include "openvino/pass/pattern/op/wrap_type.hpp" #include "openvino/pass/pattern/matcher.hpp" - -#include "cpu_shape.h" +#include "openvino/pass/pattern/op/wrap_type.hpp" +#include "snippets/itt.hpp" +#include "snippets/op/brgemm.hpp" +#include "snippets/utils/utils.hpp" +#include "transformations/tpp/x64/op/brgemm.hpp" #include "utils/general_utils.h" - namespace ov { namespace intel_cpu { namespace tpp { @@ -27,13 +23,15 @@ using namespace snippets::lowered; bool BrgemmToBrgemmTPP::is_supported_brgemm_configuration(const std::vector>& layouts, const ov::element::TypeVector& precisions) { - OPENVINO_ASSERT(layouts.size() == 3 && precisions.size() == 3, "snippets::op::Brgemm must have 2 inputs and 1 output"); + OPENVINO_ASSERT(layouts.size() == 3 && precisions.size() == 3, + "snippets::op::Brgemm must have 2 inputs and 1 output"); const bool supported_layouts = std::all_of(layouts.begin(), layouts.end(), [](const std::vector& layout) { return layout.empty() || layout.back() == layout.size() - 1; }); - const bool supported_precisions = std::all_of(precisions.begin(), precisions.end(), [](const ov::element::Type& et) { - return et == ov::element::f32; - }); + const bool supported_precisions = + std::all_of(precisions.begin(), precisions.end(), [](const ov::element::Type& et) { + return et == ov::element::f32; + }); return supported_layouts && supported_precisions; } @@ -79,17 +77,28 @@ BrgemmToBrgemmTPP::BrgemmToBrgemmTPP() { if (precision_a == ov::element::f32) { brgemm_tpp = std::make_shared(brgemm->input_value(0), brgemm->input_value(1), - offset_a, offset_b, offset_c, - layout_a, layout_b, layout_c); + offset_a, + offset_b, + offset_c, + layout_a, + layout_b, + layout_c); } OPENVINO_ASSERT(brgemm_tpp, "Failed to create BrgemmTPP node in the BrgemmToBrgemmTPP pass"); brgemm_tpp->set_friendly_name(brgemm->get_friendly_name()); ov::replace_node(brgemm, brgemm_tpp); - // Set FULL_DIM tensors on ports to avoid automatic loop markup (blocked loops will be inserted in a separate transformation) - PortDescriptorUtils::set_port_descriptor(brgemm_tpp->input(0), brgemm_in0_desc->get_subtensor(), brgemm_in0_desc->get_layout()); - PortDescriptorUtils::set_port_descriptor(brgemm_tpp->input(1), brgemm_in1_desc->get_subtensor(), brgemm_in1_desc->get_layout()); - PortDescriptorUtils::set_port_descriptor(brgemm_tpp->output(0), brgemm_out_desc->get_subtensor(), brgemm_out_desc->get_layout()); + // Set FULL_DIM tensors on ports to avoid automatic loop markup (blocked loops will be inserted in a separate + // transformation) + PortDescriptorUtils::set_port_descriptor(brgemm_tpp->input(0), + brgemm_in0_desc->get_subtensor(), + brgemm_in0_desc->get_layout()); + PortDescriptorUtils::set_port_descriptor(brgemm_tpp->input(1), + brgemm_in1_desc->get_subtensor(), + brgemm_in1_desc->get_layout()); + PortDescriptorUtils::set_port_descriptor(brgemm_tpp->output(0), + brgemm_out_desc->get_subtensor(), + brgemm_out_desc->get_layout()); // need to run validate_and_infer_types manually: either input shapes were updated or // output Layout was updated (out shape will be updated in validate_and_infer_types()) @@ -101,7 +110,7 @@ BrgemmToBrgemmTPP::BrgemmToBrgemmTPP() { auto m = std::make_shared(m_brgemm, matcher_name); register_matcher(m, callback); } -} // namespace pass -} // namespace tpp -} // namespace intel_cpu -} // namespace ov +} // namespace pass +} // namespace tpp +} // namespace intel_cpu +} // namespace ov diff --git a/src/plugins/intel_cpu/src/transformations/tpp/x64/pass/brgemm_to_brgemm_tpp.hpp b/src/plugins/intel_cpu/src/transformations/tpp/x64/pass/brgemm_to_brgemm_tpp.hpp index 2b73104d1e1335..2f00abb213dfb5 100644 --- a/src/plugins/intel_cpu/src/transformations/tpp/x64/pass/brgemm_to_brgemm_tpp.hpp +++ b/src/plugins/intel_cpu/src/transformations/tpp/x64/pass/brgemm_to_brgemm_tpp.hpp @@ -1,4 +1,4 @@ -// Copyright (C) 2018-2022 Intel Corporation +// Copyright (C) 2018-2025 Intel Corporation // SPDX-License-Identifier: Apache-2.0 // @@ -16,7 +16,7 @@ namespace pass { * @brief Converts Snippets Brgemm to BrgemmTPP operation, if possible. Only fp32 Brgemms are currently converted. * @ingroup snippets */ -class BrgemmToBrgemmTPP: public ov::pass::MatcherPass { +class BrgemmToBrgemmTPP : public ov::pass::MatcherPass { public: OPENVINO_MATCHER_PASS_RTTI("BrgemmToBrgemmTPP"); BrgemmToBrgemmTPP(); @@ -25,7 +25,6 @@ class BrgemmToBrgemmTPP: public ov::pass::MatcherPass { const ov::element::TypeVector& precisions); }; - } // namespace pass } // namespace tpp } // namespace intel_cpu diff --git a/src/plugins/intel_cpu/src/transformations/tpp/x64/pass/eltwise_to_eltwise_tpp.cpp b/src/plugins/intel_cpu/src/transformations/tpp/x64/pass/eltwise_to_eltwise_tpp.cpp index da83038f5455f8..bd2c96f7db696b 100644 --- a/src/plugins/intel_cpu/src/transformations/tpp/x64/pass/eltwise_to_eltwise_tpp.cpp +++ b/src/plugins/intel_cpu/src/transformations/tpp/x64/pass/eltwise_to_eltwise_tpp.cpp @@ -1,18 +1,17 @@ -// Copyright (C) 2018-2022 Intel Corporation +// Copyright (C) 2018-2025 Intel Corporation // SPDX-License-Identifier: Apache-2.0 // -#include "snippets/itt.hpp" -#include "snippets/utils/utils.hpp" #include "eltwise_to_eltwise_tpp.hpp" -#include "openvino/pass/pattern/op/wrap_type.hpp" - -#include "transformations/tpp/x64/op/factory.hpp" #include "openvino/op/util/binary_elementwise_arithmetic.hpp" #include "openvino/op/util/unary_elementwise_arithmetic.hpp" +#include "openvino/pass/pattern/op/wrap_type.hpp" +#include "snippets/itt.hpp" #include "snippets/lowered/port_descriptor.hpp" #include "snippets/op/reduce.hpp" +#include "snippets/utils/utils.hpp" +#include "transformations/tpp/x64/op/factory.hpp" namespace ov { namespace intel_cpu { @@ -29,7 +28,6 @@ EltwiseToEltwiseTPP::EltwiseToEltwiseTPP() { ov::op::util::BinaryElementwiseArithmetic, ov::snippets::op::ReduceBase>(is_supported_by_tpp); - auto callback = [=](ov::pass::pattern::Matcher& m) { OV_ITT_SCOPED_TASK(ov::pass::itt::domains::SnippetsTransform, "ov::intel_cpu::pass::EltwiseToEltwiseTPP") const auto node = m.get_match_root(); @@ -41,7 +39,8 @@ EltwiseToEltwiseTPP::EltwiseToEltwiseTPP() { OPENVINO_ASSERT(tpp_eltwise, "Failed to create TPP node"); const size_t M_block = 32; - const size_t N_block = ov::is_type(node) ? ov::snippets::utils::get_full_dim_value() : 64; + const size_t N_block = + ov::is_type(node) ? ov::snippets::utils::get_full_dim_value() : 64; ov::replace_node_update_name(node, tpp_eltwise); for (size_t i = 0; i < node->get_input_size(); i++) ov::snippets::lowered::PortDescriptorUtils::set_port_descriptor(tpp_eltwise->input(i), {M_block, N_block}); @@ -54,7 +53,7 @@ EltwiseToEltwiseTPP::EltwiseToEltwiseTPP() { auto m = std::make_shared(supported_eltwise, matcher_name); register_matcher(m, callback); } -} // namespace pass -} // namespace tpp -} // namespace intel_cpu -} // namespace ov +} // namespace pass +} // namespace tpp +} // namespace intel_cpu +} // namespace ov diff --git a/src/plugins/intel_cpu/src/transformations/tpp/x64/pass/eltwise_to_eltwise_tpp.hpp b/src/plugins/intel_cpu/src/transformations/tpp/x64/pass/eltwise_to_eltwise_tpp.hpp index f0bdab120c3498..faaa20c46f1ad3 100644 --- a/src/plugins/intel_cpu/src/transformations/tpp/x64/pass/eltwise_to_eltwise_tpp.hpp +++ b/src/plugins/intel_cpu/src/transformations/tpp/x64/pass/eltwise_to_eltwise_tpp.hpp @@ -1,4 +1,4 @@ -// Copyright (C) 2018-2022 Intel Corporation +// Copyright (C) 2018-2025 Intel Corporation // SPDX-License-Identifier: Apache-2.0 // @@ -16,13 +16,12 @@ namespace pass { * @brief Converts elementwise operations supported by the TPP backend to the dedicated TPP opset * @ingroup snippets */ -class EltwiseToEltwiseTPP: public ov::pass::MatcherPass { +class EltwiseToEltwiseTPP : public ov::pass::MatcherPass { public: OPENVINO_MATCHER_PASS_RTTI("EltwiseToEltwiseTPP"); EltwiseToEltwiseTPP(); }; - } // namespace pass } // namespace tpp } // namespace intel_cpu diff --git a/src/plugins/intel_cpu/src/transformations/tpp/x64/pass/fuse_tpp_to_equations.cpp b/src/plugins/intel_cpu/src/transformations/tpp/x64/pass/fuse_tpp_to_equations.cpp index 885ff753843588..b64522154adc9e 100644 --- a/src/plugins/intel_cpu/src/transformations/tpp/x64/pass/fuse_tpp_to_equations.cpp +++ b/src/plugins/intel_cpu/src/transformations/tpp/x64/pass/fuse_tpp_to_equations.cpp @@ -3,25 +3,25 @@ // #include "fuse_tpp_to_equations.hpp" -#include "transformations/tpp/x64/op/eltwise.hpp" -#include "transformations/tpp/x64/op/equation.hpp" -#include "snippets/utils/utils.hpp" #include "snippets/itt.hpp" #include "snippets/lowered/port_descriptor.hpp" +#include "snippets/utils/utils.hpp" +#include "transformations/tpp/x64/op/eltwise.hpp" +#include "transformations/tpp/x64/op/equation.hpp" namespace ov { namespace intel_cpu { namespace tpp { namespace pass { -using snippets::lowered::ExpressionPtr; using snippets::lowered::ExpressionPort; +using snippets::lowered::ExpressionPtr; using NodePtr = std::shared_ptr; bool FuseTPPToEquations::fuse_from_root(const NodePtr& root, const std::shared_ptr& m) { using snippets::lowered::PortDescriptorUtils; OutputVector eq_ivals; std::vector op_descs; - std::unordered_map node_replace_map; + std::unordered_map node_replace_map; // Only ops with one out are supported due to Equations restrictions auto supported_num_out = [](const Output& out) { const auto& n = out.get_node_shared_ptr(); @@ -30,10 +30,10 @@ bool FuseTPPToEquations::fuse_from_root(const NodePtr& root, const std::shared_p auto get_tpp_op = [](const NodePtr& n) { auto tpp = std::dynamic_pointer_cast(n); bool not_supported_op = - // ticket: 152532 - ov::is_type(n) || - // ticket: 152510 - ov::is_type(n); + // ticket: 152532 + ov::is_type(n) || + // ticket: 152510 + ov::is_type(n); return not_supported_op ? nullptr : tpp; }; @@ -78,7 +78,6 @@ bool FuseTPPToEquations::fuse_from_root(const NodePtr& root, const std::shared_p } } - auto equation = std::make_shared(eq_ivals, op_descs); for (auto& kv : node_replace_map) @@ -110,8 +109,7 @@ bool FuseTPPToEquations::run_on_model(const std::shared_ptr& m) { return modified; } - -} // namespace pass -} // namespace tpp -} // namespace intel_cpu -} // namespace ov +} // namespace pass +} // namespace tpp +} // namespace intel_cpu +} // namespace ov diff --git a/src/plugins/intel_cpu/src/transformations/tpp/x64/pass/fuse_tpp_to_equations.hpp b/src/plugins/intel_cpu/src/transformations/tpp/x64/pass/fuse_tpp_to_equations.hpp index a99330845d443d..326766d000f69a 100644 --- a/src/plugins/intel_cpu/src/transformations/tpp/x64/pass/fuse_tpp_to_equations.hpp +++ b/src/plugins/intel_cpu/src/transformations/tpp/x64/pass/fuse_tpp_to_equations.hpp @@ -16,11 +16,12 @@ namespace pass { * @brief Converts a group of elementwise operations into a fused TPP Equation node * @ingroup snippets */ -class FuseTPPToEquations: public ov::pass::ModelPass { +class FuseTPPToEquations : public ov::pass::ModelPass { public: OPENVINO_MODEL_PASS_RTTI("FuseTPPToEquations"); FuseTPPToEquations() = default; bool run_on_model(const std::shared_ptr& m) override; + private: static bool fuse_from_root(const std::shared_ptr&, const std::shared_ptr& m); }; diff --git a/src/plugins/intel_cpu/src/transformations/tpp/x64/pass/lowered/brgemm_tpp_blocking.cpp b/src/plugins/intel_cpu/src/transformations/tpp/x64/pass/lowered/brgemm_tpp_blocking.cpp index fa545c26dbb53e..d9485b1c6b7b9d 100644 --- a/src/plugins/intel_cpu/src/transformations/tpp/x64/pass/lowered/brgemm_tpp_blocking.cpp +++ b/src/plugins/intel_cpu/src/transformations/tpp/x64/pass/lowered/brgemm_tpp_blocking.cpp @@ -11,7 +11,6 @@ #include "snippets/utils/utils.hpp" #include "transformations/tpp/x64/op/brgemm.hpp" - namespace ov { namespace intel_cpu { namespace tpp { @@ -28,28 +27,35 @@ bool BrgemmTPPBlocking::SetBrgemmBeta::run(ov::snippets::lowered::LinearIR& line return true; } -std::shared_ptr BrgemmTPPBlocking::SetBrgemmBeta::merge(const std::shared_ptr& other) { +std::shared_ptr BrgemmTPPBlocking::SetBrgemmBeta::merge( + const std::shared_ptr& other) { return !other || ov::is_type(other) ? std::make_shared() : nullptr; } -std::tuple BrgemmTPPBlocking::get_blocking_params(const ov::snippets::lowered::ExpressionPtr& brgemm_expr) const { +std::tuple BrgemmTPPBlocking::get_blocking_params( + const ov::snippets::lowered::ExpressionPtr& brgemm_expr) const { size_t m, n, k; std::tie(m, n, k) = get_brgemm_dimensions(brgemm_expr); - OPENVINO_ASSERT(!is_dynamic_value(m) && !is_dynamic_value(n) && !is_dynamic_value(n), "BrgemmTPP doesn't support dynamic shapes"); + OPENVINO_ASSERT(!is_dynamic_value(m) && !is_dynamic_value(n) && !is_dynamic_value(n), + "BrgemmTPP doesn't support dynamic shapes"); size_t m_blk, n_blk, k_blk; std::tie(m_blk, n_blk, k_blk) = BrgemmBlockingBase::get_blocking_params(brgemm_expr); - auto get_projected_blk = [](const size_t dim, const size_t blk) { return ov::snippets::utils::is_full_dim_value(blk) ? dim : blk; }; + auto get_projected_blk = [](const size_t dim, const size_t blk) { + return ov::snippets::utils::is_full_dim_value(blk) ? dim : blk; + }; return std::make_tuple(get_projected_blk(m, m_blk), get_projected_blk(n, n_blk), get_projected_blk(k, k_blk)); } -ov::snippets::lowered::SpecificIterationHandlers BrgemmTPPBlocking::get_k_loop_handlers(size_t work_amount, size_t block_size) const { - ov::snippets::lowered::SpecificIterationHandlers handlers = ov::snippets::lowered::pass::BrgemmBlockingBase::get_k_loop_handlers(work_amount, block_size); +ov::snippets::lowered::SpecificIterationHandlers BrgemmTPPBlocking::get_k_loop_handlers(size_t work_amount, + size_t block_size) const { + ov::snippets::lowered::SpecificIterationHandlers handlers = + ov::snippets::lowered::pass::BrgemmBlockingBase::get_k_loop_handlers(work_amount, block_size); handlers.register_pass(); return handlers; } -} // namespace pass -} // namespace tpp -} // namespace intel_cpu -} // namespace ov +} // namespace pass +} // namespace tpp +} // namespace intel_cpu +} // namespace ov diff --git a/src/plugins/intel_cpu/src/transformations/tpp/x64/pass/lowered/brgemm_tpp_blocking.hpp b/src/plugins/intel_cpu/src/transformations/tpp/x64/pass/lowered/brgemm_tpp_blocking.hpp index 908d12087175aa..31f4bfeadc8979 100644 --- a/src/plugins/intel_cpu/src/transformations/tpp/x64/pass/lowered/brgemm_tpp_blocking.hpp +++ b/src/plugins/intel_cpu/src/transformations/tpp/x64/pass/lowered/brgemm_tpp_blocking.hpp @@ -36,12 +36,15 @@ class BrgemmTPPBlocking : public ov::snippets::lowered::pass::BrgemmBlocking merge(const std::shared_ptr& other) override; + std::shared_ptr merge( + const std::shared_ptr& other) override; }; private: - std::tuple get_blocking_params(const ov::snippets::lowered::ExpressionPtr& brgemm_expr) const override; - ov::snippets::lowered::SpecificIterationHandlers get_k_loop_handlers(size_t work_amount, size_t block_size) const override; + std::tuple get_blocking_params( + const ov::snippets::lowered::ExpressionPtr& brgemm_expr) const override; + ov::snippets::lowered::SpecificIterationHandlers get_k_loop_handlers(size_t work_amount, + size_t block_size) const override; }; } // namespace pass diff --git a/src/plugins/intel_cpu/src/transformations/tpp/x64/pass/lowered/set_tpp_leading_dim.cpp b/src/plugins/intel_cpu/src/transformations/tpp/x64/pass/lowered/set_tpp_leading_dim.cpp index dcd97fdd74b638..c1b981275face0 100644 --- a/src/plugins/intel_cpu/src/transformations/tpp/x64/pass/lowered/set_tpp_leading_dim.cpp +++ b/src/plugins/intel_cpu/src/transformations/tpp/x64/pass/lowered/set_tpp_leading_dim.cpp @@ -1,14 +1,15 @@ -// Copyright (C) 2018-2022 Intel Corporation +// Copyright (C) 2018-2025 Intel Corporation // SPDX-License-Identifier: Apache-2.0 // -#include "snippets/itt.hpp" -#include "snippets/op/buffer.hpp" -#include "transformations/tpp/x64/op/modifiers.hpp" #include "set_tpp_leading_dim.hpp" -#include "snippets/op/brgemm.hpp" + +#include "snippets/itt.hpp" #include "snippets/lowered/loop_manager.hpp" +#include "snippets/op/brgemm.hpp" +#include "snippets/op/buffer.hpp" #include "snippets/utils/utils.hpp" +#include "transformations/tpp/x64/op/modifiers.hpp" namespace ov { namespace intel_cpu { @@ -24,7 +25,7 @@ using LoopPort = snippets::lowered::LoopPort; bool has_directly_connected_buffer(const ExpressionPort& port, const snippets::lowered::LoopManagerPtr& loop_mngr) { auto accepted_loops = [&loop_mngr, &port](const std::vector& orig, const std::vector& connect) { size_t connect_idx = 0; - auto pred = [&port](const LoopPort& loop_port ) { + auto pred = [&port](const LoopPort& loop_port) { return *loop_port.get_expr_port() == port; }; for (const auto orig_loop : orig) { @@ -36,9 +37,8 @@ bool has_directly_connected_buffer(const ExpressionPort& port, const snippets::l // as long as the port is the loop entry/exit, and it is not incremented. // This is the case for Brgemm K-blocking loops, for example. const auto loop_info = loop_mngr->get_loop_info(orig_loop); - const auto& border_points = port.get_type() == ExpressionPort::Type::Input ? - loop_info->get_input_ports() : - loop_info->get_output_ports(); + const auto& border_points = port.get_type() == ExpressionPort::Type::Input ? loop_info->get_input_ports() + : loop_info->get_output_ports(); const auto& found = std::find_if(border_points.begin(), border_points.end(), pred); if (found == border_points.end() || found->is_incremented()) return false; @@ -87,36 +87,35 @@ size_t get_leading_dim(ExpressionPort port, const snippets::lowered::LoopManager } OPENVINO_ASSERT(layout.empty() || (layout.back() == layout.size() - 1 && layout.size() == shape.size()), - "get_leading_dim detected invalid layout values: check shape + layout combination"); + "get_leading_dim detected invalid layout values: check shape + layout combination"); const auto dim = [&]() -> size_t { - switch (port.get_type()) { - // Input shape is original, so we need to correctly read this data by order - // Example: - // Original shape (shape) = [1, 49, 2, 23] - // Layout (transpose order) = [2, 0, 1, 3] - // Transposed shape = [2, 1, 49, 23] - // The leading dimension is equal to stride of shape[layout[3]] = 2 x 23 - case ExpressionPort::Type::Input : - return snippets::utils::get_input_dim_idx(layout, 1); // `1` in example - // Output shape is already transposed, we need to correctly write the data with original shape by the order - // Example: - // Original transposed shape (shape) = [49, 2, 7, 39] - // Layout (transpose order) = [2, 0, 1, 3] - // Before leading dimension with index 3 there is dimension with index 2 in planar layout. - // Since we have non-planar layout, we have to find this before LD dim in transposed order. - // In layout 2nd idx is first element, it means, that the leading dimension is equal to stride of shape[0] - case ExpressionPort::Type::Output : - return snippets::utils::get_output_dim_idx(layout, 1); // 0 in the example: shape[0] = 49 - default: - OPENVINO_THROW("Unsupported Expression port type"); + switch (port.get_type()) { + // Input shape is original, so we need to correctly read this data by order + // Example: + // Original shape (shape) = [1, 49, 2, 23] + // Layout (transpose order) = [2, 0, 1, 3] + // Transposed shape = [2, 1, 49, 23] + // The leading dimension is equal to stride of shape[layout[3]] = 2 x 23 + case ExpressionPort::Type::Input: + return snippets::utils::get_input_dim_idx(layout, 1); // `1` in example + // Output shape is already transposed, we need to correctly write the data with original shape by the order + // Example: + // Original transposed shape (shape) = [49, 2, 7, 39] + // Layout (transpose order) = [2, 0, 1, 3] + // Before leading dimension with index 3 there is dimension with index 2 in planar layout. + // Since we have non-planar layout, we have to find this before LD dim in transposed order. + // In layout 2nd idx is first element, it means, that the leading dimension is equal to stride of shape[0] + case ExpressionPort::Type::Output: + return snippets::utils::get_output_dim_idx(layout, 1); // 0 in the example: shape[0] = 49 + default: + OPENVINO_THROW("Unsupported Expression port type"); } }; - return layout.size() == 1 ? - shape.back() : - std::accumulate(shape.cbegin() + dim() + 1, shape.cend(), 1, std::multiplies()); + return layout.size() == 1 ? shape.back() + : std::accumulate(shape.cbegin() + dim() + 1, shape.cend(), 1, std::multiplies()); } -} // namespace +} // namespace SetTPPLeadingDim::SetTPPLeadingDim() : RangedPass() {} @@ -151,8 +150,7 @@ bool SetTPPLeadingDim::run(snippets::lowered::LinearIR& linear_ir, return modified; } - -} // namespace pass -} // namespace tpp -} // namespace intel_cpu -} // namespace ov +} // namespace pass +} // namespace tpp +} // namespace intel_cpu +} // namespace ov diff --git a/src/plugins/intel_cpu/src/transformations/tpp/x64/pass/lowered/set_tpp_leading_dim.hpp b/src/plugins/intel_cpu/src/transformations/tpp/x64/pass/lowered/set_tpp_leading_dim.hpp index d755e4813dde8e..e49b48ccbfb47e 100644 --- a/src/plugins/intel_cpu/src/transformations/tpp/x64/pass/lowered/set_tpp_leading_dim.hpp +++ b/src/plugins/intel_cpu/src/transformations/tpp/x64/pass/lowered/set_tpp_leading_dim.hpp @@ -1,4 +1,4 @@ -// Copyright (C) 2018-2022 Intel Corporation +// Copyright (C) 2018-2025 Intel Corporation // SPDX-License-Identifier: Apache-2.0 // @@ -15,10 +15,11 @@ namespace pass { * @interface SetTPPLeadingDim * @brief TPP leading dimension depends on the operation it is connected to. If it's a Parameter or Result * we can compute LD based on shape, if it's a Buffer - we need to consider allocation shape. - * This transformation should be performed before InsertTailLoop because it may change graph connectivity for 1st and last iterations. + * This transformation should be performed before InsertTailLoop because it may change graph connectivity for 1st and + * last iterations. * @ingroup snippets */ -class SetTPPLeadingDim: public snippets::lowered::pass::RangedPass { +class SetTPPLeadingDim : public snippets::lowered::pass::RangedPass { public: OPENVINO_RTTI("SetTPPLeadingDim", "0", snippets::lowered::pass::RangedPass); SetTPPLeadingDim(); diff --git a/src/plugins/intel_cpu/src/transformations/tpp/x64/pass/scalar_to_scalar_tpp.cpp b/src/plugins/intel_cpu/src/transformations/tpp/x64/pass/scalar_to_scalar_tpp.cpp index 0b9f41d47aa0da..f5188df53aeb28 100644 --- a/src/plugins/intel_cpu/src/transformations/tpp/x64/pass/scalar_to_scalar_tpp.cpp +++ b/src/plugins/intel_cpu/src/transformations/tpp/x64/pass/scalar_to_scalar_tpp.cpp @@ -1,15 +1,15 @@ -// Copyright (C) 2018-2022 Intel Corporation +// Copyright (C) 2018-2025 Intel Corporation // SPDX-License-Identifier: Apache-2.0 // -#include "snippets/itt.hpp" #include "scalar_to_scalar_tpp.hpp" + #include "openvino/pass/pattern/op/wrap_type.hpp" +#include "snippets/itt.hpp" +#include "snippets/lowered/port_connector.hpp" #include "snippets/op/scalar.hpp" -#include "transformations/tpp/x64/op/scalar.hpp" #include "transformations/tpp/x64/op/modifiers.hpp" -#include "snippets/lowered/port_connector.hpp" - +#include "transformations/tpp/x64/op/scalar.hpp" namespace ov { namespace intel_cpu { @@ -21,7 +21,6 @@ ScalarToScalarTPP::ScalarToScalarTPP() { auto snippets_scalar = ov::pass::pattern::wrap_type(); - auto callback = [=](ov::pass::pattern::Matcher& m) { OV_ITT_SCOPED_TASK(ov::pass::itt::domains::SnippetsTransform, "ov::intel_cpu::pass::ScalarToScalarTPP") const auto node = ov::as_type_ptr(m.get_match_root()); @@ -51,7 +50,7 @@ ScalarToScalarTPP::ScalarToScalarTPP() { auto m = std::make_shared(snippets_scalar, matcher_name); register_matcher(m, callback); } -} // namespace pass -} // namespace tpp -} // namespace intel_cpu -} // namespace ov +} // namespace pass +} // namespace tpp +} // namespace intel_cpu +} // namespace ov diff --git a/src/plugins/intel_cpu/src/transformations/tpp/x64/pass/scalar_to_scalar_tpp.hpp b/src/plugins/intel_cpu/src/transformations/tpp/x64/pass/scalar_to_scalar_tpp.hpp index a56e23363067e2..4e8defeca762c8 100644 --- a/src/plugins/intel_cpu/src/transformations/tpp/x64/pass/scalar_to_scalar_tpp.hpp +++ b/src/plugins/intel_cpu/src/transformations/tpp/x64/pass/scalar_to_scalar_tpp.hpp @@ -1,4 +1,4 @@ -// Copyright (C) 2018-2022 Intel Corporation +// Copyright (C) 2018-2025 Intel Corporation // SPDX-License-Identifier: Apache-2.0 // @@ -16,13 +16,12 @@ namespace pass { * @brief Converts snippets::op::Scalar to tpp::op::Scalar, since TPP operations require a dedicated emitter * @ingroup snippets */ -class ScalarToScalarTPP: public ov::pass::MatcherPass { +class ScalarToScalarTPP : public ov::pass::MatcherPass { public: OPENVINO_MATCHER_PASS_RTTI("ScalarToScalarTPP"); ScalarToScalarTPP(); }; - } // namespace pass } // namespace tpp } // namespace intel_cpu diff --git a/src/plugins/intel_cpu/src/utils/enum_class_hash.hpp b/src/plugins/intel_cpu/src/utils/enum_class_hash.hpp index 7e17af42d05a97..28796c752decfc 100644 --- a/src/plugins/intel_cpu/src/utils/enum_class_hash.hpp +++ b/src/plugins/intel_cpu/src/utils/enum_class_hash.hpp @@ -1,4 +1,4 @@ -// Copyright (C) 2018-2022 Intel Corporation +// Copyright (C) 2018-2025 Intel Corporation // SPDX-License-Identifier: Apache-2.0 // diff --git a/src/plugins/intel_cpu/src/utils/plain_tensor.hpp b/src/plugins/intel_cpu/src/utils/plain_tensor.hpp index a27f29c0ab0e1b..497688f831bb90 100644 --- a/src/plugins/intel_cpu/src/utils/plain_tensor.hpp +++ b/src/plugins/intel_cpu/src/utils/plain_tensor.hpp @@ -91,8 +91,8 @@ struct precision_of { #define PLAINTENSOR_RANK_MAX 8 struct PlainTensor { - size_t m_strides[PLAINTENSOR_RANK_MAX]; - size_t m_dims[PLAINTENSOR_RANK_MAX]; + size_t m_strides[PLAINTENSOR_RANK_MAX] = {}; + size_t m_dims[PLAINTENSOR_RANK_MAX] = {}; size_t m_rank = 0; std::shared_ptr m_ptr; size_t m_capacity = 0; diff --git a/src/plugins/intel_cpu/tests/functional/custom/single_layer_tests/classes/convolution.cpp b/src/plugins/intel_cpu/tests/functional/custom/single_layer_tests/classes/convolution.cpp index b3c958a2c88a68..ed7fdcff0479d8 100644 --- a/src/plugins/intel_cpu/tests/functional/custom/single_layer_tests/classes/convolution.cpp +++ b/src/plugins/intel_cpu/tests/functional/custom/single_layer_tests/classes/convolution.cpp @@ -190,16 +190,6 @@ void ConvolutionLayerCPUTest::SetUp() { } TEST_P(ConvolutionLayerCPUTest, CompareWithRefs) { - // Skip tests for sse41 convolution where ic or oc cannot be exactly divided by the block size, - // since tails processing for sse41 nspc layout is not supported yet (see 52736). - if (!inFmts.empty() && (inFmts.front() == nwc || inFmts.front() == nhwc || inFmts.front() == ndhwc) && selectedType.find("jit_sse") != std::string::npos) { - auto inpChannels = function->get_parameters().front()->get_partial_shape()[1].get_length(); - auto outChannels = function->get_output_partial_shape(0)[1].get_length(); - if ((inpChannels % 8) || (outChannels % 8)) { - GTEST_SKIP() << "Disabled test due to the sse41 convolution kernel does not support tails for nspc layout." << std::endl; - } - } - if (!priority.empty()) { // Skip tests for brgconv convolution where kernel size = 1x1 if (one_of(priority[0], "brgconv_avx512", "brgconv_avx512_amx", "brgconv_avx2")) { @@ -340,10 +330,7 @@ const std::vector& inShapesGemm2D_cache() { const std::vector& CPUParams_2D() { static const std::vector CPUParams_2D = { - conv_sse42_2D, - conv_avx2_2D, conv_avx512_2D, - conv_sse42_2D_nspc, conv_avx2_2D_nspc, conv_avx2_2D_nspc_brgconv, conv_avx512_2D_nspc, @@ -354,7 +341,6 @@ const std::vector& CPUParams_2D() { const std::vector& CPUParams_3D() { static const std::vector CPUParams_3D = { - //conv_sse42_3D, // not supported jit_sse42 for 3d conv_avx2_3D, conv_avx512_3D, conv_avx2_3D_nspc, @@ -479,10 +465,8 @@ const std::vector& inputShapes2d_dynBatch() { const std::vector& CPUParams_1x1_1D() { static const std::vector CPUParams_1x1_1D = { - conv_sse42_1D_1x1, conv_avx2_1D_1x1, conv_avx512_1D_1x1, - conv_sse42_1D_1x1_nspc, conv_avx2_1D_1x1_nspc, conv_avx2_1D_1x1_nspc_brgconv, conv_avx512_1D_1x1_nspc, @@ -567,10 +551,8 @@ const std::vector& CPUParams_GEMM_3D() { const std::vector& CPUParams_1x1_2D() { static const std::vector CPUParams_1x1_2D = { - conv_sse42_2D_1x1, conv_avx2_2D_1x1, conv_avx512_2D_1x1, - conv_sse42_2D_1x1_nspc, conv_avx2_2D_1x1_nspc, conv_avx2_2D_1x1_nspc_brgconv, conv_avx512_2D_1x1_nspc, diff --git a/src/plugins/intel_cpu/tests/functional/custom/single_layer_tests/classes/convolution_backprop_data.cpp b/src/plugins/intel_cpu/tests/functional/custom/single_layer_tests/classes/convolution_backprop_data.cpp index 415515ef7f40a2..651e75024987ab 100755 --- a/src/plugins/intel_cpu/tests/functional/custom/single_layer_tests/classes/convolution_backprop_data.cpp +++ b/src/plugins/intel_cpu/tests/functional/custom/single_layer_tests/classes/convolution_backprop_data.cpp @@ -1,4 +1,4 @@ -// Copyright (C) 2018-2023 Intel Corporation +// Copyright (C) 2018-2025 Intel Corporation // SPDX-License-Identifier: Apache-2.0 // diff --git a/src/plugins/intel_cpu/tests/functional/custom/single_layer_tests/classes/convolution_backprop_data.hpp b/src/plugins/intel_cpu/tests/functional/custom/single_layer_tests/classes/convolution_backprop_data.hpp index 615bb99225b952..3e797759d21ee0 100755 --- a/src/plugins/intel_cpu/tests/functional/custom/single_layer_tests/classes/convolution_backprop_data.hpp +++ b/src/plugins/intel_cpu/tests/functional/custom/single_layer_tests/classes/convolution_backprop_data.hpp @@ -1,4 +1,4 @@ -// Copyright (C) 2018-2023 Intel Corporation +// Copyright (C) 2018-2025 Intel Corporation // SPDX-License-Identifier: Apache-2.0 // diff --git a/src/plugins/intel_cpu/tests/functional/custom/single_layer_tests/classes/pooling.cpp b/src/plugins/intel_cpu/tests/functional/custom/single_layer_tests/classes/pooling.cpp index 7c4854dd334bcf..62352c851435b2 100644 --- a/src/plugins/intel_cpu/tests/functional/custom/single_layer_tests/classes/pooling.cpp +++ b/src/plugins/intel_cpu/tests/functional/custom/single_layer_tests/classes/pooling.cpp @@ -787,12 +787,11 @@ const CPUSpecificParams& expectedCpuConfigAnyLayout() { } const std::vector& vecCpuConfigsFusing_4D() { - const auto sse42_nhwc = CPUSpecificParams{{nhwc}, {nhwc}, {"jit_sse42"}, "jit_sse42"}; const auto avx2_nhwc = CPUSpecificParams{{nhwc}, {nhwc}, {"jit_avx2"}, "jit_avx2"}; const auto avx512_nhwc = CPUSpecificParams{{nhwc}, {nhwc}, {"jit_avx512"}, "jit_avx512"}; const auto acl_nhwc = CPUSpecificParams{{nhwc}, {nhwc}, {"acl"}, "acl"}; - static const std::vector vecCpuConfigsFusing_4D = {sse42_nhwc, avx2_nhwc, avx512_nhwc, acl_nhwc, expectedCpuConfigAnyLayout()}; + static const std::vector vecCpuConfigsFusing_4D = {avx2_nhwc, avx512_nhwc, acl_nhwc, expectedCpuConfigAnyLayout()}; return vecCpuConfigsFusing_4D; } diff --git a/src/plugins/intel_cpu/tests/functional/custom/single_layer_tests/group_convolution.cpp b/src/plugins/intel_cpu/tests/functional/custom/single_layer_tests/group_convolution.cpp index 64dcf20542c09d..7d9173e472e089 100644 --- a/src/plugins/intel_cpu/tests/functional/custom/single_layer_tests/group_convolution.cpp +++ b/src/plugins/intel_cpu/tests/functional/custom/single_layer_tests/group_convolution.cpp @@ -1043,7 +1043,7 @@ const auto groupConvParams_ExplicitPadding_1D = ::testing::Combine(::testing::Va ::testing::Values(ov::op::PadType::EXPLICIT)); const std::vector CPUParams_1D = - {conv_sse42_1D, conv_avx2_1D, conv_avx512_1D, conv_sse42_1D_nspc, conv_avx2_1D_nspc, conv_avx512_1D_nspc}; + {conv_avx2_1D, conv_avx512_1D, conv_avx2_1D_nspc, conv_avx512_1D_nspc}; std::vector inputShapes1d = {{{}, {{2, 64, 7}}}, {// dynamic shapes @@ -1108,7 +1108,7 @@ const auto groupConvParams_ExplicitPadding_2D = ::testing::Combine(::testing::Va ::testing::Values(ov::op::PadType::EXPLICIT)); const std::vector CPUParams_2D = - {conv_sse42_2D, conv_avx2_2D, conv_avx512_2D, conv_sse42_2D_nspc, conv_avx2_2D_nspc, conv_avx512_2D_nspc}; + {conv_avx2_2D, conv_avx512_2D, conv_avx2_2D_nspc, conv_avx512_2D_nspc}; std::vector inputShapes2d = {{{}, {{1, 64, 7, 7}}}, {// dynamic shapes @@ -1197,7 +1197,6 @@ const auto groupConvParams_ExplicitPadding_3D = ::testing::Combine(::testing::Va ::testing::Values(ov::op::PadType::EXPLICIT)); const std::vector CPUParams_3D = { - // conv_sse42_3D, // not supported jit_sse42 for 3d conv_avx2_3D, conv_avx512_3D, conv_avx2_3D_nspc, @@ -1247,10 +1246,8 @@ const auto groupConvParams_ExplicitPadding_DW_1D = ::testing::Combine(::testing: ::testing::ValuesIn(numGroups_DW), ::testing::Values(ov::op::PadType::EXPLICIT)); -const std::vector CPUParams_DW_1D = {conv_sse42_dw_1D, - conv_avx2_dw_1D, +const std::vector CPUParams_DW_1D = {conv_avx2_dw_1D, conv_avx512_dw_1D, - conv_sse42_dw_1D_nspc, conv_avx2_dw_1D_nspc, conv_avx512_dw_1D_nspc}; @@ -1272,8 +1269,7 @@ INSTANTIATE_TEST_SUITE_P( ::testing::ValuesIn(inputShapes1dDW), ::testing::Values(ov::test::utils::DEVICE_CPU)), ::testing::ValuesIn(filterCPUInfoForDevice( - {conv_sse42_dw_1D, conv_avx2_dw_1D, conv_avx512_dw_1D})), // todo: [AV] what about conv_sse42_dw_1D_nspc, - // conv_avx2_dw_1D_nspc, conv_avx512_dw_1D_nspc? + {conv_avx2_dw_1D, conv_avx512_dw_1D})), // todo: [AV] what about conv_avx2_dw_1D_nspc, conv_avx512_dw_1D_nspc? ::testing::ValuesIn(fusingParamsSet), ::testing::Values(empty_plugin_config)), GroupConvolutionLayerCPUTest::getTestCaseName); @@ -1302,10 +1298,8 @@ const auto groupConvParams_ExplicitPadding_DW_2D = ::testing::Combine(::testing: ::testing::ValuesIn(numGroups_DW), ::testing::Values(ov::op::PadType::EXPLICIT)); -const std::vector CPUParams_DW_2D = {conv_sse42_dw_2D, - conv_avx2_dw_2D, +const std::vector CPUParams_DW_2D = {conv_avx2_dw_2D, conv_avx512_dw_2D, - conv_sse42_dw_2D_nspc, conv_avx2_dw_2D_nspc, conv_avx512_dw_2D_nspc}; @@ -1411,10 +1405,8 @@ const auto groupConvParams_ExplicitPadding_DW_3D = ::testing::Combine(::testing: ::testing::ValuesIn(numGroups_DW), ::testing::Values(ov::op::PadType::EXPLICIT)); -const std::vector CPUParams_DW_3D = {conv_sse42_dw_3D, - conv_avx2_dw_3D, +const std::vector CPUParams_DW_3D = {conv_avx2_dw_3D, conv_avx512_dw_3D, - conv_sse42_dw_3D_nspc, conv_avx2_dw_3D_nspc, conv_avx512_dw_3D_nspc}; @@ -1673,171 +1665,6 @@ INSTANTIATE_TEST_SUITE_P(smoke_GEMM_GroupConv, ::testing::ValuesIn(filterParamsSetForDevice(gemmGroupConvTestCases)), GroupConvolutionLayerCPUTest::getTestCaseName); -/* ============= JIT SSE42 GroupConvolution ============= */ -const std::vector sse42_GroupConv = {conv_sse42_2D, conv_sse42_2D_nspc}; -const std::vector JIT_SSE42_GroupConvTestCases = generateSingleGroupConvCPUTestCases( - // 1. jcp.ur_w (=3,<3) - // 2. jcp.ur_w_tail (=0,>0) - // 3. jcp.kw (>7,<=7) - // 4. jcp.nb_oc = jcp.oc / jcp.oc_block; - // 5. jcp.nb_ic = jcp.ic / jcp.ic_block; - // 6. ocb_work - - // jcp.ur_w == 3, jcp.ur_w_tail == 2 - makeSingleGroupConvCPUTestCases({3, 3}, - {1, 1}, - {1, 1}, - {0, 0}, - {0, 0}, - ov::op::PadType::VALID, - 2, - 1, - {5, 10}, - 8, - 8, - sse42_GroupConv, - vecPrcConnectParamsFP32), - // jcp.ur_w < 3 (jcp.ur_w == jcp.ow) - makeSingleGroupConvCPUTestCases({3, 3}, - {1, 1}, - {1, 1}, - {0, 0}, - {0, 0}, - ov::op::PadType::VALID, - 2, - 1, - {5, 4}, - 8, - 8, - sse42_GroupConv, - vecPrcConnectParamsFP32), - // jcp.ur_w == 3, jcp.ur_w_tail == 0 - makeSingleGroupConvCPUTestCases({3, 3}, - {1, 1}, - {1, 1}, - {0, 0}, - {0, 0}, - ov::op::PadType::VALID, - 2, - 1, - {5, 11}, - 8, - 8, - sse42_GroupConv, - vecPrcConnectParamsFP32), - // jcp.kw > 7 - makeSingleGroupConvCPUTestCases({3, 8}, - {1, 1}, - {1, 1}, - {0, 0}, - {0, 0}, - ov::op::PadType::VALID, - 2, - 1, - {5, 10}, - 8, - 8, - sse42_GroupConv, - vecPrcConnectParamsFP32), - // jcp.nb_oc == 2 - makeSingleGroupConvCPUTestCases({3, 3}, - {1, 1}, - {1, 1}, - {0, 0}, - {0, 0}, - ov::op::PadType::VALID, - 2, - 1, - {5, 5}, - 8, - 16, - sse42_GroupConv, - vecPrcConnectParamsFP32), - // jcp.nb_ic == 2 - makeSingleGroupConvCPUTestCases({3, 3}, - {1, 1}, - {1, 1}, - {0, 0}, - {0, 0}, - ov::op::PadType::VALID, - 2, - 1, - {5, 5}, - 16, - 8, - sse42_GroupConv, - vecPrcConnectParamsFP32), - // ocb_work > 1 (ocb_work == 2) - makeSingleGroupConvCPUTestCases({3, 3}, - {1, 1}, - {1, 1}, - {0, 0}, - {0, 0}, - ov::op::PadType::VALID, - 2, - 1, - {5, 5}, - 8, - 40, - sse42_GroupConv, - vecPrcConnectParamsFP32), - // jcp.nb_ic == 2, ocb_work == 2 - makeSingleGroupConvCPUTestCases({3, 3}, - {1, 1}, - {1, 1}, - {0, 0}, - {0, 0}, - ov::op::PadType::VALID, - 2, - 1, - {5, 5}, - 16, - 40, - sse42_GroupConv, - vecPrcConnectParamsFP32), - - // "hard" cases - makeSingleGroupConvCPUTestCases({3, 3}, - {2, 2}, - {1, 1}, - {1, 1}, - {1, 1}, - ov::op::PadType::EXPLICIT, - 3, - 2, - {129, 129}, - 8, - 8, - sse42_GroupConv, - vecPrcConnectParamsFP32Default), - makeSingleGroupConvCPUTestCases({2, 4}, - {1, 2}, - {3, 2}, - {2, 1}, - {1, 0}, - ov::op::PadType::EXPLICIT, - 2, - 1, - {10, 10}, - 8, - 8, - sse42_GroupConv, - vecPrcConnectParamsFP32Default) - - // not supported jit_sse42 for 3d - // makeSingleGroupConvCPUTestCases({3, 3, 3}, {2, 2, 2}, {1, 1, 1}, {1, 1, 1}, {1, 1, 1}, - // ov::op::PadType::EXPLICIT, - // 3, 2, {33, 33, 33}, 8, 8, cpuParams_sse42_3D), - // makeSingleGroupConvCPUTestCases({2, 3, 4}, {1, 2, 2}, {3, 1, 2}, {2, 2, 1}, {1, 1, 0}, - // ov::op::PadType::EXPLICIT, - // 2, 1, {10, 10, 10}, 8, 8, cpuParams_sse42_3D), -); - -INSTANTIATE_TEST_SUITE_P(smoke_JIT_SSE42_GroupConv, - GroupConvolutionLayerCPUTest, - ::testing::ValuesIn(filterParamsSetForDevice(JIT_SSE42_GroupConvTestCases)), - GroupConvolutionLayerCPUTest::getTestCaseName); - /* ============= JIT AVX2 GroupConvolution ============= */ const std::vector avx2_GroupConv_2D = {conv_avx2_2D, conv_avx2_2D_nspc}; const std::vector avx2_GroupConv_3D = {conv_avx2_3D, conv_avx2_3D_nspc}; @@ -2130,120 +1957,6 @@ INSTANTIATE_TEST_SUITE_P(smoke_JIT_AVX512_GroupConv, ::testing::ValuesIn(filterParamsSetForDevice(JIT_AVX512_GroupConvTestCases)), GroupConvolutionLayerCPUTest::getTestCaseName); -/* ============= JIT SSE42 DW GroupConvolution ============= */ -const std::vector sse42_DW_2D = {conv_sse42_dw_2D, conv_sse42_dw_2D_nspc}; -const std::vector sse42_DW_3D = {conv_sse42_dw_3D, conv_sse42_dw_3D_nspc}; -const std::vector JIT_SSE42_DW_GroupConvTestCases = generateSingleGroupConvCPUTestCases( - // 1. jcp.ngroups % simd_w (=0,!=0) - // 2. jcp.nb_ch - // 3. jcp.nb_ch_blocking (=2,<2) - // 4. jcp.ur_w == 3 - - // jcp.ngroups % simd_w == 0, jcp.nb_ch == 1, jcp.nb_ch_blocking == 1 (jcp.ngroups == 8) - makeSingleGroupConvCPUTestCases({3, 3}, - {1, 1}, - {1, 1}, - {0, 0}, - {0, 0}, - ov::op::PadType::VALID, - 8, - 1, - {5, 5}, - 1, - 1, - sse42_DW_2D, - vecPrcConnectParamsFP32), - // jcp.ngroups % simd_w == 0, jcp.nb_ch == 2, jcp.nb_ch_blocking == 2 (jcp.ngroups == 16) - makeSingleGroupConvCPUTestCases({3, 3}, - {1, 1}, - {1, 1}, - {0, 0}, - {0, 0}, - ov::op::PadType::VALID, - 16, - 1, - {5, 5}, - 1, - 1, - sse42_DW_2D, - vecPrcConnectParamsFP32), - // jcp.ngroups % simd_w != 0, jcp.nb_ch == 3, jcp.nb_ch_blocking == 2 (jcp.ngroups == 17) TODO: pad channels not - // supported for SSE42 makeSingleGroupConvCPUTestCases({3, 3}, {1, 1}, {1, 1}, {0, 0}, {0, 0}, - // ov::op::PadType::VALID, 17, 1, {5, 5}, 1, 1, conv_sse42_DW_2D, vecPrcConnectParamsFP32only), jcp.ow > jcp.ur_w - // (jcp.ow == 7) - makeSingleGroupConvCPUTestCases({3, 3}, - {1, 1}, - {1, 1}, - {0, 0}, - {0, 0}, - ov::op::PadType::VALID, - 8, - 1, - {5, 9}, - 1, - 1, - sse42_DW_2D, - vecPrcConnectParamsFP32), - - // "hard" cases - makeSingleGroupConvCPUTestCases({3, 3}, - {2, 2}, - {1, 1}, - {1, 1}, - {1, 1}, - ov::op::PadType::EXPLICIT, - 8, - 2, - {129, 129}, - 1, - 1, - sse42_DW_2D, - vecPrcConnectParamsFP32), - makeSingleGroupConvCPUTestCases({2, 4}, - {1, 2}, - {3, 2}, - {2, 1}, - {1, 0}, - ov::op::PadType::EXPLICIT, - 8, - 1, - {10, 10}, - 1, - 1, - sse42_DW_2D, - vecPrcConnectParamsFP32Default), - makeSingleGroupConvCPUTestCases({3, 3, 3}, - {2, 2, 2}, - {1, 1, 1}, - {1, 1, 1}, - {1, 1, 1}, - ov::op::PadType::EXPLICIT, - 8, - 2, - {33, 33, 33}, - 1, - 1, - sse42_DW_3D, - vecPrcConnectParamsFP32Default), - makeSingleGroupConvCPUTestCases({2, 3, 4}, - {1, 2, 2}, - {3, 1, 2}, - {2, 2, 1}, - {1, 1, 0}, - ov::op::PadType::EXPLICIT, - 8, - 1, - {10, 10, 10}, - 1, - 1, - sse42_DW_3D, - vecPrcConnectParamsFP32)); - -INSTANTIATE_TEST_SUITE_P(smoke_JIT_SSE42_DW_GroupConv, - GroupConvolutionLayerCPUTest, - ::testing::ValuesIn(filterParamsSetForDevice(JIT_SSE42_DW_GroupConvTestCases)), - GroupConvolutionLayerCPUTest::getTestCaseName); - /* ============= JIT AVX2 DW GroupConvolution ============= */ const std::vector avx2_DW_2D = {conv_avx2_dw_2D, conv_avx2_dw_2D_nspc}; const std::vector avx2_DW_3D = {conv_avx2_dw_3D, conv_avx2_dw_3D_nspc}; @@ -2494,7 +2207,6 @@ INSTANTIATE_TEST_SUITE_P(smoke_JIT_AVX512_DW_GroupConv, ::testing::ValuesIn(filterParamsSetForDevice(JIT_AVX512_DW_GroupConvTestCases)), GroupConvolutionLayerCPUTest::getTestCaseName); -/* ============= JIT SSE42 1x1 Convolution (not supported with groups) ============= */ /* ============= JIT AVX2 1x1 Convolution (not supported with groups) ============= */ /* ============= JIT AVX512 1x1 Convolution (not supported with groups) ============= */ /* ============= JIT AVX2 PLANAR Convolution (not supported with groups) ============= */ diff --git a/src/plugins/intel_cpu/tests/functional/custom/single_layer_tests/instances/arm/convolution_backprop_data.cpp b/src/plugins/intel_cpu/tests/functional/custom/single_layer_tests/instances/arm/convolution_backprop_data.cpp index 6229f9a30d3c45..f13ec1e98faa46 100755 --- a/src/plugins/intel_cpu/tests/functional/custom/single_layer_tests/instances/arm/convolution_backprop_data.cpp +++ b/src/plugins/intel_cpu/tests/functional/custom/single_layer_tests/instances/arm/convolution_backprop_data.cpp @@ -1,4 +1,4 @@ -// Copyright (C) 2018-2023 Intel Corporation +// Copyright (C) 2018-2025 Intel Corporation // SPDX-License-Identifier: Apache-2.0 // diff --git a/src/plugins/intel_cpu/tests/functional/custom/single_layer_tests/instances/common/convolution.cpp b/src/plugins/intel_cpu/tests/functional/custom/single_layer_tests/instances/common/convolution.cpp index 09f8dc14660392..94683387d1eac0 100644 --- a/src/plugins/intel_cpu/tests/functional/custom/single_layer_tests/instances/common/convolution.cpp +++ b/src/plugins/intel_cpu/tests/functional/custom/single_layer_tests/instances/common/convolution.cpp @@ -106,7 +106,6 @@ INSTANTIATE_TEST_SUITE_P(Conv_2D_FP32_dilated_empty_fusing, ConvolutionLayerCPUT ConvolutionLayerCPUTest::getTestCaseName); const std::vector CPUParams_2D_plain_to_blocked = { - conv_sse42_plain_to_blocked_2D, conv_avx2_plain_to_blocked_2D, conv_avx512_plain_to_blocked_2D, }; @@ -397,4 +396,4 @@ INSTANTIATE_TEST_SUITE_P(smoke_Conv_Large_Filter, ConvolutionLayerCPUTest, } // namespace } // namespace Convolution } // namespace test -} // namespace ov \ No newline at end of file +} // namespace ov diff --git a/src/plugins/intel_cpu/tests/functional/custom/single_layer_tests/instances/common/convolution_backprop_data.cpp b/src/plugins/intel_cpu/tests/functional/custom/single_layer_tests/instances/common/convolution_backprop_data.cpp index 538d9f48f88114..3af974dc80d35a 100755 --- a/src/plugins/intel_cpu/tests/functional/custom/single_layer_tests/instances/common/convolution_backprop_data.cpp +++ b/src/plugins/intel_cpu/tests/functional/custom/single_layer_tests/instances/common/convolution_backprop_data.cpp @@ -1,4 +1,4 @@ -// Copyright (C) 2018-2023 Intel Corporation +// Copyright (C) 2018-2025 Intel Corporation // SPDX-License-Identifier: Apache-2.0 // diff --git a/src/plugins/intel_cpu/tests/functional/custom/single_layer_tests/instances/x64/convolution.cpp b/src/plugins/intel_cpu/tests/functional/custom/single_layer_tests/instances/x64/convolution.cpp index 741e12031c680c..030f7eb3bc40b8 100644 --- a/src/plugins/intel_cpu/tests/functional/custom/single_layer_tests/instances/x64/convolution.cpp +++ b/src/plugins/intel_cpu/tests/functional/custom/single_layer_tests/instances/x64/convolution.cpp @@ -344,10 +344,8 @@ const auto convParams_ExplicitPadding_1D = ::testing::Combine( ); const std::vector CPUParams_1D_f32 = { - conv_sse42_1D, conv_avx2_1D, conv_avx512_1D, - conv_sse42_1D_nspc, conv_avx2_1D_nspc, conv_avx2_1D_nspc_brgconv, conv_avx512_1D_nspc, @@ -356,10 +354,8 @@ const std::vector CPUParams_1D_f32 = { //Current avx2 I8 fall back on JIT avx2 implement when having src zero point.Not enabling conv_avx2_1D_nspc_brgconv for I8 precision. const std::vector CPUParams_1D_I8 = { - conv_sse42_1D, conv_avx2_1D, conv_avx512_1D, - conv_sse42_1D_nspc, conv_avx2_1D_nspc, conv_avx512_1D_nspc, conv_avx512_1D_nspc_brgconv @@ -424,7 +420,6 @@ INSTANTIATE_TEST_SUITE_P(smoke_Conv_1D_I8, ConvolutionLayerCPUTest, ConvolutionLayerCPUTest::getTestCaseName); const std::vector CPUParams_1D_plain_to_blocked = { - conv_sse42_plain_to_blocked_1D, conv_avx2_plain_to_blocked_1D, conv_avx512_plain_to_blocked_1D, }; @@ -630,7 +625,6 @@ INSTANTIATE_TEST_SUITE_P(smoke_Conv_2D_1x1_FP16, ConvolutionLayerCPUTest, /* ============= Jit Planar ============= */ /* ============= Convolution planar params (2D) ============= */ const std::vector CPUParams_Jit_Planar_2D = { - // sse42 is not supported conv_avx2_planar_2D, conv_avx512_planar_2D, }; diff --git a/src/plugins/intel_cpu/tests/functional/custom/single_layer_tests/instances/x64/convolution_backprop_data.cpp b/src/plugins/intel_cpu/tests/functional/custom/single_layer_tests/instances/x64/convolution_backprop_data.cpp index 3263396b52521d..4576f283d43534 100755 --- a/src/plugins/intel_cpu/tests/functional/custom/single_layer_tests/instances/x64/convolution_backprop_data.cpp +++ b/src/plugins/intel_cpu/tests/functional/custom/single_layer_tests/instances/x64/convolution_backprop_data.cpp @@ -1,4 +1,4 @@ -// Copyright (C) 2018-2023 Intel Corporation +// Copyright (C) 2018-2025 Intel Corporation // SPDX-License-Identifier: Apache-2.0 // diff --git a/src/plugins/intel_cpu/tests/functional/custom/single_layer_tests/instances/x64/pooling.cpp b/src/plugins/intel_cpu/tests/functional/custom/single_layer_tests/instances/x64/pooling.cpp index cfe29692f8414c..6b9e9d3718f556 100644 --- a/src/plugins/intel_cpu/tests/functional/custom/single_layer_tests/instances/x64/pooling.cpp +++ b/src/plugins/intel_cpu/tests/functional/custom/single_layer_tests/instances/x64/pooling.cpp @@ -17,9 +17,8 @@ namespace { const auto ref = CPUSpecificParams{{}, {}, {"ref_any"}, "ref_any"}; const auto avx512 = CPUSpecificParams{{}, {}, {"jit_avx512"}, "jit_avx512"}; const auto avx = CPUSpecificParams{{}, {}, {"jit_avx"}, "jit_avx"}; -const auto sse42 = CPUSpecificParams{{}, {}, {"jit_sse42"}, "jit_sse42"}; -const std::vector vecCpuConfigs = {sse42, avx, avx512}; +const std::vector vecCpuConfigs = {avx, avx512}; const std::vector paramsMaxV84D_ref = { maxPoolV8SpecificParams{ {2, 2}, {2, 2}, {2, 2}, {0, 0}, {0, 0}, @@ -50,13 +49,9 @@ const auto avx2_nwc = CPUSpecificParams{{nwc}, {nwc}, {"jit_avx2"}, "jit_avx2"}; const auto avx2_nhwc = CPUSpecificParams{{nhwc}, {nhwc}, {"jit_avx2"}, "jit_avx2"}; const auto avx2_ndhwc = CPUSpecificParams{{ndhwc}, {ndhwc}, {"jit_avx2"}, "jit_avx2"}; -const auto sse42_nwc = CPUSpecificParams{{nwc}, {nwc}, {"jit_sse42"}, "jit_sse42"}; -const auto sse42_nhwc = CPUSpecificParams{{nhwc}, {nhwc}, {"jit_sse42"}, "jit_sse42"}; -const auto sse42_ndhwc = CPUSpecificParams{{ndhwc}, {ndhwc}, {"jit_sse42"}, "jit_sse42"}; - -const std::vector vecCpuConfigsFusing_3D = {sse42_nwc, avx2_nwc, avx512_nwc}; -const std::vector vecCpuConfigsFusing_4D = {sse42_nhwc, avx2_nhwc, avx512_nhwc}; -const std::vector vecCpuConfigsFusing_5D = {sse42_ndhwc, avx2_ndhwc, avx512_ndhwc}; +const std::vector vecCpuConfigsFusing_3D = {avx2_nwc, avx512_nwc}; +const std::vector vecCpuConfigsFusing_4D = {avx2_nhwc, avx512_nhwc}; +const std::vector vecCpuConfigsFusing_5D = {avx2_ndhwc, avx512_ndhwc}; std::vector fusingParamsSet { emptyFusingSpec, diff --git a/src/plugins/intel_cpu/tests/functional/custom/single_layer_tests/instances/x64/softmax.cpp b/src/plugins/intel_cpu/tests/functional/custom/single_layer_tests/instances/x64/softmax.cpp index 2a22f629c29661..9f7938310d788f 100644 --- a/src/plugins/intel_cpu/tests/functional/custom/single_layer_tests/instances/x64/softmax.cpp +++ b/src/plugins/intel_cpu/tests/functional/custom/single_layer_tests/instances/x64/softmax.cpp @@ -17,8 +17,7 @@ namespace { const auto optimizedCPUSpec = []()-> std::vector{ const auto avx512 = CPUSpecificParams{{}, {}, {"jit"}, "jit_avx512"}; const auto avx2 = CPUSpecificParams{{}, {}, {"jit"}, "jit_avx2"}; - const auto sse42 = CPUSpecificParams{{}, {}, {"jit"}, "jit_sse42"}; - const std::vector vecCpuConfigs = {avx512, avx2, sse42}; + const std::vector vecCpuConfigs = {avx512, avx2}; auto supportConfigure = CPUTestUtils::filterCPUInfoForDevice(vecCpuConfigs); // only the MAX ISA of vecCpuConfigs will be tested if (supportConfigure.size() > 0) { diff --git a/src/plugins/intel_cpu/tests/functional/custom/subgraph_tests/src/classes/eltwise_chain.cpp b/src/plugins/intel_cpu/tests/functional/custom/subgraph_tests/src/classes/eltwise_chain.cpp index 760f9ccd6214cf..9ff85a02db4495 100644 --- a/src/plugins/intel_cpu/tests/functional/custom/subgraph_tests/src/classes/eltwise_chain.cpp +++ b/src/plugins/intel_cpu/tests/functional/custom/subgraph_tests/src/classes/eltwise_chain.cpp @@ -1,4 +1,4 @@ -// Copyright (C) 2018-2023 Intel Corporation +// Copyright (C) 2018-2025 Intel Corporation // SPDX-License-Identifier: Apache-2.0 // diff --git a/src/plugins/intel_cpu/tests/functional/custom/subgraph_tests/src/classes/eltwise_chain.hpp b/src/plugins/intel_cpu/tests/functional/custom/subgraph_tests/src/classes/eltwise_chain.hpp index 17954b438abd73..885435ba8c2dc3 100644 --- a/src/plugins/intel_cpu/tests/functional/custom/subgraph_tests/src/classes/eltwise_chain.hpp +++ b/src/plugins/intel_cpu/tests/functional/custom/subgraph_tests/src/classes/eltwise_chain.hpp @@ -1,4 +1,4 @@ -// Copyright (C) 2018-2023 Intel Corporation +// Copyright (C) 2018-2025 Intel Corporation // SPDX-License-Identifier: Apache-2.0 // diff --git a/src/plugins/intel_cpu/tests/functional/custom/subgraph_tests/src/common/conv_concat.cpp b/src/plugins/intel_cpu/tests/functional/custom/subgraph_tests/src/common/conv_concat.cpp index 22b94d369c5d8f..2825a3528baf6b 100644 --- a/src/plugins/intel_cpu/tests/functional/custom/subgraph_tests/src/common/conv_concat.cpp +++ b/src/plugins/intel_cpu/tests/functional/custom/subgraph_tests/src/common/conv_concat.cpp @@ -50,7 +50,6 @@ namespace ConvolutionConact { /* ============= Convolution (2D) ============= */ const std::vector CPUParams2D = { - conv_ref_2D_nspc, conv_gemm_2D }; @@ -66,7 +65,6 @@ INSTANTIATE_TEST_SUITE_P(smoke_Convolution2D, ConvConcatSubgraphTest, params2D, /* ============= Convolution (3D) ============= */ const std::vector CPUParams3D = { - conv_ref_3D_nspc, conv_gemm_3D }; @@ -86,7 +84,6 @@ namespace GroupConvolutionConcat { /* ============= GroupConvolution (2D) ============= */ const std::vector CPUParams2D = { - conv_ref_2D_nspc, conv_gemm_2D }; @@ -102,7 +99,6 @@ INSTANTIATE_TEST_SUITE_P(smoke_GroupConvolution2D, ConvConcatSubgraphTest, param /* ============= GroupConvolution (3D) ============= */ const std::vector CPUParams3D = { - conv_ref_3D_nspc, conv_gemm_3D }; diff --git a/src/plugins/intel_cpu/tests/functional/custom/subgraph_tests/src/common/index_add_scatter_elements_update.cpp b/src/plugins/intel_cpu/tests/functional/custom/subgraph_tests/src/common/index_add_scatter_elements_update.cpp index 0b8086b48a1110..388d7050851e05 100644 --- a/src/plugins/intel_cpu/tests/functional/custom/subgraph_tests/src/common/index_add_scatter_elements_update.cpp +++ b/src/plugins/intel_cpu/tests/functional/custom/subgraph_tests/src/common/index_add_scatter_elements_update.cpp @@ -1,4 +1,4 @@ -// Copyright (C) 2018-2023 Intel Corporation +// Copyright (C) 2018-2025 Intel Corporation // SPDX-License-Identifier: Apache-2.0 // diff --git a/src/plugins/intel_cpu/tests/functional/custom/subgraph_tests/src/common/inplace_resolve_io.cpp b/src/plugins/intel_cpu/tests/functional/custom/subgraph_tests/src/common/inplace_resolve_io.cpp index 2d7442f945630f..26e9e9d59dbec2 100644 --- a/src/plugins/intel_cpu/tests/functional/custom/subgraph_tests/src/common/inplace_resolve_io.cpp +++ b/src/plugins/intel_cpu/tests/functional/custom/subgraph_tests/src/common/inplace_resolve_io.cpp @@ -1,4 +1,4 @@ -// Copyright (C) 2018-2023 Intel Corporation +// Copyright (C) 2018-2025 Intel Corporation // SPDX-License-Identifier: Apache-2.0 // diff --git a/src/plugins/intel_cpu/tests/functional/custom/subgraph_tests/src/common/merge_transpose_reorder.cpp b/src/plugins/intel_cpu/tests/functional/custom/subgraph_tests/src/common/merge_transpose_reorder.cpp index 81686bd5cd4888..15d4dbc3786ccd 100644 --- a/src/plugins/intel_cpu/tests/functional/custom/subgraph_tests/src/common/merge_transpose_reorder.cpp +++ b/src/plugins/intel_cpu/tests/functional/custom/subgraph_tests/src/common/merge_transpose_reorder.cpp @@ -1,4 +1,4 @@ -// Copyright (C) 2018-2023 Intel Corporation +// Copyright (C) 2018-2025 Intel Corporation // SPDX-License-Identifier: Apache-2.0 // diff --git a/src/plugins/intel_cpu/tests/functional/custom/subgraph_tests/src/x64/conv_concat.cpp b/src/plugins/intel_cpu/tests/functional/custom/subgraph_tests/src/x64/conv_concat.cpp index 1fdbd5016099e1..3d7ec525c0a105 100644 --- a/src/plugins/intel_cpu/tests/functional/custom/subgraph_tests/src/x64/conv_concat.cpp +++ b/src/plugins/intel_cpu/tests/functional/custom/subgraph_tests/src/x64/conv_concat.cpp @@ -20,7 +20,6 @@ namespace Kernel_1x1 { /* ============= Kernel_1x1 (2D) ============= */ const std::vector CPUParams2DConv = { - conv_sse42_2D_1x1, conv_avx2_2D_1x1, conv_avx512_2D_1x1 }; @@ -84,7 +83,6 @@ commonConvParams dwConvParams2D = commonConvParams{kernelSize2D(), strides2D(), numOutChannels(), paddingType(), numOutChannels()}; const ov::Shape inputShapesDW2D{1, 32, 16, 16}; const std::vector CPUParams2D = { - conv_sse42_dw_2D, conv_avx2_dw_2D, conv_avx512_dw_2D }; @@ -104,7 +102,6 @@ commonConvParams dwConvParams3D = commonConvParams{kernelSize3D(), strides3D(), numOutChannels(), paddingType(), numOutChannels()}; const ov::Shape inputShapesDW3D{1, 32, 8, 16, 16}; const std::vector CPUParams3D = { - conv_sse42_dw_3D, conv_avx2_dw_3D, conv_avx512_dw_3D }; @@ -158,8 +155,6 @@ INSTANTIATE_TEST_SUITE_P(smoke_ConvolutionBackpropData3D, ConvConcatSubgraphTest namespace ConvolutionConcat { /* ============= Convolution (2D) ============= */ const std::vector CPUParams2D = { - conv_ref_2D, - conv_sse42_2D, conv_avx2_2D, conv_avx512_2D }; @@ -176,7 +171,6 @@ INSTANTIATE_TEST_SUITE_P(smoke_Convolution2D, ConvConcatSubgraphTest, params2D, /* ============= Convolution (3D) ============= */ const std::vector CPUParams3D = { - conv_ref_3D, conv_avx2_3D, conv_avx512_3D }; @@ -195,8 +189,6 @@ INSTANTIATE_TEST_SUITE_P(smoke_Convolution3D, ConvConcatSubgraphTest, params3D, namespace GroupConvolutionConcat { /* ============= GroupConvolution (2D) ============= */ const std::vector CPUParams2D = { - conv_ref_2D, - conv_sse42_2D, conv_avx2_2D, conv_avx512_2D }; @@ -213,7 +205,6 @@ INSTANTIATE_TEST_SUITE_P(smoke_GroupConvolution2D, ConvConcatSubgraphTest, param /* ============= GroupConvolution (3D) ============= */ const std::vector CPUParams3D = { - conv_ref_3D, conv_avx2_3D, conv_avx512_3D }; @@ -255,4 +246,4 @@ INSTANTIATE_TEST_SUITE_P(smoke_GroupConvolutionBackpropData3D, ConvConcatSubgrap } // namespace GroupConvolutionBackpropDataConcat } // namespace test -} // namespace ov \ No newline at end of file +} // namespace ov diff --git a/src/plugins/intel_cpu/tests/functional/custom/subgraph_tests/src/x64/convert_fq_rnn_to_quantized_rnn.cpp b/src/plugins/intel_cpu/tests/functional/custom/subgraph_tests/src/x64/convert_fq_rnn_to_quantized_rnn.cpp index 2da18851bd0031..9166f70660ee3c 100644 --- a/src/plugins/intel_cpu/tests/functional/custom/subgraph_tests/src/x64/convert_fq_rnn_to_quantized_rnn.cpp +++ b/src/plugins/intel_cpu/tests/functional/custom/subgraph_tests/src/x64/convert_fq_rnn_to_quantized_rnn.cpp @@ -1,4 +1,4 @@ -// Copyright (C) 2018-2022 Intel Corporation +// Copyright (C) 2018-2025 Intel Corporation // SPDX-License-Identifier: Apache-2.0 // diff --git a/src/plugins/intel_cpu/tests/functional/custom/subgraph_tests/src/x64/matmul_weights_decompression.cpp b/src/plugins/intel_cpu/tests/functional/custom/subgraph_tests/src/x64/matmul_weights_decompression.cpp index e2e04501368ac7..1ac681b3b6eff2 100644 --- a/src/plugins/intel_cpu/tests/functional/custom/subgraph_tests/src/x64/matmul_weights_decompression.cpp +++ b/src/plugins/intel_cpu/tests/functional/custom/subgraph_tests/src/x64/matmul_weights_decompression.cpp @@ -211,6 +211,11 @@ const std::vector input_shapes_basic_dyn_quant = }; const std::vector weights_precisions_dyn_quant = {ov::element::u8, ov::element::u4}; +const std::vector fusing_params_dyn_quant{ + emptyFusingSpec, + fusingBias, // bias is hanlded in separate code-path with post-ops + fusingSwish // max amount of post-op regs (which reduces available accum regs) +}; std::vector filter_additional_config_dyn_quant() { std::vector additional_config = { @@ -232,7 +237,7 @@ INSTANTIATE_TEST_SUITE_P(smoke_MatMulCompressedWeights_non_default_dyn_quant_gro ::testing::ValuesIn(decompression_subtract_type), ::testing::Values(false), ::testing::ValuesIn(filter_additional_config_dyn_quant()), - ::testing::ValuesIn(fusing_params), + ::testing::ValuesIn(fusing_params_dyn_quant), ::testing::Values(true)), MatmulWeightsDecompression::getTestCaseName); @@ -249,7 +254,7 @@ INSTANTIATE_TEST_SUITE_P(smoke_MatMulCompressedWeights_sym_non_default_dyn_quant ::testing::Values(DecompressionType::empty), ::testing::Values(false), ::testing::ValuesIn(filter_additional_config_dyn_quant()), - ::testing::ValuesIn(fusing_params), + ::testing::ValuesIn(fusing_params_dyn_quant), ::testing::Values(true)), MatmulWeightsDecompression::getTestCaseName); @@ -265,7 +270,7 @@ INSTANTIATE_TEST_SUITE_P(smoke_MatMulCompressedWeights_mxfp4, // todo: zero points converted to fp32 for reshape == true case ::testing::Values(false), ::testing::ValuesIn(filter_additional_config_basic()), - ::testing::ValuesIn(fusing_params), + ::testing::ValuesIn(fusing_params_dyn_quant), ::testing::Values(true)), MatmulWeightsDecompression::getTestCaseName); diff --git a/src/plugins/intel_cpu/tests/functional/custom/subgraph_tests/src/x64/memory_sharing_test.cpp b/src/plugins/intel_cpu/tests/functional/custom/subgraph_tests/src/x64/memory_sharing_test.cpp index 2b9214c4c22cd0..36f9b0f1e50a65 100644 --- a/src/plugins/intel_cpu/tests/functional/custom/subgraph_tests/src/x64/memory_sharing_test.cpp +++ b/src/plugins/intel_cpu/tests/functional/custom/subgraph_tests/src/x64/memory_sharing_test.cpp @@ -33,8 +33,6 @@ TEST_F(EdgeWithSameNameInTwoModels, smoke_CompareWithRef) { std::tie(inFmts, outFmts, priority, selectedType) = conv_avx512_2D; } else if (ov::with_cpu_x86_avx2()) { std::tie(inFmts, outFmts, priority, selectedType) = conv_avx2_2D; - } else if (ov::with_cpu_x86_sse42()) { - std::tie(inFmts, outFmts, priority, selectedType) = conv_sse42_2D; } // first model diff --git a/src/plugins/intel_cpu/tests/functional/shared_tests_instances/behavior/compiled_model/cpu_reservation_test.cpp b/src/plugins/intel_cpu/tests/functional/shared_tests_instances/behavior/compiled_model/cpu_reservation_test.cpp index 78ee401d169cbb..87a19ede785eba 100644 --- a/src/plugins/intel_cpu/tests/functional/shared_tests_instances/behavior/compiled_model/cpu_reservation_test.cpp +++ b/src/plugins/intel_cpu/tests/functional/shared_tests_instances/behavior/compiled_model/cpu_reservation_test.cpp @@ -1,4 +1,4 @@ -// Copyright (C) 2018-2024 Intel Corporation +// Copyright (C) 2018-2025 Intel Corporation // SPDX-License-Identifier: Apache-2.0 // diff --git a/src/plugins/intel_cpu/tests/functional/shared_tests_instances/behavior/ov_infer_request/inference.cpp b/src/plugins/intel_cpu/tests/functional/shared_tests_instances/behavior/ov_infer_request/inference.cpp index 50f6d09b4271d2..558896557dd58d 100644 --- a/src/plugins/intel_cpu/tests/functional/shared_tests_instances/behavior/ov_infer_request/inference.cpp +++ b/src/plugins/intel_cpu/tests/functional/shared_tests_instances/behavior/ov_infer_request/inference.cpp @@ -1,4 +1,4 @@ -// Copyright (C) 2018-2021 Intel Corporation +// Copyright (C) 2018-2025 Intel Corporation // SPDX-License-Identifier: Apache-2.0 // diff --git a/src/plugins/intel_cpu/tests/functional/shared_tests_instances/low_precision_transformations/x64/gather_transformation.cpp b/src/plugins/intel_cpu/tests/functional/shared_tests_instances/low_precision_transformations/x64/gather_transformation.cpp index 1cbd7152fbccfb..ba70b281461308 100644 --- a/src/plugins/intel_cpu/tests/functional/shared_tests_instances/low_precision_transformations/x64/gather_transformation.cpp +++ b/src/plugins/intel_cpu/tests/functional/shared_tests_instances/low_precision_transformations/x64/gather_transformation.cpp @@ -1,4 +1,4 @@ -// Copyright (C) 2018-2022 Intel Corporation +// Copyright (C) 2018-2025 Intel Corporation // SPDX-License-Identifier: Apache-2.0 // diff --git a/src/plugins/intel_cpu/tests/functional/shared_tests_instances/skip_tests_config.cpp b/src/plugins/intel_cpu/tests/functional/shared_tests_instances/skip_tests_config.cpp index 44bf87a9a37b82..4eb4fa819e3224 100644 --- a/src/plugins/intel_cpu/tests/functional/shared_tests_instances/skip_tests_config.cpp +++ b/src/plugins/intel_cpu/tests/functional/shared_tests_instances/skip_tests_config.cpp @@ -189,44 +189,13 @@ std::vector disabledTestPatterns() { R"(smoke_LPT/ConvolutionTransformation.CompareWithRefImpl/f32_\[.*,3,16,16\]_CPU_f32_rank=4D_fq_on_data=\{level=256_shape=\[1\]_input_low=\{ 0 \}_input_high=\{ 255 \}_output_low=\{ .*18.7 \}_output_high\{ 18.8 \}_precision=\}_fq_on_weights=\{_255_\[6,1,1,1\]_\{ .*1.52806e.*39, .*0.2, .*0.3, .*0.3, .*0.2, .*0.1 \}_\{ 1.52806e.*39, 0.2, 0.3, 0.3, 0.2, 0.1 \}\})", // TODO: 141068 R"(smoke_Snippets_FQDecomposition.*netPRC=f16_D=CPU.*)", - // Issue: 133173 - R"(.*smoke_ScaledAttn_CPU/ScaledAttnLayerCPUTest.CompareWithRefs/netPRC=bf16.*has_scale=0.*)", - R"(.*smoke_LPT_4D/ConvolutionBackpropDataTransformation.CompareWithRefImpl/f32_\[1,8,16,16\]_CPU_f32_\[16,16\]_level=256_shape=\[.*\]_input_low=\{ 0 \}_input_high=\{ 25.5 \}_output_low=\{ 0 \}_output_high\{ 25.5 \}_precision=__255_\[.*\]_\{ -12.7 \}_\{ 12.7 \}_\{\}.*)", - R"(.*smoke_LPT_4D/ConvolutionBackpropDataTransformation.CompareWithRefImpl/f32_\[1,8,16,16\]_CPU_f32_\[16,16\]_level=256_shape=\[1,1,1,1\]_input_low=\{ 0 \}_input_high=\{ 255 \}_output_low=\{ -12.7 \}_output_high\{ 12.8 \}_precision=.*)", - R"(.*smoke_LPT_3D/ConvolutionBackpropDataTransformation.CompareWithRefImpl/f32_\[1,8,16\]_CPU_f32_\[16\]_.*_input_high=\{ 25.5 \}_.*_precision=__255_\[1,1,1\]_\{ -12.7 \}_\{ 12.7 \}_\{\}.*)", + // Issue: 160737 R"(.*smoke_LPT/ConvolutionQDqTransformation.CompareWithRefImpl/f32_\[(1,3,4,4|4,3,4,4)\]_CPU_f32_level=256_shape=\[1,1,1,1\]_input_low=\{ -12.8 \}_input_high=\{ 12.7 \}_output_low=\{ 0 \}_output_high=\{ 255 \}_precision=f32__u8___f32__.*_f32_\[\]_1_1_undefined__\{, 15\}_f32_\[\]__255_\[1,1,1,1\]_\{ -128 \}_\{ 127 \}__i8___f32__\{ -128 \}_.*_1_1_i8_.*)", - R"(.*smoke_LPT/ConvolutionQDqTransformation.CompareWithRefImpl/f32_\[(1,3,4,4|4,3,4,4)\]_CPU_f32_level=256_shape=\[1,1,1,1\]_input_low=\{ -12.8 \}_input_high=\{ 12.7 \}_output_low=\{ 0 \}_output_high=\{ 255 \}_precision=f32__u8___f32_\{\}__\{ 0.1 \}_f32_\[\]_1_1_undefined__\{, 15\}_f32_\[\]__255_\[1,1,1,1\]_\{ -128 \}_\{ 127 \}__i8_.*)", - R"(.*smoke_LPT/MultiplyTransformation.CompareWithRefImpl/f32_\[1,3,16,16\]_CPU_f32_undefined__on_branch1_0_2.55_0_2.55_on_branch2_-1.28_1.27_-1.28_1.27_1.*)", - R"(.*smoke_LPT/MultiplyTransformation.CompareWithRefImpl/f32_\[1,3,16,16\]_CPU_f32_broadcast1_undefined__on_branch1_-1.28_1.27_-1.28_1.27_on_branch2_0_2.55_0_2.55_0.*)", - R"(.*smoke_LPT/MultiplyTransformation.CompareWithRefImpl/f32_\[1,3,16,16\]_CPU_f32_broadcast2_undefined__on_branch1_0_2.55_0_2.55_on_branch2_-1.27_1.28_-1.27_1.28_0.*)", - R"(.*smoke_LPT/ConvolutionTransformation.CompareWithRefImpl/f32_\[(1|4),3,16,16\]_CPU_f32_rank=4D_fq_on_data=\{level=256_shape=\[1\]_input_low=\{ 0 \}_input_high=\{ 255 \}_output_low=\{ -18.7 \}_output_high\{ 18.8 \}_precision=\}_fq_on_weights=\{_255_\[1\]_\{ -18.7 \}_\{ 18.7 \}\}.*)", - R"(.*smoke_LPT/ConvolutionTransformation.CompareWithRefImpl/f32_\[(1|4),3,16,16\]_CPU_f32_rank=4D_fq_on_data=\{level=256_shape=\[1\]_input_low=\{ 0 \}_input_high=\{ 255 \}_output_low=\{ -18.7 \}_output_high\{ 18.8 \}_precision=\}_fq_on_weights=\{_255_\[6,1,1,1\].*)", - R"(.*smoke_LPT/RecurrentCellTransformation.CompareWithRefImpl/f32_\[1,2,16\]_CPU_f32FQ_X_level=256_.*_FQ_W_level=255.*)", - R"(.*smoke_LPT/SubtractTransformation.CompareWithRefImpl/f16_\[1,3,16,16\]_CPU_f32.*)", - R"(.*smoke_LPT/FakeQuantizeTransformation.CompareWithRefImpl/f32_\[1,32,72,48\]_CPU_f32_0_level=65536_shape=\[\]_input_low=\{ 0 \}_input_high=\{ 65.535 \}_output_low=\{ 0 \}_output_high=\{ 65.535 \}_precision=.*)", - R"(.*smoke_LPT/FakeQuantizeTransformation.CompareWithRefImpl/f32_\[1,32,72,48\]_CPU_f32_0_level=65536_shape=\[\]_input_low=\{ -32.768 \}_input_high=\{ 32.767 \}_output_low=\{ -32.768 \}_output_high=\{ 32.767 \}_precision=.*)", - R"(.*smoke_LPT/MoveFakeQuantizeTransformation.CompareWithRefImpl/f32_\[(1|4),1,16,16\]_CPU_f32SPLIT:0_OP:_FQ:level=256_shape=\[\]_input_low=\{ (0|-1.28) \}_input_high=\{ (2.55|1.27) \}_output_low=\{ (0|-1.28) \}_output_high=\{ (2.55|255|1.27) \}_precision=_DQ:.*)", - R"(.*smoke_LPT/MoveFakeQuantizeTransformation.CompareWithRefImpl/f32_\[(1|4),1,16,16\]_CPU_f32SPLIT:0_OP:relu_FQ:level=256_shape=\[\]_input_low=\{ 0 \}_input_high=\{ 2.55 \}_output_low=\{ 0 \}_output_high=\{ 255 \}_precision=_DQ:__f32_\{\}__\{ 0.01 \}_undefined_\[\]_0_1_undefined.*)", - R"(.*smoke_LPT/MoveFakeQuantizeTransformation.CompareWithRefImpl/f32_\[(1|4),1,16,16\]_CPU_f32SPLIT:0_OP:relu_FQ:level=256_shape=\[1,6,1,1\]_input_low=\{ 0, 0, 0, 0, 0, 0 \}_input_high=\{ 2.55, 1.275, 0.85, 0.6375, 0.51, 0.425 \}_output_low=\{ -128, -128, -128, -128, -128, -128 \}_output_high=\{ 127, 127, 127, 127, 127, 127 \}_precision=_DQ:\{\}.*)", - R"(.*smoke_LPT/MoveFakeQuantizeTransformation.CompareWithRefImpl/f32_\[(1|4),1,16,16\]_CPU_f32SPLIT:(0|1)_OP:_FQ:level=256_shape=\[1,6,1,1\]_input_low=\{ 0, 0, 0, 0, 0, 0 \}_input_high=\{ 2.55, 1.275, 0.85, 0.6375, 0.51, 0.425 \}_output_low=\{ 0, 0, 0, 0, 0, 0 \}_output_high=\{ 255, 127.5, 85, 63.75, 51, 42.5 \}_precision=_DQ:__f32_.*)", - R"(.*smoke_LPT/EliminateFakeQuantizeTransformation.CompareWithRefImpl/CPU_f32_level=256_shape=\[\]_input_low=\{ 0 \}_input_high=\{ 127.5 \}_output_low=\{ 0 \}_output_high\{ 127.5 \}_precision=f32_level=256_shape=\[\]_input_low=\{ 0 \}_input_high=\{ (127.5|121.429) \}_output_low=\{ 0 \}_output_high\{ (127.5|121.429) \}_precision=f32.*)", - R"(.*smoke_LPT/MatMulWithOptimizedConstantFq.CompareWithRefImpl/f32_\[1,16\]_\[(10|16),(10|16)\]_CPU_level=256_shape=\[1\]_input_low=\{ 0 \}_input_high=\{ 25.5 \}_output_low=\{ 0 \}_output_high\{ 25.5 \}_precision=_level=255_shape=\[1\]_input_low=\{ -12.7 \}_input_high=\{ 12.7 \}_output_low=\{ -12.7 \}_output_high\{ 12.7 \}_precision=.*)", - R"(.*smoke_LPT/FuseDequantizeToFakeQuantizeTransformation.CompareWithRefImpl/CPU_f32_0_undefined_\[\]_f32__\{\}_\{\}__\{ (0.01|0.01, 0.1, 1) \}_.*)", - R"(.*smoke_LPT/GroupConvolutionTransformation.CompareWithRefImpl/f32_\[1,6,24,24\]_CPU_f32_4D_\[1,6,24,24\]_\[1,24,18,18\]_3_-1_level=256_shape=\[1,1,1,1\]_input_low=\{ 0 \}_input_high=\{ 25.5 \}_output_low=\{ 0 \}_output_high\{ 25.5 \}_precision=_wo_reshape__255_\[3,8,1,1,1\]_\{ -127 \}_\{ 127 \}.*)", - R"(.*smoke_LPT/GroupConvolutionTransformation.CompareWithRefImpl/f32_\[1,6,24(,24)*\]_CPU_f32_(3D|4D)_\[1,6,24(,24)*\]_\[1,24,18(,18)*\]_3_-1_level=256_shape=\[1,1,1.*\]_input_low=\{ 0 \}_input_high=\{ 25.5 \}_output_low=\{ 0 \}_output_high\{ 25.5 \}_precision=_wo_reshape__255_\[3,8,1,1(,1)*\]_\{ -127, -12.7, -1.27,.*)", - R"(.*smoke_LPT/GroupConvolutionTransformation.CompareWithRefImpl/f32_\[1,6,1,24,24\]_CPU_f32_5D_\[1,6,1,24,24\]_\[1,24,1,18,18\]_3_-1_level=256_shape=\[1,1,1,1,1\]_input_low=\{ -12.8 \}_input_high=\{ 12.7 \}_output_low=\{ -12.8 \}_output_high\{ 12.7 \}_precision=_reshape_on_weights__255_\[1,1,1,1,1\]_\{ -127 \}_\{ 127 \}.*)", - R"(.*smoke_LPT/GroupConvolutionTransformation.CompareWithRefImpl/f32_\[1,24,8,12,12\]_CPU_f32_5D_\[1,24,8,12,12\]_\[1,24,1,1,1\]_3_-1_level=256_shape=\[1,1,1,1,1\]_input_low=\{ -12.8 \}_input_high=\{ 12.7 \}_output_low=\{ -12.8 \}_output_high\{ 12.7 \}_precision=_reshape_on_weights__255_\[1,1,1,1,1\]_\{ -127 \}_\{ 127 \}.*)", R"(.*smoke_LPT/GroupConvolutionQDqTransformation.CompareWithRefImpl/f32_\[1,6,24,24\]_CPU_f32_level=256_shape=\[1,1,1,1\]_input_low=\{ -12.8 \}_input_high=\{ 12.7 \}_output_low=\{ 0 \}_output_high=\{ 255 \}_precision=f32__u8___f32_.*_undefinedoutput_original_f32_multiplyAfter=(false|true).*)", - R"(.*smoke_LPT/GroupConvolutionQDqTransformation.CompareWithRefImpl/f32_\[1,6,24,24\]_CPU_f32_level=256_.*_precision=f32__u8___f32_\{\}__\{ 0.1 \}.*_f32_\[6,2,5,5\]__255_\[1,1,1,1\]_\{ -128 \}_\{ 127 \}__i8.*undefinedoutput_original_u8_multiplyAfter=(false|true).*)", - R"(.*smoke_LPT/MatMulWithConstantTransformation.CompareWithRefImpl/\[(2,3,4|1,1,3,4)\]_f32_CPU_.*_shape=\[1,1,1\]_input_low=\{ 0 \}_input_high=\{ 255 \}_output_low=\{ 0, 0, 0 \}_output_high=\{ 255, 25.5, 255 \}_precision=_level=256_shape=\[1\]_input_low=\{ -128 \}_.*)", - R"(.*smoke_LPT/ReduceSumTransformation.CompareWithRefImpl/f32_\[1,3,10,10\]_CPU_f32_level=256_shape=\[1,1,1,1\]_input_low=\{ 0 \}_input_high=\{ 255 \}_output_low=\{ 0 \}_output_high\{ 127 \}_precision=_keepDims__reduce_axis_2_3_.*)", - R"(.*smoke_TestsDFT_3d/DFTLayerTest.Inference/.*TS=.*10.4.20.32.2.*_Precision=bf16.*)", - R"(.*smoke_TestsDFT_3d/DFTLayerTest.Inference/.*TS=.*2.5.7.8.2.*_Precision=bf16.*)", - R"(.*smoke_TestsDFT_3d/DFTLayerTest.Inference/.*TS=.*1.120.128.1.2.*_Precision=bf16.*_signal_size=\(\).*)", - R"(.*smoke_TestsDFT_4d/DFTLayerTest.Inference/.*2.5.7.8.2.*Precision=bf16.*signal_size=\(\).*)", + // Issue: 160734 + R"(.*smoke_LPT/ConvolutionTransformation.CompareWithRefImpl/f32_\[(1|4),3,16,16\]_CPU_f32_rank=4D_fq_on_data=\{level=256_shape=\[1\]_input_low=\{ 0 \}_input_high=\{ 255 \}_output_low=\{ -18.7 \}_output_high\{ 18.8 \}_precision=\}_fq_on_weights=\{_255_\[1\]_\{ -18.7 \}_\{ 18.7 \}\}.*)", + // Issue: 160735 R"(.*smoke_TestsDFT_4d/DFTLayerTest.Inference/.*TS=\{\((10.4.20.32.2|1.120.128.1.2)\)\}.*Precision=f32.*signal_size=\(\).*)", - R"(.*smoke_TestsDFT_4d/DFTLayerTest.Inference/.*1.120.128.1.2.*Precision=bf16.*signal_size=\(\).*)", - R"(.*smoke_TestsDFT_2d/DFTLayerTest.Inference/.*TS.*1.120.128.1.2.*Precision=bf16_Axes=\(2.1\)_signal_size=\(\).*)", // by calc abs_threshold with expected value R"(.*smoke_.*_4D.*/GatherLayerTestCPU.CompareWithRefs.*INFERENCE_PRECISION_HINT=bf16.*)", R"(.*smoke.*Mvn6LayerTest.Inference/.*TS.*1.10.5.7.8.*_ModelType=f32.*_Ax=\((2.3.4|-3.-2.-1)\).*)", diff --git a/src/plugins/intel_cpu/tests/functional/shared_tests_instances/snippets/mha_wo_transpose.cpp b/src/plugins/intel_cpu/tests/functional/shared_tests_instances/snippets/mha_wo_transpose.cpp index 0967ef27087674..c6b11f48efa24c 100644 --- a/src/plugins/intel_cpu/tests/functional/shared_tests_instances/snippets/mha_wo_transpose.cpp +++ b/src/plugins/intel_cpu/tests/functional/shared_tests_instances/snippets/mha_wo_transpose.cpp @@ -44,6 +44,11 @@ std::vector> originalShape_3D { {PartialShape{2, -1, 64}, {{2, 9, 64}, {2, 4, 64}, {2, 9, 64}}}, {PartialShape{2, 64, -1}, {{2, 64, 9}, {2, 64, 4}, {2, 64, 9}}}, {PartialShape{2, -1, 64}, {{2, 9, 64}, {2, 4, 64}, {2, 9, 64}}}, + }, + { + {PartialShape{-1, 128, 64}, {{1, 128, 64}, {2, 128, 64}, {1, 128, 64}}}, + {PartialShape{-1, 64, 128}, {{1, 64, 128}, {2, 64, 128}, {1, 64, 128}}}, + {PartialShape{-1, 128, 64}, {{1, 128, 64}, {2, 128, 64}, {1, 128, 64}}}, } }; diff --git a/src/plugins/intel_cpu/tests/functional/utils/convolution_params.hpp b/src/plugins/intel_cpu/tests/functional/utils/convolution_params.hpp index 6fc3a8ab9382d4..941a4274598de7 100644 --- a/src/plugins/intel_cpu/tests/functional/utils/convolution_params.hpp +++ b/src/plugins/intel_cpu/tests/functional/utils/convolution_params.hpp @@ -7,14 +7,6 @@ #include "cpu_test_utils.hpp" namespace CPUTestUtils { - const auto conv_ref_1D = CPUSpecificParams{{ncw}, {ncw}, {"ref_any"}, "ref_any"}; - const auto conv_ref_2D = CPUSpecificParams{{nchw}, {nchw}, {"ref_any"}, "ref_any"}; - const auto conv_ref_3D = CPUSpecificParams{{ncdhw}, {ncdhw}, {"ref_any"}, "ref_any"}; - - const auto conv_ref_1D_nspc = CPUSpecificParams{{nwc}, {nwc}, {"ref_any"}, "ref_any"}; - const auto conv_ref_2D_nspc = CPUSpecificParams{{nhwc}, {nhwc}, {"ref_any"}, "ref_any"}; - const auto conv_ref_3D_nspc = CPUSpecificParams{{ndhwc}, {ndhwc}, {"ref_any"}, "ref_any"}; - const auto conv_gemm_1D = CPUSpecificParams{{ncw}, {ncw}, {"jit_gemm"}, "jit_gemm"}; const auto conv_gemm_2D = CPUSpecificParams{{nchw}, {nchw}, {"jit_gemm"}, "jit_gemm"}; const auto conv_gemm_3D = CPUSpecificParams{{ncdhw}, {ncdhw}, {"jit_gemm"}, "jit_gemm"}; @@ -31,24 +23,6 @@ namespace CPUTestUtils { const auto conv_gemm_acl_2D_nspc = CPUSpecificParams{{nhwc}, {nhwc}, {"gemm_acl"}, "gemm_acl"}; const auto conv_gemm_acl_3D_nspc = CPUSpecificParams{{ndhwc}, {ndhwc}, {"gemm_acl"}, "gemm_acl"}; - const auto conv_sse42_1D = CPUSpecificParams{{nCw8c}, {nCw8c}, {"jit_sse42"}, "jit_sse42"}; - const auto conv_sse42_2D = CPUSpecificParams{{nChw8c}, {nChw8c}, {"jit_sse42"}, "jit_sse42"}; - const auto conv_sse42_3D = CPUSpecificParams{{nCdhw8c}, {nCdhw8c}, {"jit_sse42"}, "jit_sse42"}; - const auto conv_sse42_dw_1D = CPUSpecificParams{{nCw8c}, {nCw8c}, {"jit_sse42_dw"}, "jit_sse42_dw"}; - const auto conv_sse42_dw_2D = CPUSpecificParams{{nChw8c}, {nChw8c}, {"jit_sse42_dw"}, "jit_sse42_dw"}; - const auto conv_sse42_dw_3D = CPUSpecificParams{{nCdhw8c}, {nCdhw8c}, {"jit_sse42_dw"}, "jit_sse42_dw"}; - - const auto conv_sse42_plain_to_blocked_1D = CPUSpecificParams{{ncw}, {nCw8c}, {"jit_sse42"}, "jit_sse42"}; - const auto conv_sse42_plain_to_blocked_2D = CPUSpecificParams{{nchw}, {nChw8c}, {"jit_sse42"}, "jit_sse42"}; - const auto conv_sse42_plain_to_blocked_3D = CPUSpecificParams{{ncdhw}, {nCdhw8c}, {"jit_sse42"}, "jit_sse42"}; - - const auto conv_sse42_1D_nspc = CPUSpecificParams{{nwc}, {nwc}, {"jit_sse42"}, "jit_sse42"}; - const auto conv_sse42_2D_nspc = CPUSpecificParams{{nhwc}, {nhwc}, {"jit_sse42"}, "jit_sse42"}; - const auto conv_sse42_3D_nspc = CPUSpecificParams{{ndhwc}, {ndhwc}, {"jit_sse42"}, "jit_sse42"}; - const auto conv_sse42_dw_1D_nspc = CPUSpecificParams{{nwc}, {nwc}, {"jit_sse42_dw"}, "jit_sse42_dw"}; - const auto conv_sse42_dw_2D_nspc = CPUSpecificParams{{nhwc}, {nhwc}, {"jit_sse42_dw"}, "jit_sse42_dw"}; - const auto conv_sse42_dw_3D_nspc = CPUSpecificParams{{ndhwc}, {ndhwc}, {"jit_sse42_dw"}, "jit_sse42_dw"}; - const auto conv_avx2_1D = CPUSpecificParams{{nCw8c}, {nCw8c}, {"jit_avx2"}, "jit_avx2"}; const auto conv_avx2_2D = CPUSpecificParams{{nChw8c}, {nChw8c}, {"jit_avx2"}, "jit_avx2"}; const auto conv_avx2_3D = CPUSpecificParams{{nCdhw8c}, {nCdhw8c}, {"jit_avx2"}, "jit_avx2"}; @@ -107,22 +81,18 @@ namespace CPUTestUtils { const auto conv_avx512_2D_nspc_brgconv_amx = CPUSpecificParams{{nhwc}, {nhwc}, {"brgconv_avx512_amx"}, "brgconv_avx512_amx"}; const auto conv_avx512_3D_nspc_brgconv_amx = CPUSpecificParams{{ndhwc}, {ndhwc}, {"brgconv_avx512_amx"}, "brgconv_avx512_amx"}; - const auto conv_sse42_1D_1x1 = CPUSpecificParams{{nCw8c}, {nCw8c}, {"jit_sse42_1x1"}, "jit_sse42_1x1"}; const auto conv_avx2_1D_1x1 = CPUSpecificParams{{nCw8c}, {nCw8c}, {"jit_avx2_1x1"}, "jit_avx2_1x1"}; const auto conv_avx512_1D_1x1 = CPUSpecificParams{{nCw16c}, {nCw16c}, {"jit_avx512_1x1"}, "jit_avx512_1x1"}; - const auto conv_sse42_1D_1x1_nspc = CPUSpecificParams{{nwc}, {nwc}, {"jit_sse42_1x1"}, "jit_sse42_1x1"}; const auto conv_avx2_1D_1x1_nspc = CPUSpecificParams{{nwc}, {nwc}, {"jit_avx2_1x1"}, "jit_avx2_1x1"}; const auto conv_avx2_1D_1x1_nspc_brgconv = CPUSpecificParams{{nwc}, {nwc}, {"brgconv_avx2_1x1"}, "brgconv_avx2_1x1"}; const auto conv_avx512_1D_1x1_nspc = CPUSpecificParams{{nwc}, {nwc}, {"jit_avx512_1x1"}, "jit_avx512_1x1"}; const auto conv_avx512_1D_1x1_nspc_brgconv = CPUSpecificParams{{nwc}, {nwc}, {"brgconv_avx512_1x1"}, "brgconv_avx512_1x1"}; const auto conv_avx512_1D_1x1_nspc_brgconv_amx = CPUSpecificParams{{nwc}, {nwc}, {"brgconv_avx512_amx_1x1"}, "brgconv_avx512_amx_1x1"}; - const auto conv_sse42_2D_1x1 = CPUSpecificParams{{nChw8c}, {nChw8c}, {"jit_sse42_1x1"}, "jit_sse42_1x1"}; const auto conv_avx2_2D_1x1 = CPUSpecificParams{{nChw8c}, {nChw8c}, {"jit_avx2_1x1"}, "jit_avx2_1x1"}; const auto conv_avx512_2D_1x1 = CPUSpecificParams{{nChw16c}, {nChw16c}, {"jit_avx512_1x1"}, "jit_avx512_1x1"}; - const auto conv_sse42_2D_1x1_nspc = CPUSpecificParams{{nhwc}, {nhwc}, {"jit_sse42_1x1"}, "jit_sse42_1x1"}; const auto conv_avx2_2D_1x1_nspc = CPUSpecificParams{{nhwc}, {nhwc}, {"jit_avx2_1x1"}, "jit_avx2_1x1"}; const auto conv_avx2_2D_1x1_nspc_brgconv = CPUSpecificParams{{nhwc}, {nhwc}, {"brgconv_avx2_1x1"}, "brgconv_avx2_1x1"}; const auto conv_avx2_3D_1x1_nspc_brgconv = CPUSpecificParams{{ndhwc}, {ndhwc}, {"brgconv_avx2_1x1"}, "brgconv_avx2_1x1"}; diff --git a/src/plugins/intel_cpu/tests/unit/graph/inplace_resolve_io.cpp b/src/plugins/intel_cpu/tests/unit/graph/inplace_resolve_io.cpp index a41cb4c4300d42..f520b0b53feae8 100644 --- a/src/plugins/intel_cpu/tests/unit/graph/inplace_resolve_io.cpp +++ b/src/plugins/intel_cpu/tests/unit/graph/inplace_resolve_io.cpp @@ -1,4 +1,4 @@ -// Copyright (C) 2018-2023 Intel Corporation +// Copyright (C) 2018-2025 Intel Corporation // SPDX-License-Identifier: Apache-2.0 // #include diff --git a/src/plugins/intel_cpu/tests/unit/streams_info/update_proc_table_test.cpp b/src/plugins/intel_cpu/tests/unit/streams_info/update_proc_table_test.cpp index 08c0cf2c9089e9..8fc607229b79d0 100644 --- a/src/plugins/intel_cpu/tests/unit/streams_info/update_proc_table_test.cpp +++ b/src/plugins/intel_cpu/tests/unit/streams_info/update_proc_table_test.cpp @@ -1,4 +1,4 @@ -// Copyright (C) 2018-2024 Intel Corporation +// Copyright (C) 2018-2025 Intel Corporation // SPDX-License-Identifier: Apache-2.0 // diff --git a/src/plugins/intel_cpu/thirdparty/onednn b/src/plugins/intel_cpu/thirdparty/onednn index c7ecd8fc43610c..1789b1e0ae441d 160000 --- a/src/plugins/intel_cpu/thirdparty/onednn +++ b/src/plugins/intel_cpu/thirdparty/onednn @@ -1 +1 @@ -Subproject commit c7ecd8fc43610c82af317c178d28630bd948cb04 +Subproject commit 1789b1e0ae441de15d793123003a900a35d1dc71 diff --git a/src/plugins/intel_gpu/docs/gpu_debug_utils.md b/src/plugins/intel_gpu/docs/gpu_debug_utils.md index fb45c3da84c394..0708d9dd3557b7 100644 --- a/src/plugins/intel_gpu/docs/gpu_debug_utils.md +++ b/src/plugins/intel_gpu/docs/gpu_debug_utils.md @@ -268,7 +268,7 @@ Each file contains a single buffer in a common planar format (`bfyx`, `bfzyx`, o shape: [b:1, f:1280, x:1, y:1, z:1, w:1, g:1] (count: 1280, original format: b_fs_yx_fsv16) ``` -For troubleshooting the accuracy, you may want to compare the results of GPU plugin and CPU plugin. For CPU dump, see [Blob dumping](https://github.com/openvinotoolkit/openvino/blob/master/src/plugins/intel_cpu/src/docs/blob_dumping.md) +For troubleshooting the accuracy, you may want to compare the results of GPU plugin and CPU plugin. For CPU dump, see [Blob dumping](https://github.com/openvinotoolkit/openvino/blob/master/src/plugins/intel_cpu/docs/debug_capabilities/blob_dumping.md) ## Run int8 model on Gen9 HW diff --git a/src/plugins/intel_gpu/docs/gpu_plugin_unit_test.md b/src/plugins/intel_gpu/docs/gpu_plugin_unit_test.md index dcc27f3577ba7f..cf7a80cf712f11 100644 --- a/src/plugins/intel_gpu/docs/gpu_plugin_unit_test.md +++ b/src/plugins/intel_gpu/docs/gpu_plugin_unit_test.md @@ -23,8 +23,8 @@ openvino/src/plugins/intel_gpu/tests - root of Intel GPU unit test - Fusion is an algorithm that fuses several operations into one optimized operation. For example, two nodes of `conv -> relu` may be fused into a single node of `conv`. - Fusion unit tests checks whether the fusion is done as expected. - fusion_test_common.cpp - - The base class for a fusing test, that is, [BaseFusingTest](https://github.com/openvinotoolkit/openvino/blob/master/src/plugins/intel_gpu/tests/fusions/fusion_test_common.hpp#L19), is implemented here. It tests whether the fusing is successful or not by comparing the execution results of the two networks, one is the fused network, the other is non-fused network for the same topology. - - [BaseFusingTest](https://github.com/openvinotoolkit/openvino/blob/master/src/plugins/intel_gpu/tests/fusions/fusion_test_common.hpp#L19) has an important method called `compare()`. + - The base class for a fusing test, that is, [BaseFusingTest](https://github.com/openvinotoolkit/openvino/blob/master/src/plugins/intel_gpu/tests/unit/fusions/fusion_test_common.hpp#L20), is implemented here. It tests whether the fusing is successful or not by comparing the execution results of the two networks, one is the fused network, the other is non-fused network for the same topology. + - [BaseFusingTest](https://github.com/openvinotoolkit/openvino/blob/master/src/plugins/intel_gpu/tests/unit/fusions/fusion_test_common.hpp#L20) has an important method called `compare()`. - `compare()` method has the following three tasks: - Execute two networks (fused network and not fused network) - Compare the actual number of executed primitives with the expected number of executed primitives in test params @@ -138,9 +138,9 @@ GPU unit tests are using two types of test macros (**TEST** and **TEST_P**) in - **TEST** checks the test result by comparing the execution results with expected values after running network created from the target topology to check. - It is important to generate test input and expected output result in **TEST** - You can create input data and expected output data using these three approaches: - - Generate simple input data and calculate the expected output data from input data manually, like [basic_deformable_convolution_def_group1_2](https://github.com/openvinotoolkit/openvino/blob/master/src/plugins/intel_gpu/tests/test_cases/convolution_gpu_test.cpp#L254) - - Generate random input and get the expected output, using reference function, which is made in the test codes like [mvn_test_across_channels_outside_sqrt_bfyx](https://github.com/openvinotoolkit/openvino/blob/master/src/plugins/intel_gpu/tests/test_cases/mvn_gpu_test.cpp#L108) - - Generate random input and get the expected output from another reference kernel which exists in clDNN kernels like [mvn_random_test_bsv32](https://github.com/openvinotoolkit/openvino/blob/master/src/plugins/intel_gpu/tests/test_cases/mvn_gpu_test.cpp#L793) + - Generate simple input data and calculate the expected output data from input data manually, like [basic_deformable_convolution_def_group1_2](https://github.com/openvinotoolkit/openvino/blob/master/src/plugins/intel_gpu/tests/unit/test_cases/convolution_gpu_test.cpp#L224) + - Generate random input and get the expected output, using reference function, which is made in the test codes like [mvn_test_across_channels_outside_sqrt_bfyx](https://github.com/openvinotoolkit/openvino/blob/master/src/plugins/intel_gpu/tests/unit/test_cases/mvn_gpu_test.cpp#L138) + - Generate random input and get the expected output from another reference kernel which exists in clDNN kernels like [mvn_random_test_bsv32](https://github.com/openvinotoolkit/openvino/blob/master/src/plugins/intel_gpu/tests/unit/test_cases/mvn_gpu_test.cpp#L762) - When you allocate input data, keep in mind that the layout order in `engine.allocation_memory` is not `bfyx` but `bfxy`. For example, if input is `{1,1,4,5}`, the layout should be as below: @@ -151,7 +151,7 @@ GPU unit tests are using two types of test macros (**TEST** and **TEST_P**) in ## fusions - It is implemented based on **TEST_P** because there are many cases where multiple layouts are tested in the same topology. -- If the fusing test class already exists, you can use it. Otherwise, you should make a new fusing test class, which is inherited [BaseFusingTest](https://github.com/openvinotoolkit/openvino/blob/master/src/plugins/intel_gpu/tests/fusions/fusion_test_common.hpp#L19). +- If the fusing test class already exists, you can use it. Otherwise, you should make a new fusing test class, which is inherited [BaseFusingTest](https://github.com/openvinotoolkit/openvino/blob/master/src/plugins/intel_gpu/tests/unit/fusions/fusion_test_common.hpp#L20). - The new fusing test class should create the `execute()` method, which creates fused / non-fused networks and calls `compare` method after setting input. - Create a test case, using **TEST_P**: - You can make the desired networks using create_topologies. diff --git a/src/plugins/intel_gpu/include/intel_gpu/graph/serialization/utils.hpp b/src/plugins/intel_gpu/include/intel_gpu/graph/serialization/utils.hpp index ae912fa9c7519c..72b4b870e74846 100644 --- a/src/plugins/intel_gpu/include/intel_gpu/graph/serialization/utils.hpp +++ b/src/plugins/intel_gpu/include/intel_gpu/graph/serialization/utils.hpp @@ -1,4 +1,4 @@ -// Copyright (C) 2018-2022 Intel Corporation +// Copyright (C) 2018-2025 Intel Corporation // SPDX-License-Identifier: Apache-2.0 // diff --git a/src/plugins/intel_gpu/include/intel_gpu/runtime/execution_config.hpp b/src/plugins/intel_gpu/include/intel_gpu/runtime/execution_config.hpp index 113fa73e979b1b..e725f3658dfda2 100644 --- a/src/plugins/intel_gpu/include/intel_gpu/runtime/execution_config.hpp +++ b/src/plugins/intel_gpu/include/intel_gpu/runtime/execution_config.hpp @@ -150,7 +150,6 @@ class ExecutionConfig { void apply_performance_hints(const cldnn::device_info& info); void apply_priority_hints(const cldnn::device_info& info); void apply_debug_options(const cldnn::device_info& info); - void update_specific_default_properties(const cldnn::device_info& info); template void apply_rt_info_property(const ov::Property& property, const ov::RTMap& rt_info) { @@ -169,7 +168,7 @@ class ExecutionConfig { std::map supported_properties; std::map property_validators; - bool specific_default_properties_is_set = false; + bool finalized = false; }; } // namespace intel_gpu diff --git a/src/plugins/intel_gpu/src/graph/graph_optimizer/prepare_buffer_fusing.cpp b/src/plugins/intel_gpu/src/graph/graph_optimizer/prepare_buffer_fusing.cpp index 7db9c2c0d59419..03e4af4d16359b 100644 --- a/src/plugins/intel_gpu/src/graph/graph_optimizer/prepare_buffer_fusing.cpp +++ b/src/plugins/intel_gpu/src/graph/graph_optimizer/prepare_buffer_fusing.cpp @@ -943,7 +943,7 @@ void prepare_buffer_fusing::run(program& p) { auto update_scale_zp = [&](size_t kv_cache_output_idx, size_t read_value_output_idx) { auto scales_out_layout = node.get_output_layout(false, kv_cache_output_idx); - const auto scales_zp_concat_axis = kv_cache_inst::get_scale_zp_sequence_axis(desc->concat_axis, desc->quantization_attributes); + const auto scales_zp_concat_axis = kv_cache_inst::get_scale_zp_sequence_axis(); padding::DynamicDimsMask info_dynamic_pad_scales; info_dynamic_pad_scales[scales_zp_concat_axis] = 1; scales_out_layout.data_padding._dynamic_dims_mask = info_dynamic_pad_scales; diff --git a/src/plugins/intel_gpu/src/graph/graph_optimizer/prepare_primitive_fusing.cpp b/src/plugins/intel_gpu/src/graph/graph_optimizer/prepare_primitive_fusing.cpp index 2120a1308ea290..ce5333f95a1b59 100644 --- a/src/plugins/intel_gpu/src/graph/graph_optimizer/prepare_primitive_fusing.cpp +++ b/src/plugins/intel_gpu/src/graph/graph_optimizer/prepare_primitive_fusing.cpp @@ -399,7 +399,8 @@ void prepare_primitive_fusing::fuse_bias(program &p) { desc->padding_begin, desc->padding_end, desc->grouped_weights_shape, - conv.get_output_layout().data_type); + conv.get_output_layout().data_type, + desc->auto_pad); // Copy transposed flag to new prim as convolution node might be produced by deconv -> conv replacement before this pass conv_with_bias_prim->transposed = desc->transposed; diff --git a/src/plugins/intel_gpu/src/graph/impls/ocl/paged_attention.cpp b/src/plugins/intel_gpu/src/graph/impls/ocl/paged_attention.cpp index ab7d1a4f2ee1b4..0f285f57e9d18f 100644 --- a/src/plugins/intel_gpu/src/graph/impls/ocl/paged_attention.cpp +++ b/src/plugins/intel_gpu/src/graph/impls/ocl/paged_attention.cpp @@ -214,12 +214,6 @@ struct paged_attention_impl : multi_stage_primitive { if (desc->has_alibi) { args.inputs.push_back(instance.alibi_memory_ptr()); } - - if (desc->has_rotated_blocks) { - args.inputs.push_back(instance.rotated_block_indices_memory_ptr()); - args.inputs.push_back(instance.rotation_deltas_memory_ptr()); - args.inputs.push_back(instance.rotation_trig_lut_memory_ptr()); - } } else if (kernel_idx == 2 || kernel_idx == 3) { // Finalization kernel or mixed stage finalization kernel args.inputs = { instance.past_lens_memory_ptr() }; @@ -352,7 +346,7 @@ struct paged_attention_impl : multi_stage_primitive { std::vector res_events; std::vector dep_events = events; - if (has_rotated_blocks) { + if (has_rotated_blocks && !_kernels_data[Stage::KV_CACHE_ROTATE].kernels[0].skip_execution) { execute_stage(dep_events, instance, res_events, Stage::KV_CACHE_ROTATE, is_mixed_mode); dep_events = res_events; } @@ -687,10 +681,6 @@ struct paged_attention_impl : multi_stage_primitive { if (has_alibi) inputs_number++; - const auto has_rotation = impl_param.input_layouts.size() == 16; - if (has_rotation) - inputs_number += 3; - auto input_idx = 0; params.inputs.resize(inputs_number); params.inputs[input_idx++] = query_tensor; @@ -709,12 +699,6 @@ struct paged_attention_impl : multi_stage_primitive { if (has_alibi) params.inputs[input_idx++] = alibi_tensor; - if (has_rotation) { - params.inputs[input_idx++] = input_tensors[13]; - params.inputs[input_idx++] = input_tensors[14]; - params.inputs[input_idx++] = input_tensors[15]; - } - if (has_scores_output) { params.outputs.resize(2); params.outputs[1] = convert_data_tensor(impl_param.get_output_layout(1)); @@ -752,12 +736,6 @@ struct paged_attention_impl : multi_stage_primitive { if (has_alibi) in_tensor_to_offset_map.insert({input_idx++, in_offsets_map.at(11)}); - if (has_rotation) { - in_tensor_to_offset_map.insert({input_idx++, in_offsets_map.at(13)}); - in_tensor_to_offset_map.insert({input_idx++, in_offsets_map.at(14)}); - in_tensor_to_offset_map.insert({input_idx++, in_offsets_map.at(15)}); - } - if (has_scores_output) out_tensor_to_offset_map.insert({1, out_offsets_map.at(1)}); diff --git a/src/plugins/intel_gpu/src/graph/include/kv_cache_inst.h b/src/plugins/intel_gpu/src/graph/include/kv_cache_inst.h index e95e2e94ff4ab0..945894af30170c 100644 --- a/src/plugins/intel_gpu/src/graph/include/kv_cache_inst.h +++ b/src/plugins/intel_gpu/src/graph/include/kv_cache_inst.h @@ -62,8 +62,8 @@ class typed_primitive_inst : public typed_primitive_inst_base= 0 ? sequence_axis : past_layout_rank + sequence_axis; } - static int64_t get_scale_zp_sequence_axis(int64_t sequence_axis, const kv_cache::QuantizationAttributes& quantization_attrs) { - const auto scale_zp_concat_axis = quantization_attrs.scales_zp_output_order[sequence_axis]; + static int64_t get_scale_zp_sequence_axis() { + const auto scale_zp_concat_axis = 2; return scale_zp_concat_axis; } diff --git a/src/plugins/intel_gpu/src/graph/paged_attention.cpp b/src/plugins/intel_gpu/src/graph/paged_attention.cpp index 48ae46d83de34a..c656cb1f284ae0 100644 --- a/src/plugins/intel_gpu/src/graph/paged_attention.cpp +++ b/src/plugins/intel_gpu/src/graph/paged_attention.cpp @@ -1,4 +1,4 @@ -// Copyright (C) 2018-2023 Intel Corporation +// Copyright (C) 2018-2025 Intel Corporation // SPDX-License-Identifier: Apache-2.0 // #include "paged_attention_inst.h" diff --git a/src/plugins/intel_gpu/src/graph/primitive_inst.cpp b/src/plugins/intel_gpu/src/graph/primitive_inst.cpp index abfeabe2b6a149..e574684e6b4f10 100644 --- a/src/plugins/intel_gpu/src/graph/primitive_inst.cpp +++ b/src/plugins/intel_gpu/src/graph/primitive_inst.cpp @@ -851,7 +851,7 @@ void primitive_inst::realloc_if_needed(bool prev_execution_skipped) { auto prealloc_shape = updated_layouts[i].get_shape(); const auto shape_rank = prealloc_shape.size(); const auto seq_axis = i == 0 ? kv_cache_inst::get_sequence_axis(desc->concat_axis, shape_rank) - : kv_cache_inst::get_scale_zp_sequence_axis(desc->concat_axis, desc->quantization_attributes); + : kv_cache_inst::get_scale_zp_sequence_axis(); prealloc_shape[seq_axis] += tmp_prealloc_count; required_buffer_size = std::accumulate(prealloc_shape.begin(), prealloc_shape.end(), size_t(1), std::multiplies()); @@ -883,7 +883,7 @@ void primitive_inst::realloc_if_needed(bool prev_execution_skipped) { const auto& desc = _node->as().get_primitive(); const auto shape_rank = updated_layouts[i].get_shape().size(); const auto seq_axis = i == 0 ? kv_cache_inst::get_sequence_axis(desc->concat_axis, shape_rank) - : kv_cache_inst::get_scale_zp_sequence_axis(desc->concat_axis, desc->quantization_attributes); + : kv_cache_inst::get_scale_zp_sequence_axis(); prealloc_info = sp.predict_preallocation_shape(id(), updated_layouts[i], false, i, tmp_prealloc_count, seq_axis); } else { @@ -907,7 +907,7 @@ void primitive_inst::realloc_if_needed(bool prev_execution_skipped) { auto& present_layout = _impl_params->output_layouts[i]; const auto present_layout_rank = present_layout.get_partial_shape().size(); const auto sequence_axis = i == 0 ? kv_cache_inst::get_sequence_axis(desc->concat_axis, present_layout_rank) - : kv_cache_inst::get_scale_zp_sequence_axis(desc->concat_axis, desc->quantization_attributes); + : kv_cache_inst::get_scale_zp_sequence_axis(); auto max_pad = kv_cache_inst::get_max_pad(present_layout, _max_output_layout_count[i], @@ -978,7 +978,7 @@ void primitive_inst::realloc_if_needed(bool prev_execution_skipped) { if (max_pad > 0) { if (auto compressed_cache_variable = dynamic_cast(&variable)) { auto present_scales_layout = _impl_params->output_layouts[2]; - const auto sequence_axis = kv_cache_inst::get_scale_zp_sequence_axis(desc->concat_axis, desc->quantization_attributes); + const auto sequence_axis = kv_cache_inst::get_scale_zp_sequence_axis(); // In case of compressed KV-cache, calling update_impl for each iteration // because of scales layout [batch, num_heads, seq_len, head_size], which requires proper @@ -1374,7 +1374,7 @@ void primitive_inst::do_runtime_in_place_kv_cache() { if (desc->compressed) { auto compressed_cache_variable = dynamic_cast(&variable); auto& present_scales_layout = _impl_params->output_layouts[2]; - const auto sequence_axis = kv_cache_inst::get_scale_zp_sequence_axis(desc->concat_axis, desc->quantization_attributes); + const auto sequence_axis = kv_cache_inst::get_scale_zp_sequence_axis(); kv_cache_inst::update_pad(present_scales_layout, max_pad - new_seq_len, sequence_axis); GPU_DEBUG_TRACE_DETAIL << "[do runtime_in_place_kv_cache] " << id() << " Updated present_scale_layout's pad : " << present_scales_layout.to_string() << std::endl; @@ -1398,7 +1398,7 @@ void primitive_inst::do_runtime_in_place_kv_cache() { if (desc->compressed) { auto& past_scale_layout = _impl_params->input_layouts[3]; - const auto sequence_axis = kv_cache_inst::get_scale_zp_sequence_axis(desc->concat_axis, desc->quantization_attributes); + const auto sequence_axis = kv_cache_inst::get_scale_zp_sequence_axis(); kv_cache_inst::update_pad(past_scale_layout, max_pad, sequence_axis); if (desc->get_compression_zp_inputs_num() > 0) { diff --git a/src/plugins/intel_gpu/src/graph/program.cpp b/src/plugins/intel_gpu/src/graph/program.cpp index 5072740240e2a5..a8224c2e363f62 100644 --- a/src/plugins/intel_gpu/src/graph/program.cpp +++ b/src/plugins/intel_gpu/src/graph/program.cpp @@ -530,6 +530,7 @@ void program::init_graph() { node->get_output_layouts(); if (node->is_type()) { _config.set_property(ov::intel_gpu::use_onednn(true)); + _config.set_property(ov::intel_gpu::queue_type(QueueTypes::in_order)); } } // Perform initial shape_of subgraphs markup diff --git a/src/plugins/intel_gpu/src/kernel_selector/cl_kernels/convolution_gpu_imad.cl b/src/plugins/intel_gpu/src/kernel_selector/cl_kernels/convolution_gpu_imad.cl index 0cf873f570cf8e..cf442ee80b9bce 100644 --- a/src/plugins/intel_gpu/src/kernel_selector/cl_kernels/convolution_gpu_imad.cl +++ b/src/plugins/intel_gpu/src/kernel_selector/cl_kernels/convolution_gpu_imad.cl @@ -282,12 +282,6 @@ KERNEL (fused_convolution_eltwise_gpu_imad)( out[br * OUT_BLOCK_WIDTH + bc] = TO_ACCUMULATOR_TYPE(IMAD(out[br * OUT_BLOCK_WIDTH + bc], inputs, AS_FILTER_TYPE_4(w[wi]))); - #ifdef ASYMMETRIC_WEIGHTS_QUANTIZATION - ACCUMULATOR_TYPE dotProdAxWZP = 0; - dotProdAxWZP = TO_ACCUMULATOR_TYPE(IMAD(dotProdAxWZP, inputs, AS_FILTER_TYPE_4(weights_zp_val))); - out[br * OUT_BLOCK_WIDTH + bc] -= dotProdAxWZP; - #endif - #if !defined COMPENSATION_TERM && defined ASYMMETRIC_DATA_QUANTIZATION out[br * OUT_BLOCK_WIDTH + bc] -= dotProdAZPxW; #endif @@ -297,6 +291,12 @@ KERNEL (fused_convolution_eltwise_gpu_imad)( defined ASYMMETRIC_WEIGHTS_QUANTIZATION) out[br * OUT_BLOCK_WIDTH + bc] += dotProdAZPxWZP; #endif + + #ifdef ASYMMETRIC_WEIGHTS_QUANTIZATION + ACCUMULATOR_TYPE dotProdAxWZP = 0; + dotProdAxWZP = TO_ACCUMULATOR_TYPE(IMAD(dotProdAxWZP, inputs, AS_FILTER_TYPE_4(weights_zp_val))); + out[br * OUT_BLOCK_WIDTH + bc] -= dotProdAxWZP; + #endif } } wi++; diff --git a/src/plugins/intel_gpu/src/kernel_selector/cl_kernels/pa_sdpa_opt.cl b/src/plugins/intel_gpu/src/kernel_selector/cl_kernels/pa_sdpa_opt.cl index ae0f7a666c4309..7a300aaee1a16a 100644 --- a/src/plugins/intel_gpu/src/kernel_selector/cl_kernels/pa_sdpa_opt.cl +++ b/src/plugins/intel_gpu/src/kernel_selector/cl_kernels/pa_sdpa_opt.cl @@ -43,12 +43,6 @@ KERNEL(pa_sdpa_opt)( #if HAS_ALIBI const __global ALIBI_INPUT_TYPE* alibi_slopes, #endif - -#if HAS_ROTATED_BLOCKS - const __global INPUT7_TYPE* rotated_block_indices, - const __global INPUT8_TYPE* rotation_deltas, - const __global INPUT9_TYPE* rotation_trig_lut, -#endif __global OUTPUT_TYPE* output, #if PAGED_ATTENTION_SCORES_OUTPUT __global SOFTMAX_ACCUMULATOR_TYPE* softmax_results, diff --git a/src/plugins/intel_gpu/src/kernel_selector/kernels/eltwise/eltwise_kernel_blocked_opt.cpp b/src/plugins/intel_gpu/src/kernel_selector/kernels/eltwise/eltwise_kernel_blocked_opt.cpp index d95b008171db24..7ecce23a56777f 100644 --- a/src/plugins/intel_gpu/src/kernel_selector/kernels/eltwise/eltwise_kernel_blocked_opt.cpp +++ b/src/plugins/intel_gpu/src/kernel_selector/kernels/eltwise/eltwise_kernel_blocked_opt.cpp @@ -1,4 +1,4 @@ -// Copyright (C) 2018-2022 Intel Corporation +// Copyright (C) 2018-2025 Intel Corporation // SPDX-License-Identifier: Apache-2.0 // diff --git a/src/plugins/intel_gpu/src/kernel_selector/kernels/permute/permute_kernel_bfzyx_to_bfyxz.cpp b/src/plugins/intel_gpu/src/kernel_selector/kernels/permute/permute_kernel_bfzyx_to_bfyxz.cpp index e2723ed6841746..b969c986aa81fd 100644 --- a/src/plugins/intel_gpu/src/kernel_selector/kernels/permute/permute_kernel_bfzyx_to_bfyxz.cpp +++ b/src/plugins/intel_gpu/src/kernel_selector/kernels/permute/permute_kernel_bfzyx_to_bfyxz.cpp @@ -1,4 +1,4 @@ -// Copyright (C) 2018-2022 Intel Corporation +// Copyright (C) 2018-2025 Intel Corporation // SPDX-License-Identifier: Apache-2.0 // diff --git a/src/plugins/intel_gpu/src/kernel_selector/kernels/permute/permute_kernel_bfzyx_to_bfyxz.h b/src/plugins/intel_gpu/src/kernel_selector/kernels/permute/permute_kernel_bfzyx_to_bfyxz.h index 36acd93d225a45..4479e45d1a4a3b 100644 --- a/src/plugins/intel_gpu/src/kernel_selector/kernels/permute/permute_kernel_bfzyx_to_bfyxz.h +++ b/src/plugins/intel_gpu/src/kernel_selector/kernels/permute/permute_kernel_bfzyx_to_bfyxz.h @@ -1,4 +1,4 @@ -// Copyright (C) 2018-2022 Intel Corporation +// Copyright (C) 2018-2025 Intel Corporation // SPDX-License-Identifier: Apache-2.0 // diff --git a/src/plugins/intel_gpu/src/plugin/plugin.cpp b/src/plugins/intel_gpu/src/plugin/plugin.cpp index f98ffd0128bf6a..a02125d3b6cc18 100644 --- a/src/plugins/intel_gpu/src/plugin/plugin.cpp +++ b/src/plugins/intel_gpu/src/plugin/plugin.cpp @@ -28,6 +28,7 @@ #include "openvino/core/deprecated.hpp" #include "openvino/op/gather.hpp" #include "openvino/op/concat.hpp" +#include "openvino/op/paged_attention.hpp" #include "openvino/pass/manager.hpp" #include "openvino/pass/pattern/op/wrap_type.hpp" #include "openvino/pass/pattern/op/or.hpp" @@ -84,7 +85,8 @@ const auto is_llm = [](const std::shared_ptr& model) -> bool { auto kvcache_matcher = std::make_shared(present, "KVCacheMatcher"); for (auto& op : model->get_ordered_ops()) { - if (kvcache_matcher->match(op)) { + if (kvcache_matcher->match(op) || + ov::is_type(op)) { return true; } } @@ -238,10 +240,12 @@ std::shared_ptr Plugin::compile_model(const std::shared_ptr< auto context_impl = get_context_impl(context); auto device_id = ov::DeviceIDParser{context_impl->get_device_name()}.get_device_id(); - OPENVINO_ASSERT(m_configs_map.find(device_id) != m_configs_map.end(), "[GPU] LoadExeNetworkImpl: Couldn't find config for GPU with id ", device_id); + OPENVINO_ASSERT(m_configs_map.find(device_id) != m_configs_map.end(), "[GPU] compile_model: Couldn't find config for GPU with id ", device_id); ExecutionConfig config = m_configs_map.at(device_id); config.set_user_property(orig_config); + if (model->has_rt_info("runtime_options")) + config.apply_rt_info(context_impl->get_engine().get_device_info(), model->get_rt_info("runtime_options"), is_llm(model)); config.apply_user_properties(context_impl->get_engine().get_device_info()); set_cache_info(model, config); diff --git a/src/plugins/intel_gpu/src/plugin/transformations/convert_stridedslices_to_variadicsplit.cpp b/src/plugins/intel_gpu/src/plugin/transformations/convert_stridedslices_to_variadicsplit.cpp index 500a156be56fcb..07ec61b155ff3f 100644 --- a/src/plugins/intel_gpu/src/plugin/transformations/convert_stridedslices_to_variadicsplit.cpp +++ b/src/plugins/intel_gpu/src/plugin/transformations/convert_stridedslices_to_variadicsplit.cpp @@ -31,7 +31,7 @@ ConvertStridedSlicesToVariadicSplit::ConvertStridedSlicesToVariadicSplit() { return false; user_count++; } - return (user_count == num_users_to_fuse) && consumers_count(num_users_to_fuse); + return (user_count == num_users_to_fuse) && consumers_count(num_users_to_fuse)(output); }; auto data_m = any_input(); diff --git a/src/plugins/intel_gpu/src/plugin/transformations/dynamic_quantize_fully_connected.cpp b/src/plugins/intel_gpu/src/plugin/transformations/dynamic_quantize_fully_connected.cpp index a8eb149ff28646..f5607e98ab0f6f 100644 --- a/src/plugins/intel_gpu/src/plugin/transformations/dynamic_quantize_fully_connected.cpp +++ b/src/plugins/intel_gpu/src/plugin/transformations/dynamic_quantize_fully_connected.cpp @@ -56,7 +56,9 @@ DynamicQuantizeFullyConnected::DynamicQuantizeFullyConnected(uint64_t group_size config.scale_dt = element::f16; config.group_sizes = shape_group_size; - GPU_DEBUG_IF(debug_config->dynamic_quantize_asym) { + // AZP does not support grouped size dyn-quan + // XXX: This is currently wrapped as GPU_DEBUG_IF as dynamic_quantize_asym is not exposed through public API. + GPU_DEBUG_IF(debug_config->dynamic_quantize_asym && group_size == UINT64_MAX) { config.quantization_type = QuantizationType::Asymmetric; config.quantization_dt = element::u8; config.zp_dt = element::u8; // it supports u8 only now diff --git a/src/plugins/intel_gpu/src/plugin/transformations/op/kv_cache.cpp b/src/plugins/intel_gpu/src/plugin/transformations/op/kv_cache.cpp index 908732dc357222..6721d0f9ebd608 100644 --- a/src/plugins/intel_gpu/src/plugin/transformations/op/kv_cache.cpp +++ b/src/plugins/intel_gpu/src/plugin/transformations/op/kv_cache.cpp @@ -191,8 +191,7 @@ std::vector shape_infer(const KVCacheCompressed* op, auto quantized_data_shapes = ov::op::internal::DynamicQuantize::shape_infer(&dq_op, { input_shapes[1] }); - const auto concat_axis = ov::util::normalize(op->get_concat_axis(), input_shapes[0].size()); - const auto scales_concat_axis = op->get_quantization_attrs().scales_zp_output_order[concat_axis]; + const auto scales_concat_axis = 2; ov::PartialShape compression_scale_shape = input_shapes[3]; compression_scale_shape[scales_concat_axis] += quantized_data_shapes[1][scales_concat_axis]; out_shapes[2] = compression_scale_shape; diff --git a/src/plugins/intel_gpu/src/plugin/transformations/unsqueeze_broadcast_reshape_matmul_fusion.cpp b/src/plugins/intel_gpu/src/plugin/transformations/unsqueeze_broadcast_reshape_matmul_fusion.cpp index 6a2a9ba627573b..f71ecc23e7fe04 100644 --- a/src/plugins/intel_gpu/src/plugin/transformations/unsqueeze_broadcast_reshape_matmul_fusion.cpp +++ b/src/plugins/intel_gpu/src/plugin/transformations/unsqueeze_broadcast_reshape_matmul_fusion.cpp @@ -26,20 +26,16 @@ UnsqueezeBroadcastReshapeMatmulFusion::UnsqueezeBroadcastReshapeMatmulFusion() { return ov::as_type_ptr(output.get_node_shared_ptr()) == nullptr; }; - auto unsqueeze_predicate = [](const ov::Output& output) -> bool { - return rank_equals(5)(output) && consumers_count(1); - }; + auto unsqueeze_predicate = rank_equals(5) && consumers_count(1); auto broadcast_predicate = [](const ov::Output& output) -> bool { const auto broadcast = ov::as_type_ptr(output.get_node_shared_ptr()); if (!broadcast || broadcast->get_broadcast_spec().m_type != ov::op::BroadcastType::BIDIRECTIONAL) return false; - return rank_equals(5)(output) && consumers_count(1); + return rank_equals(5)(output) && consumers_count(1)(output); }; - auto reshape_predicate = [](const ov::Output& output) -> bool { - return rank_equals(4)(output) && consumers_count(1); - }; + auto reshape_predicate = rank_equals(4) && consumers_count(1); auto input_a_m = any_input(not_reshape); auto input_b_m = wrap_type({any_input(), any_input()}); diff --git a/src/plugins/intel_gpu/src/plugin/transformations/unsqueeze_broadcast_reshape_sdpa_fusion.cpp b/src/plugins/intel_gpu/src/plugin/transformations/unsqueeze_broadcast_reshape_sdpa_fusion.cpp index 9d5ea8db863556..b99a8e02fef85d 100644 --- a/src/plugins/intel_gpu/src/plugin/transformations/unsqueeze_broadcast_reshape_sdpa_fusion.cpp +++ b/src/plugins/intel_gpu/src/plugin/transformations/unsqueeze_broadcast_reshape_sdpa_fusion.cpp @@ -23,20 +23,16 @@ using ov::pass::pattern::op::Or; UnsqueezeBroadcastReshapeSDPAFusion::UnsqueezeBroadcastReshapeSDPAFusion() { using namespace ov::pass::pattern; - auto unsqueeze_predicate = [](const ov::Output& output) -> bool { - return rank_equals(5)(output) && consumers_count(1); - }; + auto unsqueeze_predicate = rank_equals(5) && consumers_count(1); auto broadcast_predicate = [](const ov::Output& output) -> bool { const auto broadcast = ov::as_type_ptr(output.get_node_shared_ptr()); if (!broadcast || broadcast->get_broadcast_spec().m_type != ov::op::BroadcastType::BIDIRECTIONAL) return false; - return rank_equals(5)(output) && consumers_count(1); + return rank_equals(5)(output) && consumers_count(1)(output); }; - auto reshape_predicate = [](const ov::Output& output) -> bool { - return rank_equals(4)(output) && consumers_count(1); - }; + auto reshape_predicate = rank_equals(4) && consumers_count(1); auto input_a_m = any_input(); auto input_attn_mask = any_input(); diff --git a/src/plugins/intel_gpu/src/plugin/transformations_pipeline.cpp b/src/plugins/intel_gpu/src/plugin/transformations_pipeline.cpp index 9094354a03fbe8..a2bdac78fcb805 100644 --- a/src/plugins/intel_gpu/src/plugin/transformations_pipeline.cpp +++ b/src/plugins/intel_gpu/src/plugin/transformations_pipeline.cpp @@ -1077,6 +1077,13 @@ void TransformationsPipeline::apply(std::shared_ptr func) { return true; } + // AZP does not support grouped size dyn-quan + GPU_DEBUG_IF(debug_config->dynamic_quantize_asym && (dynamic_quantization_group_size != UINT64_MAX)) { + GPU_DEBUG_TRACE << root->get_friendly_name() << " dyn_quan is turned off: asym quantization does not support grouped quantization" << + " ('DynamicQuantizeAsym' is enabled with grouped size dyn-quan)" << std::endl; + return true; + } + bool has_wzp = root->get_input_size() > 4; if ((root->get_input_element_type(1) == ov::element::i8 || root->get_input_element_type(1) == ov::element::u8) && has_wzp @@ -1085,6 +1092,7 @@ void TransformationsPipeline::apply(std::shared_ptr func) { " asym 8bit weight does not support grouped quantization" << std::endl; return true; } + return false; }); manager.register_pass(dynamic_quantization_group_size); diff --git a/src/plugins/intel_gpu/src/runtime/execution_config.cpp b/src/plugins/intel_gpu/src/runtime/execution_config.cpp index 89edba4a69eee1..51fadb49c286e7 100644 --- a/src/plugins/intel_gpu/src/runtime/execution_config.cpp +++ b/src/plugins/intel_gpu/src/runtime/execution_config.cpp @@ -5,6 +5,7 @@ #include "intel_gpu/runtime/execution_config.hpp" #include "intel_gpu/runtime/debug_configuration.hpp" #include "openvino/runtime/internal_properties.hpp" +#include "openvino/runtime/properties.hpp" #include @@ -59,7 +60,7 @@ void ExecutionConfig::set_default() { std::make_tuple(ov::cache_mode, ov::CacheMode::OPTIMIZE_SPEED), std::make_tuple(ov::cache_encryption_callbacks, EncryptionCallbacks{}), std::make_tuple(ov::hint::dynamic_quantization_group_size, 0), - std::make_tuple(ov::hint::kv_cache_precision, ov::element::undefined), + std::make_tuple(ov::hint::kv_cache_precision, ov::element::f16), std::make_tuple(ov::intel_gpu::hint::enable_kernels_reuse, false), std::make_tuple(ov::weights_path, ""), std::make_tuple(ov::hint::activations_scale_factor, -1.f), @@ -230,26 +231,9 @@ void ExecutionConfig::apply_hints(const cldnn::device_info& info) { apply_debug_options(info); } -void ExecutionConfig::update_specific_default_properties(const cldnn::device_info& info) { - // These default properties should be set once. - if (specific_default_properties_is_set) - return; - specific_default_properties_is_set = true; - - // Enable KV-cache compression by default for non-systolic platforms MFDNN-11755 - if (get_property(ov::hint::kv_cache_precision) == ov::element::undefined && !info.supports_immad) { - set_property(ov::hint::kv_cache_precision(ov::element::i8)); - } - - // Enable dynamic quantization by default for non-systolic platforms - if (get_property(ov::hint::dynamic_quantization_group_size) == 0 && !info.supports_immad) { - set_property(ov::hint::dynamic_quantization_group_size(32)); - } -} - void ExecutionConfig::apply_user_properties(const cldnn::device_info& info) { - // Update specific default properties, call once before internal_properties updated. - update_specific_default_properties(info); + if (finalized) + return; // Copy internal properties before applying hints to ensure that // a property set by hint won't be overriden by a value in user config. @@ -280,6 +264,23 @@ void ExecutionConfig::apply_user_properties(const cldnn::device_info& info) { } } + if (!is_set_by_user(ov::hint::kv_cache_precision) || get_property(ov::hint::kv_cache_precision) == ov::element::undefined) { + if (info.supports_immad) { // MFDNN-11755 + set_property(ov::hint::kv_cache_precision(get_property(ov::hint::inference_precision))); + } else { + // Enable KV-cache compression by default for non-systolic platforms only + set_property(ov::hint::kv_cache_precision(ov::element::i8)); + } + } + + // Enable dynamic quantization by default for non-systolic platforms + if (!is_set_by_user(ov::hint::dynamic_quantization_group_size) && + get_property(ov::hint::dynamic_quantization_group_size) == 0 && !info.supports_immad) { + set_property(ov::hint::dynamic_quantization_group_size(32)); + } + + finalized = true; + user_properties.clear(); } @@ -287,7 +288,7 @@ void ExecutionConfig::apply_rt_info(const cldnn::device_info& info, const ov::RT if (!info.supports_immad) { apply_rt_info_property(ov::hint::kv_cache_precision, rt_info); } - if (!info.supports_immad || !is_llm) + if (!is_llm) apply_rt_info_property(ov::hint::activations_scale_factor, rt_info); apply_rt_info_property(ov::hint::dynamic_quantization_group_size, rt_info); } diff --git a/src/plugins/intel_gpu/tests/common/subgraphs_builders.hpp b/src/plugins/intel_gpu/tests/common/subgraphs_builders.hpp index c774049fe0690f..65221107967bcc 100644 --- a/src/plugins/intel_gpu/tests/common/subgraphs_builders.hpp +++ b/src/plugins/intel_gpu/tests/common/subgraphs_builders.hpp @@ -120,8 +120,8 @@ inline std::shared_ptr make_qkv_transpose(ov::Output qkv, st return std::make_shared(qkv, transpose_const); } -inline std::shared_ptr make_kv_rearrange(ov::Output kv_past, ov::Output beam_idx) { - auto axis = std::make_shared(ov::element::i32, ov::Shape{}, 0); +inline std::shared_ptr make_kv_rearrange(ov::Output kv_past, ov::Output beam_idx, int axis_val = 0) { + auto axis = std::make_shared(ov::element::i32, ov::Shape{}, axis_val); return std::make_shared(kv_past, beam_idx, axis, 0); } @@ -242,8 +242,8 @@ inline std::shared_ptr make_llm_kv_cache_sdpa_pattern(ov::Dimension b in_beam_idx->set_friendly_name("beam_idx"); params.push_back(in_beam_idx); - concat_k_input = make_kv_rearrange(past_k, in_beam_idx); - concat_v_input = make_kv_rearrange(past_v, in_beam_idx); + concat_k_input = make_kv_rearrange(past_k, in_beam_idx, qkv_order[0]); + concat_v_input = make_kv_rearrange(past_v, in_beam_idx, qkv_order[0]); } auto concat_k = std::make_shared(ov::OutputVector{concat_k_input, in_k_token}, concat_axis); diff --git a/src/plugins/intel_gpu/tests/functional/concurrency/gpu_reservation_test.cpp b/src/plugins/intel_gpu/tests/functional/concurrency/gpu_reservation_test.cpp index 07d4879257185c..fb9711e7605859 100644 --- a/src/plugins/intel_gpu/tests/functional/concurrency/gpu_reservation_test.cpp +++ b/src/plugins/intel_gpu/tests/functional/concurrency/gpu_reservation_test.cpp @@ -1,4 +1,4 @@ -// Copyright (C) 2018-2024 Intel Corporation +// Copyright (C) 2018-2025 Intel Corporation // SPDX-License-Identifier: Apache-2.0 // diff --git a/src/plugins/intel_gpu/tests/functional/shared_tests_instances/low_precision_transformations/fuse_dequantize_to_fq_transformation.cpp b/src/plugins/intel_gpu/tests/functional/shared_tests_instances/low_precision_transformations/fuse_dequantize_to_fq_transformation.cpp index 69c8ffe19e56ba..50e3f68f190594 100644 --- a/src/plugins/intel_gpu/tests/functional/shared_tests_instances/low_precision_transformations/fuse_dequantize_to_fq_transformation.cpp +++ b/src/plugins/intel_gpu/tests/functional/shared_tests_instances/low_precision_transformations/fuse_dequantize_to_fq_transformation.cpp @@ -1,4 +1,4 @@ -// Copyright (C) 2018-2022 Intel Corporation +// Copyright (C) 2018-2025 Intel Corporation // SPDX-License-Identifier: Apache-2.0 // diff --git a/src/plugins/intel_gpu/tests/functional/shared_tests_instances/low_precision_transformations/gather_transformation.cpp b/src/plugins/intel_gpu/tests/functional/shared_tests_instances/low_precision_transformations/gather_transformation.cpp index dbd5e3476a7a58..973a899ef01829 100644 --- a/src/plugins/intel_gpu/tests/functional/shared_tests_instances/low_precision_transformations/gather_transformation.cpp +++ b/src/plugins/intel_gpu/tests/functional/shared_tests_instances/low_precision_transformations/gather_transformation.cpp @@ -1,4 +1,4 @@ -// Copyright (C) 2018-2022 Intel Corporation +// Copyright (C) 2018-2025 Intel Corporation // SPDX-License-Identifier: Apache-2.0 // diff --git a/src/plugins/intel_gpu/tests/functional/single_layer_tests/dynamic/broadcast.cpp b/src/plugins/intel_gpu/tests/functional/single_layer_tests/dynamic/broadcast.cpp index a3d9a1a9d3465d..1f9cb18db521c7 100644 --- a/src/plugins/intel_gpu/tests/functional/single_layer_tests/dynamic/broadcast.cpp +++ b/src/plugins/intel_gpu/tests/functional/single_layer_tests/dynamic/broadcast.cpp @@ -1,4 +1,4 @@ -// Copyright (C) 2018-2022 Intel Corporation +// Copyright (C) 2018-2025 Intel Corporation // SPDX-License-Identifier: Apache-2.0 // diff --git a/src/plugins/intel_gpu/tests/functional/subgraph_tests/dynamic/kv_cache.cpp b/src/plugins/intel_gpu/tests/functional/subgraph_tests/dynamic/kv_cache.cpp index 4945cc8d717be3..32adbeeba273f3 100644 --- a/src/plugins/intel_gpu/tests/functional/subgraph_tests/dynamic/kv_cache.cpp +++ b/src/plugins/intel_gpu/tests/functional/subgraph_tests/dynamic/kv_cache.cpp @@ -539,7 +539,7 @@ class KVCacheIssueTests: public ::testing::Test { auto core = ov::test::utils::PluginCache::get().core(); ov::AnyMap properties = { - ov::hint::kv_cache_precision(ov::element::undefined) + ov::hint::kv_cache_precision(ov::element::f16) }; const size_t n_batch = 1; diff --git a/src/plugins/intel_gpu/tests/functional/subgraph_tests/dynamic/kv_cache_sdpa.cpp b/src/plugins/intel_gpu/tests/functional/subgraph_tests/dynamic/kv_cache_sdpa.cpp index 89612039fb788f..71eeba9f6673a5 100644 --- a/src/plugins/intel_gpu/tests/functional/subgraph_tests/dynamic/kv_cache_sdpa.cpp +++ b/src/plugins/intel_gpu/tests/functional/subgraph_tests/dynamic/kv_cache_sdpa.cpp @@ -50,7 +50,7 @@ class SDPAWithKVCacheTest : public ::testing::Test, public ::testing::WithParamI if (p.compressed) { properties.emplace(ov::hint::kv_cache_precision(ov::element::i8)); } else { - properties.emplace(ov::hint::kv_cache_precision(ov::element::undefined)); + properties.emplace(ov::hint::kv_cache_precision(ov::element::f16)); } const size_t n_heads = 16; @@ -342,6 +342,7 @@ std::vector get_test_params() { p.push_back({with_rearrange, with_mask, !with_scale, !causal, !compressed, 1, ov::element::Type_t::f16, 10, 4, 1, {0, 1, 2, 3}}); p.push_back({with_rearrange, with_mask, !with_scale, !causal, !compressed, 1, ov::element::Type_t::f16, 10, 4, 1, {0, 2, 1, 3}}); p.push_back({!with_rearrange, with_mask, !with_scale, !causal, !compressed, 1, ov::element::Type_t::f16, 10, 4, 1, {0, 2, 1, 3}}); + p.push_back({!with_rearrange, with_mask, !with_scale, !causal, !compressed, 1, ov::element::Type_t::f16, 10, 4, 1, {1, 2, 0, 3}}); // Beam search p.push_back({with_rearrange, !with_mask, !with_scale, !causal, !compressed, 2, ov::element::Type_t::f16, 10, 4, 1, {0, 1, 2, 3}}); @@ -351,6 +352,7 @@ std::vector get_test_params() { p.push_back({with_rearrange, with_mask, !with_scale, !causal, compressed, 1, ov::element::Type_t::f16, 10, 1, 1, {0, 1, 2, 3}}); p.push_back({with_rearrange, with_mask, !with_scale, !causal, compressed, 1, ov::element::Type_t::f16, 10, 4, 1, {0, 2, 1, 3}}); p.push_back({with_rearrange, with_mask, !with_scale, !causal, compressed, 1, ov::element::Type_t::f16, 10, 4, 1, {0, 1, 2, 3}}); + p.push_back({with_rearrange, with_mask, !with_scale, !causal, compressed, 1, ov::element::Type_t::f16, 10, 4, 1, {1, 2, 0, 3}}); /* -- causal mask -- */ @@ -367,6 +369,8 @@ std::vector get_test_params() { p.push_back({with_rearrange, with_mask, !with_scale, causal, compressed, 1, ov::element::Type_t::f16, 10, 1, 1, {0, 1, 2, 3}}); p.push_back({with_rearrange, with_mask, !with_scale, causal, compressed, 1, ov::element::Type_t::f16, 10, 4, 1, {0, 2, 1, 3}}); p.push_back({with_rearrange, with_mask, !with_scale, causal, compressed, 1, ov::element::Type_t::f16, 10, 4, 1, {0, 1, 2, 3}}); + p.push_back({with_rearrange, with_mask, !with_scale, causal, compressed, 1, ov::element::Type_t::f16, 10, 4, 1, {1, 2, 0, 3}}); + return p; } diff --git a/src/plugins/intel_gpu/tests/unit/test_cases/convolution_gpu_test.cpp b/src/plugins/intel_gpu/tests/unit/test_cases/convolution_gpu_test.cpp index 30d12c490e3d15..bb952e860d0dfe 100644 --- a/src/plugins/intel_gpu/tests/unit/test_cases/convolution_gpu_test.cpp +++ b/src/plugins/intel_gpu/tests/unit/test_cases/convolution_gpu_test.cpp @@ -7685,9 +7685,7 @@ INSTANTIATE_TEST_SUITE_P(convolution_grouped_fsv4_fsv16, TestParamType_grouped_convolution_gpu(3, 1, 1, 80, 252, 3, 1, 1, 4, 1, 1, false, false, false, format::b_fs_yx_fsv4, ""), TestParamType_grouped_convolution_gpu(3, 1, 1, 80, 252, 3, 1, 1, 4, 1, 1, false, true, false, format::b_fs_yx_fsv4, ""), TestParamType_grouped_convolution_gpu(3, 1, 1, 80, 252, 3, 1, 1, 4, 1, 1, true, false, false, format::b_fs_yx_fsv4, ""), - - // TODO: It will be fix soon, test reference is wrong in new driver. - // TestParamType_grouped_convolution_gpu(3, 1, 1, 80, 252, 3, 1, 1, 4, 1, 1, true, true, false, format::b_fs_yx_fsv4, ""), + TestParamType_grouped_convolution_gpu(3, 1, 1, 80, 252, 3, 1, 1, 4, 1, 1, true, true, false, format::b_fs_yx_fsv4, ""), TestParamType_grouped_convolution_gpu(3, 1, 1, 80, 252, 3, 1, 1, 4, 1, 1, true, false, true, format::b_fs_yx_fsv4, ""), // Format: b_fs_yx_fsv16 diff --git a/src/plugins/intel_gpu/tests/unit/test_cases/paged_attention_gpu_test.cpp b/src/plugins/intel_gpu/tests/unit/test_cases/paged_attention_gpu_test.cpp index 7076b863c450d7..cdb927a57ca2bb 100644 --- a/src/plugins/intel_gpu/tests/unit/test_cases/paged_attention_gpu_test.cpp +++ b/src/plugins/intel_gpu/tests/unit/test_cases/paged_attention_gpu_test.cpp @@ -5,6 +5,7 @@ #include "test_utils.h" #include "random_generator.hpp" +#include #include #include #include @@ -306,6 +307,12 @@ struct PagedAttentionManager { auto layout = mem->get_layout(); layout.set_partial_shape(ov::PartialShape{ max_context_len[0], head_size }); + if (rotated_block_indices.empty()) { + auto empty_layout = mem->get_layout(); + empty_layout.set_partial_shape(ov::PartialShape{ 0, head_size }); + return test_engine.reinterpret_buffer(*mem, empty_layout); + } + return test_engine.reinterpret_buffer(*mem, layout); } @@ -741,7 +748,7 @@ struct PagedAttentionTest : public ::testing::TestWithParam { if (p.rotation_config.apply_rotation) { pa_inputs.push_back(input_info("rotated_block_indices")); pa_inputs.push_back(input_info("rotation_deltas")); - pa_inputs.push_back(input_info("rotation_trig_lut")); + pa_inputs.push_back(input_info("rotation_trig_lut_modified")); } auto pa_prim = paged_attention("paged_attention", pa_inputs); @@ -782,6 +789,9 @@ struct PagedAttentionTest : public ::testing::TestWithParam { topology.add(input_layout("rotated_block_indices", rotated_block_indices_layout)); topology.add(input_layout("rotation_deltas", rotation_deltas_layout)); topology.add(input_layout("rotation_trig_lut", rotation_trig_lut_layout)); + + // add dummy activation operation to simulate an empty PA `rotation_trig_lut` buffer for shapes like [0, head_size] + topology.add(activation("rotation_trig_lut_modified", input_info("rotation_trig_lut"), activation_func::none)); } ExecutionConfig config = get_test_default_config(get_test_engine()); diff --git a/src/plugins/intel_gpu/thirdparty/CMakeLists.txt b/src/plugins/intel_gpu/thirdparty/CMakeLists.txt index c3ae531e247e5d..475e9213ecf9f0 100644 --- a/src/plugins/intel_gpu/thirdparty/CMakeLists.txt +++ b/src/plugins/intel_gpu/thirdparty/CMakeLists.txt @@ -46,7 +46,8 @@ if(ENABLE_ONEDNN_FOR_GPU) endif() foreach(cmake_var IN ITEMS CMAKE_SYSTEM_NAME CMAKE_SYSTEM_VERSION - CMAKE_SYSTEM_PROCESSOR CMAKE_TOOLCHAIN_FILE) + CMAKE_SYSTEM_PROCESSOR CMAKE_TOOLCHAIN_FILE + CMAKE_VERBOSE_MAKEFILE) if(${cmake_var}) list(APPEND cmake_extra_args "-D${cmake_var}=${${cmake_var}}") endif() @@ -141,8 +142,7 @@ if(ENABLE_ONEDNN_FOR_GPU) EXCLUDE_FROM_ALL ON ) - list(APPEND LIB_INCLUDE_DIRS ${ONEDNN_INSTALL_DIR}/include) - list(APPEND LIB_INCLUDE_DIRS ${CMAKE_CURRENT_SOURCE_DIR}/onednn_gpu/src) + set(LIB_INCLUDE_DIRS "${ONEDNN_INSTALL_DIR}/include" "${CMAKE_CURRENT_SOURCE_DIR}/onednn_gpu/src") set(LIB_DEFINITIONS ENABLE_ONEDNN_FOR_GPU DNNL_DLL DNNL_DLL_EXPORTS @@ -158,6 +158,7 @@ if(ENABLE_ONEDNN_FOR_GPU) set_target_properties(onednn_gpu_tgt PROPERTIES INTERFACE_LINK_LIBRARIES $ INTERFACE_INCLUDE_DIRECTORIES "$" + INTERFACE_SYSTEM_INCLUDE_DIRECTORIES "${LIB_INCLUDE_DIRS}" INTERFACE_COMPILE_DEFINITIONS "${LIB_DEFINITIONS}" ) add_dependencies(onednn_gpu_tgt onednn_gpu_build) diff --git a/src/plugins/intel_gpu/thirdparty/onednn_gpu b/src/plugins/intel_gpu/thirdparty/onednn_gpu index d989ded8c51582..706a3ce3b391cf 160000 --- a/src/plugins/intel_gpu/thirdparty/onednn_gpu +++ b/src/plugins/intel_gpu/thirdparty/onednn_gpu @@ -1 +1 @@ -Subproject commit d989ded8c5158200dd2ccb602f53aeba92a64413 +Subproject commit 706a3ce3b391cf1d8a904a8efa981c70078719eb diff --git a/src/plugins/intel_npu/src/backend/include/zero_host_tensor.hpp b/src/plugins/intel_npu/src/backend/include/zero_host_tensor.hpp index 7150a428dd270a..65b438284dfd9b 100644 --- a/src/plugins/intel_npu/src/backend/include/zero_host_tensor.hpp +++ b/src/plugins/intel_npu/src/backend/include/zero_host_tensor.hpp @@ -33,7 +33,7 @@ class ZeroHostTensor : public ov::ITensor { std::shared_ptr get_impl() const; private: - std::shared_ptr m_impl; + std::shared_ptr _impl; }; } // namespace intel_npu diff --git a/src/plugins/intel_npu/src/backend/include/zero_infer_request.hpp b/src/plugins/intel_npu/src/backend/include/zero_infer_request.hpp index aaaa128518b34f..c40142c75608b8 100644 --- a/src/plugins/intel_npu/src/backend/include/zero_infer_request.hpp +++ b/src/plugins/intel_npu/src/backend/include/zero_infer_request.hpp @@ -67,11 +67,19 @@ class ZeroInferRequest final : public SyncInferRequest { const ov::Shape& shape, const ov::Allocator& allocator = {}) const override; + void add_state(const IODescriptor& descriptor, size_t tensorIndex) const override; + + void update_pipeline_if_memory_changed(); + void update_states_if_memory_changed(); + const std::shared_ptr _initStructs; const std::shared_ptr _graph; const Config _config; Logger _logger; + const std::vector& _graphInputDescriptors; + const std::vector& _graphOutputDescriptors; + // A copy of each tensor is needed to maintain the original L0 memory allocation in case the user provides another // memory area for the tensor. mutable std::vector>> _levelZeroInputTensors; diff --git a/src/plugins/intel_npu/src/backend/include/zero_remote_tensor.hpp b/src/plugins/intel_npu/src/backend/include/zero_remote_tensor.hpp index 6217e52c15dae0..0e8ed4529a94d3 100644 --- a/src/plugins/intel_npu/src/backend/include/zero_remote_tensor.hpp +++ b/src/plugins/intel_npu/src/backend/include/zero_remote_tensor.hpp @@ -25,6 +25,9 @@ class ZeroRemoteTensor final : public RemoteTensor { ov::intel_npu::MemType mem_type = ov::intel_npu::MemType::L0_INTERNAL_BUF, void* mem = nullptr); + void* get_original_memory() const; + ze_context_handle_t get_zero_context_handle() const; + ~ZeroRemoteTensor() override; private: diff --git a/src/plugins/intel_npu/src/backend/include/zero_variable_state.hpp b/src/plugins/intel_npu/src/backend/include/zero_variable_state.hpp new file mode 100644 index 00000000000000..c7c03bcfe4c8d8 --- /dev/null +++ b/src/plugins/intel_npu/src/backend/include/zero_variable_state.hpp @@ -0,0 +1,77 @@ +// Copyright (C) 2018-2025 Intel Corporation +// SPDX-License-Identifier: Apache-2.0 +// + +#pragma once + +#include "intel_npu/config/config.hpp" +#include "intel_npu/utils/logger/logger.hpp" +#include "intel_npu/utils/zero/zero_init.hpp" +#include "openvino/runtime/ivariable_state.hpp" + +namespace intel_npu { + +/** + * @brief Interface for zero variable state implementation + * @note In case the memory was allocated in the same level zero context use that memory, otherwise use memcpy at infer + * time. Also, get correct data if remote tensor is used. + */ +class ZeroVariableState final : public ov::IVariableState { +public: + explicit ZeroVariableState(const std::shared_ptr& init_structs, + const std::string& name, + const ov::SoPtr& tensor, + size_t tensor_index, + size_t related_tensor_index, + const Config& config); + + void set_state(const ov::SoPtr& new_state) override; + + void reset() override; + + /** + * @brief Get input tensor index used internally for the state + */ + size_t get_tensor_index() const; + + /** + * @brief Get output tensor index used internally for the state + * @details The related tensors are defined by state input, state output pairs. + */ + size_t get_related_tensor_index() const; + + /** + * @brief Get acknowledge if the tensor was updated + */ + bool tensor_was_updated() const; + + /** + * @brief Reset tensor updated flag + */ + void reset_tensor_updated_flag(); + + /** + * @brief Get acknowledge if the zero tensor was updated + * @details In case the memory was allocated in the same level zero context update the zero tensor + */ + bool zero_tensor_should_be_updated() const; + + /** + * @brief Reset zero tensor updated flag + */ + void reset_zero_tensor_updated_flag(); + + ~ZeroVariableState() override = default; + +private: + std::shared_ptr _init_structs; + size_t _tensor_index; + size_t _related_tensor_index; + + bool _tensor_updated = false; + bool _zero_tensor_updated = false; + + Logger _logger; +}; + +} // namespace intel_npu diff --git a/src/plugins/intel_npu/src/backend/src/zero_host_tensor.cpp b/src/plugins/intel_npu/src/backend/src/zero_host_tensor.cpp index 94115bf296b049..3a92a239408a1f 100644 --- a/src/plugins/intel_npu/src/backend/src/zero_host_tensor.cpp +++ b/src/plugins/intel_npu/src/backend/src/zero_host_tensor.cpp @@ -13,41 +13,36 @@ ZeroHostTensor::ZeroHostTensor(const std::shared_ptr& contex const ov::element::Type element_type, const ov::Shape& shape, const Config& config) - : m_impl(std::make_shared(context, - init_structs, - element_type, - shape, - config, - ov::intel_npu::TensorType::BINDED, - ov::intel_npu::MemType::L0_INTERNAL_BUF)) {} + : _impl(std::make_shared(context, + init_structs, + element_type, + shape, + config, + ov::intel_npu::TensorType::BINDED, + ov::intel_npu::MemType::L0_INTERNAL_BUF)) {} void* ZeroHostTensor::data(const ov::element::Type&) const { - auto itrHandle = m_impl->get_properties().find(ov::intel_npu::mem_handle.name()); - if (itrHandle == m_impl->get_properties().end()) { - OPENVINO_THROW("No parameter ", ov::intel_npu::mem_handle.name(), " found in parameters map"); - } - - return ov::Any(itrHandle->second).as(); + return _impl->get_original_memory(); } const ov::element::Type& ZeroHostTensor::get_element_type() const { - return m_impl->get_element_type(); + return _impl->get_element_type(); } const ov::Shape& ZeroHostTensor::get_shape() const { - return m_impl->get_shape(); + return _impl->get_shape(); } const ov::Strides& ZeroHostTensor::get_strides() const { - return m_impl->get_strides(); + return _impl->get_strides(); } void ZeroHostTensor::set_shape(ov::Shape new_shape) { - m_impl->set_shape(new_shape); + _impl->set_shape(new_shape); } std::shared_ptr ZeroHostTensor::get_impl() const { - return m_impl; + return _impl; } } // namespace intel_npu diff --git a/src/plugins/intel_npu/src/backend/src/zero_infer_request.cpp b/src/plugins/intel_npu/src/backend/src/zero_infer_request.cpp index 008e2bdd6d39de..aee73a2b73fa31 100644 --- a/src/plugins/intel_npu/src/backend/src/zero_infer_request.cpp +++ b/src/plugins/intel_npu/src/backend/src/zero_infer_request.cpp @@ -13,6 +13,7 @@ #include "openvino/op/util/op_types.hpp" #include "openvino/runtime/intel_npu/remote_properties.hpp" #include "zero_memory.hpp" +#include "zero_variable_state.hpp" using namespace intel_npu; @@ -54,9 +55,8 @@ void check_level_zero_attributes_match(const IODescriptor& ioDescriptor, const A '\n' + "Given: " + std::to_string(ovDimensions.size())); for (size_t index = 0; index < ovDimensions.size(); ++index) { - OPENVINO_ASSERT( - ioDescriptor.shapeFromCompiler.is_dynamic() || ovDimensions[index] == zeDescriptor.info.dims[index], - "Shape mismatch for input/output named " + ioDescriptor.nameFromCompiler); + OPENVINO_ASSERT(ovDimensions[index] == zeDescriptor.info.dims[index], + "Shape mismatch for input/output named " + ioDescriptor.nameFromCompiler); } for (size_t index = ovDimensions.size(); index < ZE_MAX_GRAPH_ARGUMENT_DIMENSIONS_SIZE; ++index) { OPENVINO_ASSERT(zeDescriptor.info.dims[index] == 0 || zeDescriptor.info.dims[index] == 1, @@ -64,33 +64,6 @@ void check_level_zero_attributes_match(const IODescriptor& ioDescriptor, const A } } -template -Type extract_object(const ov::AnyMap& params, const ov::Property& p) { - auto itrHandle = params.find(p.name()); - ov::Any res = nullptr; - if (itrHandle == params.end()) { - OPENVINO_THROW("No parameter ", p.name(), " found in parameters map"); - } - res = itrHandle->second; - return res.as(); -} - -bool memory_was_allocated_in_the_same_l0_context(ze_context_handle_t hContext, const void* ptr) { - ze_memory_allocation_properties_t desc = {}; - desc.stype = ZE_STRUCTURE_TYPE_MEMORY_ALLOCATION_PROPERTIES; - auto res = intel_npu::zeMemGetAllocProperties(hContext, ptr, &desc, nullptr); - if (res == ZE_RESULT_SUCCESS) { - if (desc.id) { - if ((desc.type & ZE_MEMORY_TYPE_HOST) || (desc.type & ZE_MEMORY_TYPE_DEVICE) || - (desc.type & ZE_MEMORY_TYPE_SHARED)) { - return true; - } - } - } - - return false; -} - } // namespace //------------------------------------------------------------------------------ @@ -102,13 +75,13 @@ ZeroInferRequest::ZeroInferRequest(const std::shared_ptr& _graph(compiledModel->get_graph()), _config(config), _logger("ZeroInferRequest", config.get()), + _graphInputDescriptors(_graph->get_input_descriptors()), + _graphOutputDescriptors(_graph->get_output_descriptors()), _levelZeroInputTensors(_metadata.inputs.size(), std::vector>(1, nullptr)), _levelZeroOutputTensors(_metadata.outputs.size(), nullptr), _profilingPool(_initStructs, _graph, zeroProfiling::POOL_SIZE), _profilingQuery(_initStructs, 0) { _logger.debug("ZeroInferRequest::ZeroInferRequest - SyncInferRequest"); - const std::vector& executorInputDescriptors = _graph->get_input_descriptors(); - const std::vector& executorOutputDescriptors = _graph->get_output_descriptors(); auto proftype = config.get(); if (proftype == ov::intel_npu::ProfilingType::INFER) { @@ -128,7 +101,7 @@ ZeroInferRequest::ZeroInferRequest(const std::shared_ptr& size_t ioIndex = 0; for (const IODescriptor& inputDescriptor : _metadata.inputs) { - check_level_zero_attributes_match(inputDescriptor, executorInputDescriptors.at(ioIndex)); + check_level_zero_attributes_match(inputDescriptor, _graphInputDescriptors.at(ioIndex)); if (!(inputDescriptor.isStateInput || inputDescriptor.isShapeTensor)) { ++ioIndex; @@ -143,7 +116,7 @@ ZeroInferRequest::ZeroInferRequest(const std::shared_ptr& ioIndex = 0; for (const IODescriptor& outputDescriptor : _metadata.outputs) { - check_level_zero_attributes_match(outputDescriptor, executorOutputDescriptors.at(ioIndex)); + check_level_zero_attributes_match(outputDescriptor, _graphOutputDescriptors.at(ioIndex)); if (!(outputDescriptor.isStateOutput || outputDescriptor.isShapeTensor)) { ++ioIndex; @@ -204,6 +177,29 @@ void ZeroInferRequest::create_pipeline() { auto groupOrdinal = zeroUtils::findGroupOrdinal(_initStructs->getDevice(), _properties); _logger.debug("ZeroInferRequest::create_pipeline - init completed"); + // Set new tensors and reset variable state flag if memory updated before creating the pipeline + _logger.debug("ZeroInferRequest::create_pipeline - set new tensors and reset variable state flag if memory updated " + "before creating the pipeline"); + for (const auto& variableState : _variableStates) { + auto zeroState = std::dynamic_pointer_cast(variableState._ptr); + + OPENVINO_ASSERT(zeroState != nullptr, "State is not compatible with NPU plugin"); + + if (zeroState->tensor_was_updated()) { + get_user_input(zeroState->get_tensor_index()) = zeroState->get_state(); + _userOutputTensors.at(zeroState->get_related_tensor_index()) = zeroState->get_state(); + + zeroState->reset_tensor_updated_flag(); + + if (zeroState->zero_tensor_should_be_updated()) { + zeroState->reset_zero_tensor_updated_flag(); + + get_level_zero_input(zeroState->get_tensor_index()) = zeroState->get_state()._ptr; + _levelZeroOutputTensors.at(zeroState->get_related_tensor_index()) = zeroState->get_state()._ptr; + } + } + } + _logger.debug("ZeroInferRequest::create_pipeline - constructing pipeline"); // Construct pipeline @@ -229,7 +225,7 @@ void ZeroInferRequest::set_tensor_data(const std::shared_ptr& tenso bool updateCommandListArg = false; OV_ITT_TASK_NEXT(ZERO_SET_TENSOR, "check_data_allocation"); - if (memory_was_allocated_in_the_same_l0_context(_initStructs->getContext(), tensor->data())) { + if (zeroUtils::memory_was_allocated_in_the_same_l0_context(_initStructs->getContext(), tensor->data())) { _logger.debug("ZeroInferRequest::set_tensor_data - tensor was created in the same L0 context"); levelZeroTensors = tensor; updateCommandListArg = true; @@ -268,8 +264,7 @@ void ZeroInferRequest::set_remote_tensor_data(const std::shared_ptr( - extract_object(tensor->get_context()->get_property(), ov::intel_npu::l0_context)); + auto l0_context = tensor->get_zero_context_handle(); if (_initStructs->getContext() != l0_context) { OPENVINO_THROW("Using different context for creating the tensor is not supported"); } @@ -280,7 +275,7 @@ void ZeroInferRequest::set_remote_tensor_data(const std::shared_ptrget_properties(), ov::intel_npu::mem_handle); + auto data = tensor->get_original_memory(); OPENVINO_ASSERT(data, "Empty buffer"); OV_ITT_TASK_NEXT(ZERO_SET_REMOTE_TENSOR, "updateCommandList"); @@ -372,7 +367,8 @@ void ZeroInferRequest::set_tensors(const ov::Output& port, bool tensorHasSameL0Context = false; OV_ITT_TASK_NEXT(SET_TENSORS, "check_data_allocation"); - if (memory_was_allocated_in_the_same_l0_context(_initStructs->getContext(), tensors[i]->data())) { + if (zeroUtils::memory_was_allocated_in_the_same_l0_context(_initStructs->getContext(), + tensors[i]->data())) { _logger.debug("ZeroInferRequest::set_tensors - tensor was created in the same L0 context"); get_level_zero_input(foundPort.idx, i) = tensors.at(i)._ptr; @@ -391,7 +387,7 @@ void ZeroInferRequest::set_tensors(const ov::Output& port, } else { _logger.debug("ZeroInferRequest::set_tensors - remote tensor is used"); - data = extract_object(remoteTensor->get_properties(), ov::intel_npu::mem_handle); + data = remoteTensor->get_original_memory(); get_level_zero_input(foundPort.idx, i) = tensors.at(i)._ptr; } @@ -454,6 +450,110 @@ ov::SoPtr ZeroInferRequest::get_tensor(const ov::Output(levelZeroTensor.at(SINGLE_TENSOR)); + + if (is_batched_input(ioIndex) || inputDescriptor.isShapeTensor || + is_remote_tensor(levelZeroTensor.at(SINGLE_TENSOR)) || zeroTensor == nullptr) { + ++ioIndex; + continue; + } + + if (zeroTensor->memory_address_changed()) { + _logger.debug("Update input graph descriptor with the new tensor"); + OPENVINO_ASSERT(zeroTensor->data(), "Empty buffer"); + + _pipeline->updateCommandList(_graph->get_input_descriptors().at(ioIndex).idx, + zeroTensor->data(), + zeroTensor->get_byte_size()); + closePipeline = true; + + if (!inputDescriptor.isStateInput) { + zeroTensor->reset_memory_flag(); + } + } + + ++ioIndex; + } + + ioIndex = 0; + + for (const auto& levelZeroTensor : _levelZeroOutputTensors) { + const auto outputDescriptor = _metadata.outputs.at(ioIndex); + auto zeroTensor = std::dynamic_pointer_cast(levelZeroTensor); + + if (outputDescriptor.isShapeTensor || is_remote_tensor(levelZeroTensor) || zeroTensor == nullptr) { + ++ioIndex; + continue; + } + + if (zeroTensor->memory_address_changed()) { + _logger.debug("Update output graph descriptor with the new tensor"); + OPENVINO_ASSERT(zeroTensor->data(), "Empty buffer"); + + _pipeline->updateCommandList(_graph->get_output_descriptors().at(ioIndex).idx, + zeroTensor->data(), + zeroTensor->get_byte_size()); + closePipeline = true; + + zeroTensor->reset_memory_flag(); + } + + ++ioIndex; + } + + if (closePipeline) { + _pipeline->closeCommandList(); + } +} + +void ZeroInferRequest::update_states_if_memory_changed() { + bool closePipeline = false; + + for (const auto& variableState : _variableStates) { + auto zeroState = std::dynamic_pointer_cast(variableState._ptr); + + OPENVINO_ASSERT(zeroState != nullptr, "State is not compatible with NPU plugin"); + + if (zeroState->tensor_was_updated()) { + get_user_input(zeroState->get_tensor_index()) = zeroState->get_state(); + _userOutputTensors.at(zeroState->get_related_tensor_index()) = zeroState->get_state(); + + zeroState->reset_tensor_updated_flag(); + + if (zeroState->zero_tensor_should_be_updated()) { + auto remoteTensor = std::dynamic_pointer_cast(zeroState->get_state()._ptr); + + void* userBuffer = !remoteTensor ? zeroState->get_state()->data() : remoteTensor->get_original_memory(); + + _pipeline->updateCommandList(_graphInputDescriptors.at(zeroState->get_tensor_index()).idx, + userBuffer, + zeroState->get_state()->get_byte_size()); + + _pipeline->updateCommandList(_graphOutputDescriptors.at(zeroState->get_related_tensor_index()).idx, + userBuffer, + zeroState->get_state()->get_byte_size()); + + zeroState->reset_zero_tensor_updated_flag(); + + get_level_zero_input(zeroState->get_tensor_index()) = zeroState->get_state()._ptr; + _levelZeroOutputTensors.at(zeroState->get_related_tensor_index()) = zeroState->get_state()._ptr; + + closePipeline = true; + } + } + } + + if (closePipeline) { + _pipeline->closeCommandList(); + } +} + void ZeroInferRequest::infer() { if (_config.get()) { OPENVINO_THROW("Only start async is supported when RUN_INFERENCES_SEQUENTIALLY is enabled!"); @@ -477,64 +577,8 @@ void ZeroInferRequest::infer_async() { _pipelineIsCreated = true; } else { if (_initStructs->getMutableCommandListVersion()) { - bool closePipeline = false; - size_t ioIndex = 0; - - for (const auto& levelZeroTensor : _levelZeroInputTensors) { - const auto inputDescriptor = _metadata.inputs.at(ioIndex); - auto zeroTensor = std::dynamic_pointer_cast(levelZeroTensor.at(SINGLE_TENSOR)); - - if (is_batched_input(ioIndex) || inputDescriptor.isShapeTensor || inputDescriptor.isStateInput || - is_remote_tensor(levelZeroTensor.at(SINGLE_TENSOR)) || zeroTensor == nullptr) { - ++ioIndex; - continue; - } - - if (zeroTensor->memory_address_changed()) { - _logger.debug("Update input graph descriptor with the new tensor"); - OPENVINO_ASSERT(zeroTensor->data(), "Empty buffer"); - - _pipeline->updateCommandList(_graph->get_input_descriptors().at(ioIndex).idx, - zeroTensor->data(), - zeroTensor->get_byte_size()); - closePipeline = true; - - zeroTensor->reset_memory_flag(); - } - - ++ioIndex; - } - - ioIndex = 0; - - for (const auto& levelZeroTensor : _levelZeroOutputTensors) { - const auto outputDescriptor = _metadata.outputs.at(ioIndex); - auto zeroTensor = std::dynamic_pointer_cast(levelZeroTensor); - - if (outputDescriptor.isShapeTensor || outputDescriptor.isStateOutput || - is_remote_tensor(levelZeroTensor) || zeroTensor == nullptr) { - ++ioIndex; - continue; - } - - if (zeroTensor->memory_address_changed()) { - _logger.debug("Update output graph descriptor with the new tensor"); - OPENVINO_ASSERT(zeroTensor->data(), "Empty buffer"); - - _pipeline->updateCommandList(_graph->get_output_descriptors().at(ioIndex).idx, - zeroTensor->data(), - zeroTensor->get_byte_size()); - closePipeline = true; - - zeroTensor->reset_memory_flag(); - } - - ++ioIndex; - } - - if (closePipeline) { - _pipeline->closeCommandList(); - } + update_pipeline_if_memory_changed(); + update_states_if_memory_changed(); } } } @@ -562,10 +606,8 @@ void ZeroInferRequest::infer_async() { auto userBatchRemoteTensor = std::dynamic_pointer_cast(userTensor.at(i)._ptr); - void* userBuffer = - !userBatchRemoteTensor - ? userTensor.at(i)->data() - : extract_object(userBatchRemoteTensor->get_properties(), ov::intel_npu::mem_handle); + void* userBuffer = !userBatchRemoteTensor ? userTensor.at(i)->data() + : userBatchRemoteTensor->get_original_memory(); if (userBuffer != levelZeroBuffer) { if (userBuffer == nullptr || levelZeroBuffer == nullptr) { @@ -588,8 +630,7 @@ void ZeroInferRequest::infer_async() { auto userBatchRemoteTensor = std::dynamic_pointer_cast(userTensor.at(i)._ptr); void* userBuffer = !userBatchRemoteTensor ? userTensor.at(i)->data() - : extract_object(userBatchRemoteTensor->get_properties(), - ov::intel_npu::mem_handle); + : userBatchRemoteTensor->get_original_memory(); std::memcpy(static_cast(levelZeroBuffer) + (i * userTensor.at(i)->get_byte_size()), userBuffer, @@ -602,9 +643,8 @@ void ZeroInferRequest::infer_async() { } auto userRemoteTensor = std::dynamic_pointer_cast(userTensor.at(SINGLE_TENSOR)._ptr); - void* userBuffer = !userRemoteTensor - ? userTensor.at(SINGLE_TENSOR)->data() - : extract_object(userRemoteTensor->get_properties(), ov::intel_npu::mem_handle); + void* userBuffer = + !userRemoteTensor ? userTensor.at(SINGLE_TENSOR)->data() : userRemoteTensor->get_original_memory(); const auto& levelZeroTensor = get_level_zero_input(inputIndex); if (!is_remote_tensor(levelZeroTensor)) { @@ -653,9 +693,7 @@ void ZeroInferRequest::get_result() { } auto userRemoteTensor = std::dynamic_pointer_cast(userTensor._ptr); - void* userBuffer = !userRemoteTensor - ? userTensor->data() - : extract_object(userRemoteTensor->get_properties(), ov::intel_npu::mem_handle); + void* userBuffer = !userRemoteTensor ? userTensor->data() : userRemoteTensor->get_original_memory(); const std::shared_ptr& levelZeroTensor = _levelZeroOutputTensors.at(outputIndex); if (!is_remote_tensor(levelZeroTensor)) { @@ -752,6 +790,19 @@ std::shared_ptr ZeroInferRequest::create_tensor(ov::element::Type t return std::make_shared(_initStructs, type, shape, allocator); } +void ZeroInferRequest::add_state(const IODescriptor& descriptor, size_t tensorIndex) const { + OPENVINO_ASSERT(descriptor.relatedDescriptorIndex.has_value(), + "The link between state descriptors is missing, state name: ", + descriptor.nameFromCompiler); + + _variableStates.push_back(std::make_shared(_initStructs, + descriptor.nameFromCompiler, + get_user_input(tensorIndex), + tensorIndex, + *descriptor.relatedDescriptorIndex, + _config)); +} + std::vector ZeroInferRequest::get_raw_profiling_data() const { return _profilingQuery.getData(); } diff --git a/src/plugins/intel_npu/src/backend/src/zero_pipeline.cpp b/src/plugins/intel_npu/src/backend/src/zero_pipeline.cpp index 7ada704c9969d8..9f55897193aeeb 100644 --- a/src/plugins/intel_npu/src/backend/src/zero_pipeline.cpp +++ b/src/plugins/intel_npu/src/backend/src/zero_pipeline.cpp @@ -15,21 +15,6 @@ #include "intel_npu/utils/zero/zero_types.hpp" #include "zero_remote_tensor.hpp" -namespace { - -template -Type extract_object(const ov::AnyMap& params, const ov::Property& p) { - auto itrHandle = params.find(p.name()); - ov::Any res = nullptr; - if (itrHandle == params.end()) { - OPENVINO_THROW("No parameter ", p.name(), " found in parameters map"); - } - res = itrHandle->second; - return res.as(); -} - -} // namespace - namespace intel_npu { Pipeline::Pipeline(const Config& config, @@ -80,7 +65,7 @@ Pipeline::Pipeline(const Config& config, if (remote_tensor == nullptr) { data = input_tensors.at(io_index).at(i)->data(); } else { - data = extract_object(remote_tensor->get_properties(), ov::intel_npu::mem_handle); + data = remote_tensor->get_original_memory(); } graph->set_argument_value(desc.idx, data); @@ -94,7 +79,7 @@ Pipeline::Pipeline(const Config& config, if (remote_tensor == nullptr) { data = input_tensors.at(io_index).at(0)->data(); } else { - data = extract_object(remote_tensor->get_properties(), ov::intel_npu::mem_handle); + data = remote_tensor->get_original_memory(); } graph->set_argument_value( @@ -112,7 +97,7 @@ Pipeline::Pipeline(const Config& config, if (remote_tensor == nullptr) { data = output_tensors.at(io_index)->data(); } else { - data = extract_object(remote_tensor->get_properties(), ov::intel_npu::mem_handle); + data = remote_tensor->get_original_memory(); } graph->set_argument_value( diff --git a/src/plugins/intel_npu/src/backend/src/zero_remote_tensor.cpp b/src/plugins/intel_npu/src/backend/src/zero_remote_tensor.cpp index 6fa12b72567792..999cfe8114086d 100644 --- a/src/plugins/intel_npu/src/backend/src/zero_remote_tensor.cpp +++ b/src/plugins/intel_npu/src/backend/src/zero_remote_tensor.cpp @@ -168,4 +168,12 @@ void ZeroRemoteTensor::update_properties() { } } +void* ZeroRemoteTensor::get_original_memory() const { + return _data; +} + +ze_context_handle_t ZeroRemoteTensor::get_zero_context_handle() const { + return _init_structs->getContext(); +} + } // namespace intel_npu diff --git a/src/plugins/intel_npu/src/backend/src/zero_variable_state.cpp b/src/plugins/intel_npu/src/backend/src/zero_variable_state.cpp new file mode 100644 index 00000000000000..442ae3fe9b2f03 --- /dev/null +++ b/src/plugins/intel_npu/src/backend/src/zero_variable_state.cpp @@ -0,0 +1,78 @@ +// Copyright (C) 2018-2025 Intel Corporation +// SPDX-License-Identifier: Apache-2.0 +// + +#include "zero_variable_state.hpp" + +#include "intel_npu/config/common.hpp" +#include "intel_npu/utils/zero/zero_utils.hpp" +#include "zero_remote_tensor.hpp" + +namespace intel_npu { + +ZeroVariableState::ZeroVariableState(const std::shared_ptr& init_structs, + const std::string& name, + const ov::SoPtr& tensor, + size_t tensor_index, + size_t related_tensor_index, + const Config& config) + : ov::IVariableState(name), + _init_structs(init_structs), + _tensor_index(tensor_index), + _related_tensor_index(related_tensor_index), + _logger("ZeroVariableState", config.get()) { + m_state = tensor; +} + +void ZeroVariableState::set_state(const ov::SoPtr& new_state) { + m_state = new_state; + _tensor_updated = true; + + if (_init_structs->getMutableCommandListVersion()) { + if (!is_remote_tensor(new_state._ptr)) { + if (zeroUtils::memory_was_allocated_in_the_same_l0_context(_init_structs->getContext(), + new_state->data())) { + _logger.debug("ZeroVariableState::set_state - tensor was created in the same L0 context"); + _zero_tensor_updated = true; + } + + return; + } + + _zero_tensor_updated = true; + } +} + +void ZeroVariableState::reset() { + auto remoteTensor = std::dynamic_pointer_cast(m_state._ptr); + + void* userBuffer = !remoteTensor ? m_state->data() : remoteTensor->get_original_memory(); + + std::memset(userBuffer, 0, m_state->get_byte_size()); +} + +size_t ZeroVariableState::get_tensor_index() const { + return _tensor_index; +} + +size_t ZeroVariableState::get_related_tensor_index() const { + return _related_tensor_index; +} + +bool ZeroVariableState::tensor_was_updated() const { + return _tensor_updated; +} + +void ZeroVariableState::reset_tensor_updated_flag() { + _tensor_updated = false; +} + +bool ZeroVariableState::zero_tensor_should_be_updated() const { + return _zero_tensor_updated; +} + +void ZeroVariableState::reset_zero_tensor_updated_flag() { + _zero_tensor_updated = false; +} + +} // namespace intel_npu diff --git a/src/plugins/intel_npu/src/common/include/intel_npu/common/sync_infer_request.hpp b/src/plugins/intel_npu/src/common/include/intel_npu/common/sync_infer_request.hpp index 3c772168c0c93f..f7406413c9f197 100644 --- a/src/plugins/intel_npu/src/common/include/intel_npu/common/sync_infer_request.hpp +++ b/src/plugins/intel_npu/src/common/include/intel_npu/common/sync_infer_request.hpp @@ -167,6 +167,8 @@ class SyncInferRequest : public ov::IInferRequest { const ov::Shape& shape, const ov::Allocator& allocator = {}) const; + virtual void add_state(const IODescriptor& descriptor, const size_t tensorIndex) const; + bool is_batched_input(size_t idx) const; ov::SoPtr& get_user_input(size_t index) const; diff --git a/src/plugins/intel_npu/src/common/include/intel_npu/common/variable_state.hpp b/src/plugins/intel_npu/src/common/include/intel_npu/common/variable_state.hpp index acb83d5b718033..0987f2b44bbb04 100644 --- a/src/plugins/intel_npu/src/common/include/intel_npu/common/variable_state.hpp +++ b/src/plugins/intel_npu/src/common/include/intel_npu/common/variable_state.hpp @@ -11,12 +11,11 @@ namespace intel_npu { class VariableState final : public ov::IVariableState { public: - explicit VariableState(const std::string& name, const std::shared_ptr& tensor) - : ov::IVariableState(name) { + explicit VariableState(const std::string& name, const ov::SoPtr& tensor) : ov::IVariableState(name) { m_state = tensor; } - void set_state(const ov::SoPtr& newState) override { + virtual void set_state(const ov::SoPtr& newState) override { if (newState->get_byte_size() != m_state->get_byte_size()) { OPENVINO_THROW("Byte size mismatch"); } @@ -24,7 +23,7 @@ class VariableState final : public ov::IVariableState { std::memcpy(m_state->data(), newState->data(), newState->get_byte_size()); } - void reset() override { + virtual void reset() override { std::memset(m_state->data(), 0, m_state->get_byte_size()); } diff --git a/src/plugins/intel_npu/src/common/src/sync_infer_request.cpp b/src/plugins/intel_npu/src/common/src/sync_infer_request.cpp index 17dc6391761e5c..775113ef0d39bf 100644 --- a/src/plugins/intel_npu/src/common/src/sync_infer_request.cpp +++ b/src/plugins/intel_npu/src/common/src/sync_infer_request.cpp @@ -326,7 +326,7 @@ std::shared_ptr SyncInferRequest::allocate_tensor(const IODescripto } if (descriptor.isStateInput) { - _variableStates.push_back(std::make_shared(descriptor.nameFromCompiler, tensor)); + add_state(descriptor, index); } } else if (_userOutputTensors.at(index) == nullptr) { _userOutputTensors.at(index) = tensor; @@ -341,6 +341,11 @@ std::shared_ptr SyncInferRequest::create_tensor(ov::element::Type t return ov::make_tensor(type, shape, allocator); } +void SyncInferRequest::add_state(const IODescriptor& descriptor, const size_t tensorIndex) const { + _variableStates.push_back( + std::make_shared(descriptor.nameFromCompiler, get_user_input(tensorIndex))); +} + bool SyncInferRequest::is_batched_input(size_t idx) const { return _userInputTensors.at(idx).size() > 1; } diff --git a/src/plugins/intel_npu/src/compiler_adapter/src/ze_graph_ext_wrappers.cpp b/src/plugins/intel_npu/src/compiler_adapter/src/ze_graph_ext_wrappers.cpp index 2f6eded512ab8e..a3626a79475dcd 100644 --- a/src/plugins/intel_npu/src/compiler_adapter/src/ze_graph_ext_wrappers.cpp +++ b/src/plugins/intel_npu/src/compiler_adapter/src/ze_graph_ext_wrappers.cpp @@ -12,7 +12,9 @@ #include "intel_npu/utils/zero/zero_api.hpp" #include "intel_npu/utils/zero/zero_result.hpp" #include "intel_npu/utils/zero/zero_wrappers.hpp" +#include "openvino/core/dimension.hpp" #include "openvino/core/model.hpp" +#include "openvino/core/partial_shape.hpp" #define NotSupportQuery(T) (T <= ZE_GRAPH_EXT_VERSION_1_2) @@ -400,7 +402,8 @@ ze_graph_handle_t ZeGraphExtWrappers::getGraphHandle(const std::vector& static IODescriptor getIODescriptor(const ze_graph_argument_properties_3_t& arg, const std::optional& metadata) { ov::element::Type_t precision = toOVElementType(arg.devicePrecision); - ov::Shape shapeFromCompiler, shapeFromIRModel; + ov::Shape shapeFromCompiler; + ov::PartialShape shapeFromIRModel; std::unordered_set outputTensorNames; for (uint32_t id = 0; id < arg.associated_tensor_names_count; id++) { @@ -410,8 +413,17 @@ static IODescriptor getIODescriptor(const ze_graph_argument_properties_3_t& arg, shapeFromCompiler.push_back(arg.dims[id]); } if (metadata.has_value()) { + const auto dynamicDim = std::numeric_limits::max(); + shapeFromIRModel.reserve(metadata->shape_size); for (uint32_t id = 0; id < metadata->shape_size; id++) { - shapeFromIRModel.push_back(metadata->shape[id]); + if (metadata->shape[id] != dynamicDim) { + shapeFromIRModel.push_back(metadata->shape[id]); + } else { + // lower bound is ignored, so we set it to 1 just to satisfy the Dimension constructor, + // upper bound is set to the value from shapeFromCompiler as it is filled with upper bounds + // in case of dynamic dimensions + shapeFromIRModel.push_back(ov::Dimension(1, shapeFromCompiler[id])); + } } } @@ -433,7 +445,7 @@ static IODescriptor getIODescriptor(const ze_graph_argument_properties_3_t& arg, return {std::move(nameFromCompiler), precision, - std::move(shapeFromCompiler), + shapeFromCompiler, isStateInput, isStateOutput, isShapeTensor, diff --git a/src/plugins/intel_npu/src/plugin/npuw/compiled_model.cpp b/src/plugins/intel_npu/src/plugin/npuw/compiled_model.cpp index f0d9950c2e3520..24e70aa7125e52 100644 --- a/src/plugins/intel_npu/src/plugin/npuw/compiled_model.cpp +++ b/src/plugins/intel_npu/src/plugin/npuw/compiled_model.cpp @@ -863,12 +863,13 @@ std::string ov::npuw::CompiledModel::funcall_mem_device(const std::size_t idx) c void ov::npuw::CompiledModel::remove_long_output_names(const std::shared_ptr& model) { NPUW_ASSERT(model.get() != nullptr); - for (auto& output : model->outputs()) { - const auto& tensor_names = output.get_tensor().get_names(); - if (tensor_names.size() > 32) { // maximum supported - output.get_tensor().set_names({}); - LOG_INFO("Removed output tensor names for " << model->get_friendly_name()); - LOG_BLOCK(); + for (auto node : model->get_ordered_ops()) { + for (auto &&output : node->outputs()) { + const auto& tensor_names = output.get_tensor().get_names(); + if (tensor_names.size() > 32) { + LOG_VERB(model->get_friendly_name() << " output " << output << " exceeds the name limit, removing..."); + output.get_tensor().set_names({}); + } } } } @@ -883,8 +884,7 @@ void ov::npuw::CompiledModel::fill_empty_tensor_names(const std::shared_ptrget_friendly_name()); - LOG_BLOCK(); + LOG_VERB("Added input tensor name for " << model->get_friendly_name()); } in_tensor_idx++; } @@ -892,8 +892,7 @@ void ov::npuw::CompiledModel::fill_empty_tensor_names(const std::shared_ptrget_friendly_name()); - LOG_BLOCK(); + LOG_VERB("Added output tensor name for " << model->get_friendly_name()); } out_tensor_idx++; } diff --git a/src/plugins/intel_npu/src/plugin/npuw/partitioning/patterns/dcoff.cpp b/src/plugins/intel_npu/src/plugin/npuw/partitioning/patterns/dcoff.cpp index 93a43c9b82570a..a4a03dea982438 100644 --- a/src/plugins/intel_npu/src/plugin/npuw/partitioning/patterns/dcoff.cpp +++ b/src/plugins/intel_npu/src/plugin/npuw/partitioning/patterns/dcoff.cpp @@ -890,7 +890,8 @@ CWAI3::CWAI3(CWAI3::Results scales) { auto matched_valueA = std::static_pointer_cast(matched_nodeA); auto matched_valueC = std::static_pointer_cast(matched_nodeC); - if (ov::element::i4 == matched_valueA->get_element_type() && + if ((ov::element::i4 == matched_valueA->get_element_type() || + ov::element::nf4 == matched_valueA->get_element_type()) && (ov::element::f16 == matched_valueC->get_element_type() || ov::element::f32 == matched_valueC->get_element_type())) { LOG_DEBUG("Matched: " << matched_valueC); diff --git a/src/plugins/intel_npu/src/utils/include/intel_npu/utils/zero/zero_utils.hpp b/src/plugins/intel_npu/src/utils/include/intel_npu/utils/zero/zero_utils.hpp index db9dc1c9f51d34..e68eb0200a09ce 100644 --- a/src/plugins/intel_npu/src/utils/include/intel_npu/utils/zero/zero_utils.hpp +++ b/src/plugins/intel_npu/src/utils/include/intel_npu/utils/zero/zero_utils.hpp @@ -277,5 +277,21 @@ static inline std::string getLatestBuildError(ze_graph_dditable_ext_curr_t& _gra } } +static inline bool memory_was_allocated_in_the_same_l0_context(ze_context_handle_t hContext, const void* ptr) { + ze_memory_allocation_properties_t desc = {}; + desc.stype = ZE_STRUCTURE_TYPE_MEMORY_ALLOCATION_PROPERTIES; + auto res = intel_npu::zeMemGetAllocProperties(hContext, ptr, &desc, nullptr); + if (res == ZE_RESULT_SUCCESS) { + if (desc.id) { + if ((desc.type & ZE_MEMORY_TYPE_HOST) || (desc.type & ZE_MEMORY_TYPE_DEVICE) || + (desc.type & ZE_MEMORY_TYPE_SHARED)) { + return true; + } + } + } + + return false; +} + } // namespace zeroUtils } // namespace intel_npu diff --git a/src/plugins/intel_npu/tests/functional/behavior/infer_request_run.cpp b/src/plugins/intel_npu/tests/functional/behavior/infer_request_run.cpp index f45e30bb109849..f30fa2bb1416a3 100644 --- a/src/plugins/intel_npu/tests/functional/behavior/infer_request_run.cpp +++ b/src/plugins/intel_npu/tests/functional/behavior/infer_request_run.cpp @@ -11,7 +11,7 @@ using namespace ov::test::behavior; -const std::vector configsInferRequestRunTests = {{ov::log::level(ov::log::Level::ERR)}}; +const std::vector configsInferRequestRunTests = {{}}; INSTANTIATE_TEST_SUITE_P(compatibility_smoke_BehaviorTest, InferRequestRunTests, diff --git a/src/plugins/intel_npu/tests/functional/behavior/infer_request_run.hpp b/src/plugins/intel_npu/tests/functional/behavior/infer_request_run.hpp index 31b55704757b01..ab53a442c16cda 100644 --- a/src/plugins/intel_npu/tests/functional/behavior/infer_request_run.hpp +++ b/src/plugins/intel_npu/tests/functional/behavior/infer_request_run.hpp @@ -10,6 +10,7 @@ #include #include +#include #include #include "base/ov_behavior_test_utils.hpp" @@ -962,6 +963,104 @@ TEST_P(SetShapeInferRunTests, checkResultsAfterIOBlobReallocation) { } } +TEST_P(SetShapeInferRunTests, checkResultsAfterStateTensorsReallocation) { + // Skip test according to plugin specific disabledTestPatterns() (if any) + SKIP_IF_CURRENT_TEST_IS_DISABLED() + + testing::internal::Random random(1); + ov::Tensor input_tensor; + + auto original_shape = Shape{1, 10, 10, 10}; + auto dummy_shape = Shape{1, 50, 100, 100}; + auto shape_size = ov::shape_size(original_shape); + auto model = createModelWithStates(element::f32, original_shape); + + auto context = core->get_default_context(target_device); + + compiled_model = core->compile_model(model, target_device, configuration); + ov::InferRequest inference_request; + inference_request = compiled_model.create_infer_request(); + + auto input = compiled_model.input(); + OV_ASSERT_NO_THROW(input_tensor = inference_request.get_tensor(input)); + auto* input_data = input_tensor.data(); + for (size_t i = 0; i < shape_size; ++i) { + input_data[i] = static_cast(random.Generate(10)); + } + + for (auto&& state : inference_request.query_state()) { + state.reset(); + } + + OV_ASSERT_NO_THROW(inference_request.infer()); + + auto output_tensor = inference_request.get_tensor("sigmod_state"); + auto output_data = output_tensor.data(); + for (size_t i = 0; i < output_tensor.get_size(); i++) { + EXPECT_NEAR(0.5f, output_data[i], 1e-5); + } + + auto states = inference_request.query_state(); + for (auto state : states) { + auto last_state = state.get_state(); + auto last_state_size = last_state.get_size(); + auto last_state_data = static_cast(last_state.data()); + + ASSERT_TRUE(last_state_size != 0) << "State size should not be 0"; + + for (size_t i = 0; i < last_state_size; ++i) { + EXPECT_NEAR(0.0, last_state_data[i], 1e-5); + } + } + + // create dummy Tensors to force the driver to allocate memory for the initial tensor somewhere else + [[maybe_unused]] auto l0_host_dummy_tensor_0 = context.create_host_tensor(ov::element::f32, dummy_shape); + [[maybe_unused]] auto l0_host_dummy_tensor_1 = context.create_host_tensor(ov::element::f32, dummy_shape); + [[maybe_unused]] auto l0_host_dummy_tensor_2 = context.create_host_tensor(ov::element::f32, dummy_shape); + [[maybe_unused]] auto l0_host_dummy_tensor_3 = context.create_host_tensor(ov::element::f32, dummy_shape); + [[maybe_unused]] auto l0_host_dummy_tensor_4 = context.create_host_tensor(ov::element::f32, dummy_shape); + [[maybe_unused]] auto l0_host_dummy_tensor_5 = context.create_host_tensor(ov::element::f32, dummy_shape); + [[maybe_unused]] auto l0_host_dummy_tensor_6 = context.create_host_tensor(ov::element::f32, dummy_shape); + [[maybe_unused]] auto l0_host_dummy_tensor_7 = context.create_host_tensor(ov::element::f32, dummy_shape); + + for (auto item : inference_request.query_state()) { + auto tensor_state = item.get_state(); + auto original_shape = tensor_state.get_shape(); + OV_ASSERT_NO_THROW(tensor_state.set_shape({1, 50, 20, 20})); + OV_ASSERT_NO_THROW(tensor_state.set_shape(original_shape)); + } + + for (auto&& state : inference_request.query_state()) { + state.reset(); + } + + for (auto state : states) { + auto last_state = state.get_state(); + auto last_state_size = last_state.get_size(); + auto last_state_data = static_cast(last_state.data()); + + ASSERT_TRUE(last_state_size != 0) << "State size should not be 0"; + + for (size_t i = 0; i < last_state_size; ++i) { + last_state_data[i] = 1.0f; + } + } + + OV_ASSERT_NO_THROW(inference_request.infer()); + + for (auto state : states) { + auto last_state = state.get_state(); + auto last_state_size = last_state.get_size(); + auto last_state_data = static_cast(last_state.data()); + + ASSERT_TRUE(last_state_size != 0) << "State size should not be 0"; + + for (size_t i = 0; i < last_state_size; ++i) { + EXPECT_NEAR(input_data[i], last_state_data[i], 1e-5); + } + } +} + } // namespace behavior } // namespace test } // namespace ov diff --git a/src/plugins/intel_npu/tests/functional/behavior/remote_tensor_tests/d3dx12_core.h b/src/plugins/intel_npu/tests/functional/behavior/remote_tensor_tests/d3dx12_core.h deleted file mode 100644 index e20327ccbe3158..00000000000000 --- a/src/plugins/intel_npu/tests/functional/behavior/remote_tensor_tests/d3dx12_core.h +++ /dev/null @@ -1,1389 +0,0 @@ -//********************************************************* -// -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License (MIT). -// -//********************************************************* - -#pragma once -#ifdef _WIN32 - -# ifndef __cplusplus -# error D3DX12 requires C++ -# endif - -# include - -# include "d3d12.h" -# include "d3dx12_default.h" - - -//------------------------------------------------------------------------------------------------ -# ifndef D3DX12_ASSERT -# ifdef assert -# define D3DX12_ASSERT(x) assert(x) -# else -# define D3DX12_ASSERT(x) -# endif -# endif - -//------------------------------------------------------------------------------------------------ -template -inline ID3D12CommandList* const* CommandListCast(t_CommandListType* const* pp) noexcept { - // This cast is useful for passing strongly typed command list pointers into - // ExecuteCommandLists. - // This cast is valid as long as the const-ness is respected. D3D12 APIs do - // respect the const-ness of their arguments. - return reinterpret_cast(pp); -} - -//------------------------------------------------------------------------------------------------ -inline bool operator==(const D3D12_VIEWPORT& l, const D3D12_VIEWPORT& r) noexcept { - return l.TopLeftX == r.TopLeftX && l.TopLeftY == r.TopLeftY && l.Width == r.Width && l.Height == r.Height && - l.MinDepth == r.MinDepth && l.MaxDepth == r.MaxDepth; -} - -//------------------------------------------------------------------------------------------------ -inline bool operator!=(const D3D12_VIEWPORT& l, const D3D12_VIEWPORT& r) noexcept { - return !(l == r); -} - -//------------------------------------------------------------------------------------------------ -struct CD3DX12_RECT : public D3D12_RECT { - CD3DX12_RECT() = default; - explicit CD3DX12_RECT(const D3D12_RECT& o) noexcept : D3D12_RECT(o) {} - explicit CD3DX12_RECT(LONG Left, LONG Top, LONG Right, LONG Bottom) noexcept { - left = Left; - top = Top; - right = Right; - bottom = Bottom; - } -}; - -//------------------------------------------------------------------------------------------------ -struct CD3DX12_VIEWPORT : public D3D12_VIEWPORT { - CD3DX12_VIEWPORT() = default; - explicit CD3DX12_VIEWPORT(const D3D12_VIEWPORT& o) noexcept : D3D12_VIEWPORT(o) {} - explicit CD3DX12_VIEWPORT(FLOAT topLeftX, - FLOAT topLeftY, - FLOAT width, - FLOAT height, - FLOAT minDepth = D3D12_MIN_DEPTH, - FLOAT maxDepth = D3D12_MAX_DEPTH) noexcept { - TopLeftX = topLeftX; - TopLeftY = topLeftY; - Width = width; - Height = height; - MinDepth = minDepth; - MaxDepth = maxDepth; - } - explicit CD3DX12_VIEWPORT(_In_ ID3D12Resource* pResource, - UINT mipSlice = 0, - FLOAT topLeftX = 0.0f, - FLOAT topLeftY = 0.0f, - FLOAT minDepth = D3D12_MIN_DEPTH, - FLOAT maxDepth = D3D12_MAX_DEPTH) noexcept { -# if defined(_MSC_VER) || !defined(_WIN32) - const auto Desc = pResource->GetDesc(); -# else - D3D12_RESOURCE_DESC tmpDesc; - const auto& Desc = *pResource->GetDesc(&tmpDesc); -# endif - const UINT64 SubresourceWidth = Desc.Width >> mipSlice; - const UINT64 SubresourceHeight = Desc.Height >> mipSlice; - switch (Desc.Dimension) { - case D3D12_RESOURCE_DIMENSION_BUFFER: - TopLeftX = topLeftX; - TopLeftY = 0.0f; - Width = float(Desc.Width) - topLeftX; - Height = 1.0f; - break; - case D3D12_RESOURCE_DIMENSION_TEXTURE1D: - TopLeftX = topLeftX; - TopLeftY = 0.0f; - Width = (SubresourceWidth ? float(SubresourceWidth) : 1.0f) - topLeftX; - Height = 1.0f; - break; - case D3D12_RESOURCE_DIMENSION_TEXTURE2D: - case D3D12_RESOURCE_DIMENSION_TEXTURE3D: - TopLeftX = topLeftX; - TopLeftY = topLeftY; - Width = (SubresourceWidth ? float(SubresourceWidth) : 1.0f) - topLeftX; - Height = (SubresourceHeight ? float(SubresourceHeight) : 1.0f) - topLeftY; - break; - default: - break; - } - - MinDepth = minDepth; - MaxDepth = maxDepth; - } -}; - -//------------------------------------------------------------------------------------------------ -struct CD3DX12_BOX : public D3D12_BOX { - CD3DX12_BOX() = default; - explicit CD3DX12_BOX(const D3D12_BOX& o) noexcept : D3D12_BOX(o) {} - explicit CD3DX12_BOX(LONG Left, LONG Right) noexcept { - left = static_cast(Left); - top = 0; - front = 0; - right = static_cast(Right); - bottom = 1; - back = 1; - } - explicit CD3DX12_BOX(LONG Left, LONG Top, LONG Right, LONG Bottom) noexcept { - left = static_cast(Left); - top = static_cast(Top); - front = 0; - right = static_cast(Right); - bottom = static_cast(Bottom); - back = 1; - } - explicit CD3DX12_BOX(LONG Left, LONG Top, LONG Front, LONG Right, LONG Bottom, LONG Back) noexcept { - left = static_cast(Left); - top = static_cast(Top); - front = static_cast(Front); - right = static_cast(Right); - bottom = static_cast(Bottom); - back = static_cast(Back); - } -}; -inline bool operator==(const D3D12_BOX& l, const D3D12_BOX& r) noexcept { - return l.left == r.left && l.top == r.top && l.front == r.front && l.right == r.right && l.bottom == r.bottom && - l.back == r.back; -} -inline bool operator!=(const D3D12_BOX& l, const D3D12_BOX& r) noexcept { - return !(l == r); -} - -//------------------------------------------------------------------------------------------------ -struct CD3DX12_DEPTH_STENCIL_DESC : public D3D12_DEPTH_STENCIL_DESC { - CD3DX12_DEPTH_STENCIL_DESC() = default; - explicit CD3DX12_DEPTH_STENCIL_DESC(const D3D12_DEPTH_STENCIL_DESC& o) noexcept : D3D12_DEPTH_STENCIL_DESC(o) {} - explicit CD3DX12_DEPTH_STENCIL_DESC(CD3DX12_DEFAULT) noexcept { - DepthEnable = TRUE; - DepthWriteMask = D3D12_DEPTH_WRITE_MASK_ALL; - DepthFunc = D3D12_COMPARISON_FUNC_LESS; - StencilEnable = FALSE; - StencilReadMask = D3D12_DEFAULT_STENCIL_READ_MASK; - StencilWriteMask = D3D12_DEFAULT_STENCIL_WRITE_MASK; - const D3D12_DEPTH_STENCILOP_DESC defaultStencilOp = {D3D12_STENCIL_OP_KEEP, - D3D12_STENCIL_OP_KEEP, - D3D12_STENCIL_OP_KEEP, - D3D12_COMPARISON_FUNC_ALWAYS}; - FrontFace = defaultStencilOp; - BackFace = defaultStencilOp; - } - explicit CD3DX12_DEPTH_STENCIL_DESC(BOOL depthEnable, - D3D12_DEPTH_WRITE_MASK depthWriteMask, - D3D12_COMPARISON_FUNC depthFunc, - BOOL stencilEnable, - UINT8 stencilReadMask, - UINT8 stencilWriteMask, - D3D12_STENCIL_OP frontStencilFailOp, - D3D12_STENCIL_OP frontStencilDepthFailOp, - D3D12_STENCIL_OP frontStencilPassOp, - D3D12_COMPARISON_FUNC frontStencilFunc, - D3D12_STENCIL_OP backStencilFailOp, - D3D12_STENCIL_OP backStencilDepthFailOp, - D3D12_STENCIL_OP backStencilPassOp, - D3D12_COMPARISON_FUNC backStencilFunc) noexcept { - DepthEnable = depthEnable; - DepthWriteMask = depthWriteMask; - DepthFunc = depthFunc; - StencilEnable = stencilEnable; - StencilReadMask = stencilReadMask; - StencilWriteMask = stencilWriteMask; - FrontFace.StencilFailOp = frontStencilFailOp; - FrontFace.StencilDepthFailOp = frontStencilDepthFailOp; - FrontFace.StencilPassOp = frontStencilPassOp; - FrontFace.StencilFunc = frontStencilFunc; - BackFace.StencilFailOp = backStencilFailOp; - BackFace.StencilDepthFailOp = backStencilDepthFailOp; - BackFace.StencilPassOp = backStencilPassOp; - BackFace.StencilFunc = backStencilFunc; - } -}; - -//------------------------------------------------------------------------------------------------ -struct CD3DX12_DEPTH_STENCIL_DESC1 : public D3D12_DEPTH_STENCIL_DESC1 { - CD3DX12_DEPTH_STENCIL_DESC1() = default; - explicit CD3DX12_DEPTH_STENCIL_DESC1(const D3D12_DEPTH_STENCIL_DESC1& o) noexcept : D3D12_DEPTH_STENCIL_DESC1(o) {} - explicit CD3DX12_DEPTH_STENCIL_DESC1(const D3D12_DEPTH_STENCIL_DESC& o) noexcept { - DepthEnable = o.DepthEnable; - DepthWriteMask = o.DepthWriteMask; - DepthFunc = o.DepthFunc; - StencilEnable = o.StencilEnable; - StencilReadMask = o.StencilReadMask; - StencilWriteMask = o.StencilWriteMask; - FrontFace.StencilFailOp = o.FrontFace.StencilFailOp; - FrontFace.StencilDepthFailOp = o.FrontFace.StencilDepthFailOp; - FrontFace.StencilPassOp = o.FrontFace.StencilPassOp; - FrontFace.StencilFunc = o.FrontFace.StencilFunc; - BackFace.StencilFailOp = o.BackFace.StencilFailOp; - BackFace.StencilDepthFailOp = o.BackFace.StencilDepthFailOp; - BackFace.StencilPassOp = o.BackFace.StencilPassOp; - BackFace.StencilFunc = o.BackFace.StencilFunc; - DepthBoundsTestEnable = FALSE; - } - explicit CD3DX12_DEPTH_STENCIL_DESC1(CD3DX12_DEFAULT) noexcept { - DepthEnable = TRUE; - DepthWriteMask = D3D12_DEPTH_WRITE_MASK_ALL; - DepthFunc = D3D12_COMPARISON_FUNC_LESS; - StencilEnable = FALSE; - StencilReadMask = D3D12_DEFAULT_STENCIL_READ_MASK; - StencilWriteMask = D3D12_DEFAULT_STENCIL_WRITE_MASK; - const D3D12_DEPTH_STENCILOP_DESC defaultStencilOp = {D3D12_STENCIL_OP_KEEP, - D3D12_STENCIL_OP_KEEP, - D3D12_STENCIL_OP_KEEP, - D3D12_COMPARISON_FUNC_ALWAYS}; - FrontFace = defaultStencilOp; - BackFace = defaultStencilOp; - DepthBoundsTestEnable = FALSE; - } - explicit CD3DX12_DEPTH_STENCIL_DESC1(BOOL depthEnable, - D3D12_DEPTH_WRITE_MASK depthWriteMask, - D3D12_COMPARISON_FUNC depthFunc, - BOOL stencilEnable, - UINT8 stencilReadMask, - UINT8 stencilWriteMask, - D3D12_STENCIL_OP frontStencilFailOp, - D3D12_STENCIL_OP frontStencilDepthFailOp, - D3D12_STENCIL_OP frontStencilPassOp, - D3D12_COMPARISON_FUNC frontStencilFunc, - D3D12_STENCIL_OP backStencilFailOp, - D3D12_STENCIL_OP backStencilDepthFailOp, - D3D12_STENCIL_OP backStencilPassOp, - D3D12_COMPARISON_FUNC backStencilFunc, - BOOL depthBoundsTestEnable) noexcept { - DepthEnable = depthEnable; - DepthWriteMask = depthWriteMask; - DepthFunc = depthFunc; - StencilEnable = stencilEnable; - StencilReadMask = stencilReadMask; - StencilWriteMask = stencilWriteMask; - FrontFace.StencilFailOp = frontStencilFailOp; - FrontFace.StencilDepthFailOp = frontStencilDepthFailOp; - FrontFace.StencilPassOp = frontStencilPassOp; - FrontFace.StencilFunc = frontStencilFunc; - BackFace.StencilFailOp = backStencilFailOp; - BackFace.StencilDepthFailOp = backStencilDepthFailOp; - BackFace.StencilPassOp = backStencilPassOp; - BackFace.StencilFunc = backStencilFunc; - DepthBoundsTestEnable = depthBoundsTestEnable; - } - operator D3D12_DEPTH_STENCIL_DESC() const noexcept { - D3D12_DEPTH_STENCIL_DESC D; - D.DepthEnable = DepthEnable; - D.DepthWriteMask = DepthWriteMask; - D.DepthFunc = DepthFunc; - D.StencilEnable = StencilEnable; - D.StencilReadMask = StencilReadMask; - D.StencilWriteMask = StencilWriteMask; - D.FrontFace.StencilFailOp = FrontFace.StencilFailOp; - D.FrontFace.StencilDepthFailOp = FrontFace.StencilDepthFailOp; - D.FrontFace.StencilPassOp = FrontFace.StencilPassOp; - D.FrontFace.StencilFunc = FrontFace.StencilFunc; - D.BackFace.StencilFailOp = BackFace.StencilFailOp; - D.BackFace.StencilDepthFailOp = BackFace.StencilDepthFailOp; - D.BackFace.StencilPassOp = BackFace.StencilPassOp; - D.BackFace.StencilFunc = BackFace.StencilFunc; - return D; - } -}; - -//------------------------------------------------------------------------------------------------ -# if defined(D3D12_SDK_VERSION) && (D3D12_SDK_VERSION >= 606) -struct CD3DX12_DEPTH_STENCIL_DESC2 : public D3D12_DEPTH_STENCIL_DESC2 { - CD3DX12_DEPTH_STENCIL_DESC2() = default; - explicit CD3DX12_DEPTH_STENCIL_DESC2(const D3D12_DEPTH_STENCIL_DESC2& o) noexcept : D3D12_DEPTH_STENCIL_DESC2(o) {} - explicit CD3DX12_DEPTH_STENCIL_DESC2(const D3D12_DEPTH_STENCIL_DESC1& o) noexcept { - DepthEnable = o.DepthEnable; - DepthWriteMask = o.DepthWriteMask; - DepthFunc = o.DepthFunc; - StencilEnable = o.StencilEnable; - FrontFace.StencilFailOp = o.FrontFace.StencilFailOp; - FrontFace.StencilDepthFailOp = o.FrontFace.StencilDepthFailOp; - FrontFace.StencilPassOp = o.FrontFace.StencilPassOp; - FrontFace.StencilFunc = o.FrontFace.StencilFunc; - FrontFace.StencilReadMask = o.StencilReadMask; - FrontFace.StencilWriteMask = o.StencilWriteMask; - - BackFace.StencilFailOp = o.BackFace.StencilFailOp; - BackFace.StencilDepthFailOp = o.BackFace.StencilDepthFailOp; - BackFace.StencilPassOp = o.BackFace.StencilPassOp; - BackFace.StencilFunc = o.BackFace.StencilFunc; - BackFace.StencilReadMask = o.StencilReadMask; - BackFace.StencilWriteMask = o.StencilWriteMask; - DepthBoundsTestEnable = o.DepthBoundsTestEnable; - } - explicit CD3DX12_DEPTH_STENCIL_DESC2(const D3D12_DEPTH_STENCIL_DESC& o) noexcept { - DepthEnable = o.DepthEnable; - DepthWriteMask = o.DepthWriteMask; - DepthFunc = o.DepthFunc; - StencilEnable = o.StencilEnable; - - FrontFace.StencilFailOp = o.FrontFace.StencilFailOp; - FrontFace.StencilDepthFailOp = o.FrontFace.StencilDepthFailOp; - FrontFace.StencilPassOp = o.FrontFace.StencilPassOp; - FrontFace.StencilFunc = o.FrontFace.StencilFunc; - FrontFace.StencilReadMask = o.StencilReadMask; - FrontFace.StencilWriteMask = o.StencilWriteMask; - - BackFace.StencilFailOp = o.BackFace.StencilFailOp; - BackFace.StencilDepthFailOp = o.BackFace.StencilDepthFailOp; - BackFace.StencilPassOp = o.BackFace.StencilPassOp; - BackFace.StencilFunc = o.BackFace.StencilFunc; - BackFace.StencilReadMask = o.StencilReadMask; - BackFace.StencilWriteMask = o.StencilWriteMask; - - DepthBoundsTestEnable = FALSE; - } - explicit CD3DX12_DEPTH_STENCIL_DESC2(CD3DX12_DEFAULT) noexcept { - DepthEnable = TRUE; - DepthWriteMask = D3D12_DEPTH_WRITE_MASK_ALL; - DepthFunc = D3D12_COMPARISON_FUNC_LESS; - StencilEnable = FALSE; - const D3D12_DEPTH_STENCILOP_DESC1 defaultStencilOp = {D3D12_STENCIL_OP_KEEP, - D3D12_STENCIL_OP_KEEP, - D3D12_STENCIL_OP_KEEP, - D3D12_COMPARISON_FUNC_ALWAYS, - D3D12_DEFAULT_STENCIL_READ_MASK, - D3D12_DEFAULT_STENCIL_WRITE_MASK}; - FrontFace = defaultStencilOp; - BackFace = defaultStencilOp; - DepthBoundsTestEnable = FALSE; - } - explicit CD3DX12_DEPTH_STENCIL_DESC2(BOOL depthEnable, - D3D12_DEPTH_WRITE_MASK depthWriteMask, - D3D12_COMPARISON_FUNC depthFunc, - BOOL stencilEnable, - D3D12_STENCIL_OP frontStencilFailOp, - D3D12_STENCIL_OP frontStencilDepthFailOp, - D3D12_STENCIL_OP frontStencilPassOp, - D3D12_COMPARISON_FUNC frontStencilFunc, - UINT8 frontStencilReadMask, - UINT8 frontStencilWriteMask, - D3D12_STENCIL_OP backStencilFailOp, - D3D12_STENCIL_OP backStencilDepthFailOp, - D3D12_STENCIL_OP backStencilPassOp, - D3D12_COMPARISON_FUNC backStencilFunc, - UINT8 backStencilReadMask, - UINT8 backStencilWriteMask, - BOOL depthBoundsTestEnable) noexcept { - DepthEnable = depthEnable; - DepthWriteMask = depthWriteMask; - DepthFunc = depthFunc; - StencilEnable = stencilEnable; - - FrontFace.StencilFailOp = frontStencilFailOp; - FrontFace.StencilDepthFailOp = frontStencilDepthFailOp; - FrontFace.StencilPassOp = frontStencilPassOp; - FrontFace.StencilFunc = frontStencilFunc; - FrontFace.StencilReadMask = frontStencilReadMask; - FrontFace.StencilWriteMask = frontStencilWriteMask; - - BackFace.StencilFailOp = backStencilFailOp; - BackFace.StencilDepthFailOp = backStencilDepthFailOp; - BackFace.StencilPassOp = backStencilPassOp; - BackFace.StencilFunc = backStencilFunc; - BackFace.StencilReadMask = backStencilReadMask; - BackFace.StencilWriteMask = backStencilWriteMask; - - DepthBoundsTestEnable = depthBoundsTestEnable; - } - - operator D3D12_DEPTH_STENCIL_DESC() const noexcept { - D3D12_DEPTH_STENCIL_DESC D; - D.DepthEnable = DepthEnable; - D.DepthWriteMask = DepthWriteMask; - D.DepthFunc = DepthFunc; - D.StencilEnable = StencilEnable; - D.StencilReadMask = FrontFace.StencilReadMask; - D.StencilWriteMask = FrontFace.StencilWriteMask; - D.FrontFace.StencilFailOp = FrontFace.StencilFailOp; - D.FrontFace.StencilDepthFailOp = FrontFace.StencilDepthFailOp; - D.FrontFace.StencilPassOp = FrontFace.StencilPassOp; - D.FrontFace.StencilFunc = FrontFace.StencilFunc; - D.BackFace.StencilFailOp = BackFace.StencilFailOp; - D.BackFace.StencilDepthFailOp = BackFace.StencilDepthFailOp; - D.BackFace.StencilPassOp = BackFace.StencilPassOp; - D.BackFace.StencilFunc = BackFace.StencilFunc; - return D; - } -}; -# endif // D3D12_SDK_VERSION >= 606 - -//------------------------------------------------------------------------------------------------ -struct CD3DX12_BLEND_DESC : public D3D12_BLEND_DESC { - CD3DX12_BLEND_DESC() = default; - explicit CD3DX12_BLEND_DESC(const D3D12_BLEND_DESC& o) noexcept : D3D12_BLEND_DESC(o) {} - explicit CD3DX12_BLEND_DESC(CD3DX12_DEFAULT) noexcept { - AlphaToCoverageEnable = FALSE; - IndependentBlendEnable = FALSE; - const D3D12_RENDER_TARGET_BLEND_DESC defaultRenderTargetBlendDesc = { - FALSE, - FALSE, - D3D12_BLEND_ONE, - D3D12_BLEND_ZERO, - D3D12_BLEND_OP_ADD, - D3D12_BLEND_ONE, - D3D12_BLEND_ZERO, - D3D12_BLEND_OP_ADD, - D3D12_LOGIC_OP_NOOP, - D3D12_COLOR_WRITE_ENABLE_ALL, - }; - for (UINT i = 0; i < D3D12_SIMULTANEOUS_RENDER_TARGET_COUNT; ++i) - RenderTarget[i] = defaultRenderTargetBlendDesc; - } -}; - -//------------------------------------------------------------------------------------------------ -struct CD3DX12_RASTERIZER_DESC : public D3D12_RASTERIZER_DESC { - CD3DX12_RASTERIZER_DESC() = default; - explicit CD3DX12_RASTERIZER_DESC(const D3D12_RASTERIZER_DESC& o) noexcept : D3D12_RASTERIZER_DESC(o) {} - explicit CD3DX12_RASTERIZER_DESC(CD3DX12_DEFAULT) noexcept { - FillMode = D3D12_FILL_MODE_SOLID; - CullMode = D3D12_CULL_MODE_BACK; - FrontCounterClockwise = FALSE; - DepthBias = D3D12_DEFAULT_DEPTH_BIAS; - DepthBiasClamp = D3D12_DEFAULT_DEPTH_BIAS_CLAMP; - SlopeScaledDepthBias = D3D12_DEFAULT_SLOPE_SCALED_DEPTH_BIAS; - DepthClipEnable = TRUE; - MultisampleEnable = FALSE; - AntialiasedLineEnable = FALSE; - ForcedSampleCount = 0; - ConservativeRaster = D3D12_CONSERVATIVE_RASTERIZATION_MODE_OFF; - } - explicit CD3DX12_RASTERIZER_DESC(D3D12_FILL_MODE fillMode, - D3D12_CULL_MODE cullMode, - BOOL frontCounterClockwise, - INT depthBias, - FLOAT depthBiasClamp, - FLOAT slopeScaledDepthBias, - BOOL depthClipEnable, - BOOL multisampleEnable, - BOOL antialiasedLineEnable, - UINT forcedSampleCount, - D3D12_CONSERVATIVE_RASTERIZATION_MODE conservativeRaster) noexcept { - FillMode = fillMode; - CullMode = cullMode; - FrontCounterClockwise = frontCounterClockwise; - DepthBias = depthBias; - DepthBiasClamp = depthBiasClamp; - SlopeScaledDepthBias = slopeScaledDepthBias; - DepthClipEnable = depthClipEnable; - MultisampleEnable = multisampleEnable; - AntialiasedLineEnable = antialiasedLineEnable; - ForcedSampleCount = forcedSampleCount; - ConservativeRaster = conservativeRaster; - } -}; - -//------------------------------------------------------------------------------------------------ -# if defined(D3D12_SDK_VERSION) && (D3D12_SDK_VERSION >= 608) -struct CD3DX12_RASTERIZER_DESC1 : public D3D12_RASTERIZER_DESC1 { - CD3DX12_RASTERIZER_DESC1() = default; - explicit CD3DX12_RASTERIZER_DESC1(const D3D12_RASTERIZER_DESC1& o) noexcept - : D3D12_RASTERIZER_DESC1(o) - - {} - explicit CD3DX12_RASTERIZER_DESC1(const D3D12_RASTERIZER_DESC& o) noexcept { - FillMode = o.FillMode; - CullMode = o.CullMode; - FrontCounterClockwise = o.FrontCounterClockwise; - DepthBias = static_cast(o.DepthBias); - DepthBiasClamp = o.DepthBiasClamp; - SlopeScaledDepthBias = o.SlopeScaledDepthBias; - DepthClipEnable = o.DepthClipEnable; - MultisampleEnable = o.MultisampleEnable; - AntialiasedLineEnable = o.AntialiasedLineEnable; - ForcedSampleCount = o.ForcedSampleCount; - ConservativeRaster = o.ConservativeRaster; - } - explicit CD3DX12_RASTERIZER_DESC1(CD3DX12_DEFAULT) noexcept { - FillMode = D3D12_FILL_MODE_SOLID; - CullMode = D3D12_CULL_MODE_BACK; - FrontCounterClockwise = FALSE; - DepthBias = D3D12_DEFAULT_DEPTH_BIAS; - DepthBiasClamp = D3D12_DEFAULT_DEPTH_BIAS_CLAMP; - SlopeScaledDepthBias = D3D12_DEFAULT_SLOPE_SCALED_DEPTH_BIAS; - DepthClipEnable = TRUE; - MultisampleEnable = FALSE; - AntialiasedLineEnable = FALSE; - ForcedSampleCount = 0; - ConservativeRaster = D3D12_CONSERVATIVE_RASTERIZATION_MODE_OFF; - } - explicit CD3DX12_RASTERIZER_DESC1(D3D12_FILL_MODE fillMode, - D3D12_CULL_MODE cullMode, - BOOL frontCounterClockwise, - FLOAT depthBias, - FLOAT depthBiasClamp, - FLOAT slopeScaledDepthBias, - BOOL depthClipEnable, - BOOL multisampleEnable, - BOOL antialiasedLineEnable, - UINT forcedSampleCount, - D3D12_CONSERVATIVE_RASTERIZATION_MODE conservativeRaster) noexcept { - FillMode = fillMode; - CullMode = cullMode; - FrontCounterClockwise = frontCounterClockwise; - DepthBias = depthBias; - DepthBiasClamp = depthBiasClamp; - SlopeScaledDepthBias = slopeScaledDepthBias; - DepthClipEnable = depthClipEnable; - MultisampleEnable = multisampleEnable; - AntialiasedLineEnable = antialiasedLineEnable; - ForcedSampleCount = forcedSampleCount; - ConservativeRaster = conservativeRaster; - } - - operator D3D12_RASTERIZER_DESC() const noexcept { - D3D12_RASTERIZER_DESC o; - - o.FillMode = FillMode; - o.CullMode = CullMode; - o.FrontCounterClockwise = FrontCounterClockwise; - o.DepthBias = static_cast(DepthBias); - o.DepthBiasClamp = DepthBiasClamp; - o.SlopeScaledDepthBias = SlopeScaledDepthBias; - o.DepthClipEnable = DepthClipEnable; - o.MultisampleEnable = MultisampleEnable; - o.AntialiasedLineEnable = AntialiasedLineEnable; - o.ForcedSampleCount = ForcedSampleCount; - o.ConservativeRaster = ConservativeRaster; - - return o; - } -}; -# endif // D3D12_SDK_VERSION >= 608 - -//------------------------------------------------------------------------------------------------ -# if defined(D3D12_SDK_VERSION) && (D3D12_SDK_VERSION >= 610) -struct CD3DX12_RASTERIZER_DESC2 : public D3D12_RASTERIZER_DESC2 { - CD3DX12_RASTERIZER_DESC2() = default; - explicit CD3DX12_RASTERIZER_DESC2(const D3D12_RASTERIZER_DESC2& o) noexcept - : D3D12_RASTERIZER_DESC2(o) - - {} - explicit CD3DX12_RASTERIZER_DESC2(const D3D12_RASTERIZER_DESC1& o) noexcept { - FillMode = o.FillMode; - CullMode = o.CullMode; - FrontCounterClockwise = o.FrontCounterClockwise; - DepthBias = o.DepthBias; - DepthBiasClamp = o.DepthBiasClamp; - SlopeScaledDepthBias = o.SlopeScaledDepthBias; - DepthClipEnable = o.DepthClipEnable; - LineRasterizationMode = D3D12_LINE_RASTERIZATION_MODE_ALIASED; - if (o.MultisampleEnable) { - LineRasterizationMode = D3D12_LINE_RASTERIZATION_MODE_QUADRILATERAL_WIDE; - } else if (o.AntialiasedLineEnable) { - LineRasterizationMode = D3D12_LINE_RASTERIZATION_MODE_ALPHA_ANTIALIASED; - } - ForcedSampleCount = o.ForcedSampleCount; - ConservativeRaster = o.ConservativeRaster; - } - explicit CD3DX12_RASTERIZER_DESC2(const D3D12_RASTERIZER_DESC& o) noexcept - : CD3DX12_RASTERIZER_DESC2(CD3DX12_RASTERIZER_DESC1(o)) {} - explicit CD3DX12_RASTERIZER_DESC2(CD3DX12_DEFAULT) noexcept { - FillMode = D3D12_FILL_MODE_SOLID; - CullMode = D3D12_CULL_MODE_BACK; - FrontCounterClockwise = FALSE; - DepthBias = D3D12_DEFAULT_DEPTH_BIAS; - DepthBiasClamp = D3D12_DEFAULT_DEPTH_BIAS_CLAMP; - SlopeScaledDepthBias = D3D12_DEFAULT_SLOPE_SCALED_DEPTH_BIAS; - DepthClipEnable = TRUE; - LineRasterizationMode = D3D12_LINE_RASTERIZATION_MODE_ALIASED; - ForcedSampleCount = 0; - ConservativeRaster = D3D12_CONSERVATIVE_RASTERIZATION_MODE_OFF; - } - explicit CD3DX12_RASTERIZER_DESC2(D3D12_FILL_MODE fillMode, - D3D12_CULL_MODE cullMode, - BOOL frontCounterClockwise, - FLOAT depthBias, - FLOAT depthBiasClamp, - FLOAT slopeScaledDepthBias, - BOOL depthClipEnable, - D3D12_LINE_RASTERIZATION_MODE lineRasterizationMode, - UINT forcedSampleCount, - D3D12_CONSERVATIVE_RASTERIZATION_MODE conservativeRaster) noexcept { - FillMode = fillMode; - CullMode = cullMode; - FrontCounterClockwise = frontCounterClockwise; - DepthBias = depthBias; - DepthBiasClamp = depthBiasClamp; - SlopeScaledDepthBias = slopeScaledDepthBias; - DepthClipEnable = depthClipEnable; - LineRasterizationMode = lineRasterizationMode; - ForcedSampleCount = forcedSampleCount; - ConservativeRaster = conservativeRaster; - } - - operator D3D12_RASTERIZER_DESC1() const noexcept { - D3D12_RASTERIZER_DESC1 o; - - o.FillMode = FillMode; - o.CullMode = CullMode; - o.FrontCounterClockwise = FrontCounterClockwise; - o.DepthBias = DepthBias; - o.DepthBiasClamp = DepthBiasClamp; - o.SlopeScaledDepthBias = SlopeScaledDepthBias; - o.DepthClipEnable = DepthClipEnable; - o.MultisampleEnable = FALSE; - o.AntialiasedLineEnable = FALSE; - if (LineRasterizationMode == D3D12_LINE_RASTERIZATION_MODE_ALPHA_ANTIALIASED) { - o.AntialiasedLineEnable = TRUE; - } else if (LineRasterizationMode != D3D12_LINE_RASTERIZATION_MODE_ALIASED) { - o.MultisampleEnable = TRUE; - } - o.ForcedSampleCount = ForcedSampleCount; - o.ConservativeRaster = ConservativeRaster; - - return o; - } - operator D3D12_RASTERIZER_DESC() const noexcept { - return static_cast(CD3DX12_RASTERIZER_DESC1(static_cast(*this))); - } -}; -# endif // D3D12_SDK_VERSION >= 610 - -//------------------------------------------------------------------------------------------------ -struct CD3DX12_RESOURCE_ALLOCATION_INFO : public D3D12_RESOURCE_ALLOCATION_INFO { - CD3DX12_RESOURCE_ALLOCATION_INFO() = default; - explicit CD3DX12_RESOURCE_ALLOCATION_INFO(const D3D12_RESOURCE_ALLOCATION_INFO& o) noexcept - : D3D12_RESOURCE_ALLOCATION_INFO(o) {} - CD3DX12_RESOURCE_ALLOCATION_INFO(UINT64 size, UINT64 alignment) noexcept { - SizeInBytes = size; - Alignment = alignment; - } -}; - -//------------------------------------------------------------------------------------------------ -struct CD3DX12_HEAP_PROPERTIES : public D3D12_HEAP_PROPERTIES { - CD3DX12_HEAP_PROPERTIES() = default; - explicit CD3DX12_HEAP_PROPERTIES(const D3D12_HEAP_PROPERTIES& o) noexcept : D3D12_HEAP_PROPERTIES(o) {} - CD3DX12_HEAP_PROPERTIES(D3D12_CPU_PAGE_PROPERTY cpuPageProperty, - D3D12_MEMORY_POOL memoryPoolPreference, - UINT creationNodeMask = 1, - UINT nodeMask = 1) - noexcept { - Type = D3D12_HEAP_TYPE_CUSTOM; - CPUPageProperty = cpuPageProperty; - MemoryPoolPreference = memoryPoolPreference; - CreationNodeMask = creationNodeMask; - VisibleNodeMask = nodeMask; - } - explicit CD3DX12_HEAP_PROPERTIES(D3D12_HEAP_TYPE type, UINT creationNodeMask = 1, UINT nodeMask = 1) noexcept { - Type = type; - CPUPageProperty = D3D12_CPU_PAGE_PROPERTY_UNKNOWN; - MemoryPoolPreference = D3D12_MEMORY_POOL_UNKNOWN; - CreationNodeMask = creationNodeMask; - VisibleNodeMask = nodeMask; - } - bool IsCPUAccessible() const noexcept { - return Type == D3D12_HEAP_TYPE_UPLOAD || Type == D3D12_HEAP_TYPE_READBACK -# if defined(D3D12_SDK_VERSION) && (D3D12_SDK_VERSION >= 609) - || Type == D3D12_HEAP_TYPE_GPU_UPLOAD -# endif - || (Type == D3D12_HEAP_TYPE_CUSTOM && (CPUPageProperty == D3D12_CPU_PAGE_PROPERTY_WRITE_COMBINE || - CPUPageProperty == D3D12_CPU_PAGE_PROPERTY_WRITE_BACK)); - } -}; -inline bool operator==(const D3D12_HEAP_PROPERTIES& l, const D3D12_HEAP_PROPERTIES& r) noexcept { - return l.Type == r.Type && l.CPUPageProperty == r.CPUPageProperty && - l.MemoryPoolPreference == r.MemoryPoolPreference && l.CreationNodeMask == r.CreationNodeMask && - l.VisibleNodeMask == r.VisibleNodeMask; -} -inline bool operator!=(const D3D12_HEAP_PROPERTIES& l, const D3D12_HEAP_PROPERTIES& r) noexcept { - return !(l == r); -} - -//------------------------------------------------------------------------------------------------ -struct CD3DX12_HEAP_DESC : public D3D12_HEAP_DESC { - CD3DX12_HEAP_DESC() = default; - explicit CD3DX12_HEAP_DESC(const D3D12_HEAP_DESC& o) noexcept : D3D12_HEAP_DESC(o) {} - CD3DX12_HEAP_DESC(UINT64 size, - D3D12_HEAP_PROPERTIES properties, - UINT64 alignment = 0, - D3D12_HEAP_FLAGS flags = D3D12_HEAP_FLAG_NONE) - noexcept { - SizeInBytes = size; - Properties = properties; - Alignment = alignment; - Flags = flags; - } - CD3DX12_HEAP_DESC(UINT64 size, - D3D12_HEAP_TYPE type, - UINT64 alignment = 0, - D3D12_HEAP_FLAGS flags = D3D12_HEAP_FLAG_NONE) - noexcept { - SizeInBytes = size; - Properties = CD3DX12_HEAP_PROPERTIES(type); - Alignment = alignment; - Flags = flags; - } - CD3DX12_HEAP_DESC(UINT64 size, - D3D12_CPU_PAGE_PROPERTY cpuPageProperty, - D3D12_MEMORY_POOL memoryPoolPreference, - UINT64 alignment = 0, - D3D12_HEAP_FLAGS flags = D3D12_HEAP_FLAG_NONE) - noexcept { - SizeInBytes = size; - Properties = CD3DX12_HEAP_PROPERTIES(cpuPageProperty, memoryPoolPreference); - Alignment = alignment; - Flags = flags; - } - CD3DX12_HEAP_DESC(const D3D12_RESOURCE_ALLOCATION_INFO& resAllocInfo, - D3D12_HEAP_PROPERTIES properties, - D3D12_HEAP_FLAGS flags = D3D12_HEAP_FLAG_NONE) - noexcept { - SizeInBytes = resAllocInfo.SizeInBytes; - Properties = properties; - Alignment = resAllocInfo.Alignment; - Flags = flags; - } - CD3DX12_HEAP_DESC(const D3D12_RESOURCE_ALLOCATION_INFO& resAllocInfo, - D3D12_HEAP_TYPE type, - D3D12_HEAP_FLAGS flags = D3D12_HEAP_FLAG_NONE) - noexcept { - SizeInBytes = resAllocInfo.SizeInBytes; - Properties = CD3DX12_HEAP_PROPERTIES(type); - Alignment = resAllocInfo.Alignment; - Flags = flags; - } - CD3DX12_HEAP_DESC(const D3D12_RESOURCE_ALLOCATION_INFO& resAllocInfo, - D3D12_CPU_PAGE_PROPERTY cpuPageProperty, - D3D12_MEMORY_POOL memoryPoolPreference, - D3D12_HEAP_FLAGS flags = D3D12_HEAP_FLAG_NONE) - noexcept { - SizeInBytes = resAllocInfo.SizeInBytes; - Properties = CD3DX12_HEAP_PROPERTIES(cpuPageProperty, memoryPoolPreference); - Alignment = resAllocInfo.Alignment; - Flags = flags; - } - bool IsCPUAccessible() const noexcept { - return static_cast(&Properties)->IsCPUAccessible(); - } -}; -inline bool operator==(const D3D12_HEAP_DESC& l, const D3D12_HEAP_DESC& r) noexcept { - return l.SizeInBytes == r.SizeInBytes && l.Properties == r.Properties && l.Alignment == r.Alignment && - l.Flags == r.Flags; -} -inline bool operator!=(const D3D12_HEAP_DESC& l, const D3D12_HEAP_DESC& r) noexcept { - return !(l == r); -} - -//------------------------------------------------------------------------------------------------ -struct CD3DX12_CLEAR_VALUE : public D3D12_CLEAR_VALUE { - CD3DX12_CLEAR_VALUE() = default; - explicit CD3DX12_CLEAR_VALUE(const D3D12_CLEAR_VALUE& o) noexcept : D3D12_CLEAR_VALUE(o) {} - CD3DX12_CLEAR_VALUE(DXGI_FORMAT format, const FLOAT color[4]) noexcept { - Format = format; - memcpy(Color, color, sizeof(Color)); - } - CD3DX12_CLEAR_VALUE(DXGI_FORMAT format, FLOAT depth, UINT8 stencil) noexcept { - Format = format; - memset(&Color, 0, sizeof(Color)); - /* Use memcpy to preserve NAN values */ - memcpy(&DepthStencil.Depth, &depth, sizeof(depth)); - DepthStencil.Stencil = stencil; - } -}; - -//------------------------------------------------------------------------------------------------ -inline bool operator==(const D3D12_CLEAR_VALUE& a, const D3D12_CLEAR_VALUE& b) noexcept { - if (a.Format != b.Format) - return false; - if (a.Format == DXGI_FORMAT_D24_UNORM_S8_UINT || a.Format == DXGI_FORMAT_D16_UNORM || - a.Format == DXGI_FORMAT_D32_FLOAT || a.Format == DXGI_FORMAT_D32_FLOAT_S8X24_UINT) { - return (a.DepthStencil.Depth == b.DepthStencil.Depth) && (a.DepthStencil.Stencil == b.DepthStencil.Stencil); - } else { - return (a.Color[0] == b.Color[0]) && (a.Color[1] == b.Color[1]) && (a.Color[2] == b.Color[2]) && - (a.Color[3] == b.Color[3]); - } -} - -//------------------------------------------------------------------------------------------------ -struct CD3DX12_RANGE : public D3D12_RANGE { - CD3DX12_RANGE() = default; - explicit CD3DX12_RANGE(const D3D12_RANGE& o) noexcept : D3D12_RANGE(o) {} - CD3DX12_RANGE(SIZE_T begin, SIZE_T end) noexcept { - Begin = begin; - End = end; - } -}; - -//------------------------------------------------------------------------------------------------ -struct CD3DX12_RANGE_UINT64 : public D3D12_RANGE_UINT64 { - CD3DX12_RANGE_UINT64() = default; - explicit CD3DX12_RANGE_UINT64(const D3D12_RANGE_UINT64& o) noexcept : D3D12_RANGE_UINT64(o) {} - CD3DX12_RANGE_UINT64(UINT64 begin, UINT64 end) noexcept { - Begin = begin; - End = end; - } -}; - -//------------------------------------------------------------------------------------------------ -struct CD3DX12_SUBRESOURCE_RANGE_UINT64 : public D3D12_SUBRESOURCE_RANGE_UINT64 { - CD3DX12_SUBRESOURCE_RANGE_UINT64() = default; - explicit CD3DX12_SUBRESOURCE_RANGE_UINT64(const D3D12_SUBRESOURCE_RANGE_UINT64& o) noexcept - : D3D12_SUBRESOURCE_RANGE_UINT64(o) {} - CD3DX12_SUBRESOURCE_RANGE_UINT64(UINT subresource, const D3D12_RANGE_UINT64& range) noexcept { - Subresource = subresource; - Range = range; - } - CD3DX12_SUBRESOURCE_RANGE_UINT64(UINT subresource, UINT64 begin, UINT64 end) noexcept { - Subresource = subresource; - Range.Begin = begin; - Range.End = end; - } -}; - -//------------------------------------------------------------------------------------------------ -struct CD3DX12_SHADER_BYTECODE : public D3D12_SHADER_BYTECODE { - CD3DX12_SHADER_BYTECODE() = default; - explicit CD3DX12_SHADER_BYTECODE(const D3D12_SHADER_BYTECODE& o) noexcept : D3D12_SHADER_BYTECODE(o) {} - CD3DX12_SHADER_BYTECODE(_In_ ID3DBlob* pShaderBlob) noexcept { - pShaderBytecode = pShaderBlob->GetBufferPointer(); - BytecodeLength = pShaderBlob->GetBufferSize(); - } - CD3DX12_SHADER_BYTECODE(const void* _pShaderBytecode, SIZE_T bytecodeLength) noexcept { - pShaderBytecode = _pShaderBytecode; - BytecodeLength = bytecodeLength; - } -}; - -//------------------------------------------------------------------------------------------------ -struct CD3DX12_TILED_RESOURCE_COORDINATE : public D3D12_TILED_RESOURCE_COORDINATE { - CD3DX12_TILED_RESOURCE_COORDINATE() = default; - explicit CD3DX12_TILED_RESOURCE_COORDINATE(const D3D12_TILED_RESOURCE_COORDINATE& o) noexcept - : D3D12_TILED_RESOURCE_COORDINATE(o) {} - CD3DX12_TILED_RESOURCE_COORDINATE(UINT x, UINT y, UINT z, UINT subresource) noexcept { - X = x; - Y = y; - Z = z; - Subresource = subresource; - } -}; - -//------------------------------------------------------------------------------------------------ -struct CD3DX12_TILE_REGION_SIZE : public D3D12_TILE_REGION_SIZE { - CD3DX12_TILE_REGION_SIZE() = default; - explicit CD3DX12_TILE_REGION_SIZE(const D3D12_TILE_REGION_SIZE& o) noexcept : D3D12_TILE_REGION_SIZE(o) {} - CD3DX12_TILE_REGION_SIZE(UINT numTiles, BOOL useBox, UINT width, UINT16 height, UINT16 depth) noexcept { - NumTiles = numTiles; - UseBox = useBox; - Width = width; - Height = height; - Depth = depth; - } -}; - -//------------------------------------------------------------------------------------------------ -struct CD3DX12_SUBRESOURCE_TILING : public D3D12_SUBRESOURCE_TILING { - CD3DX12_SUBRESOURCE_TILING() = default; - explicit CD3DX12_SUBRESOURCE_TILING(const D3D12_SUBRESOURCE_TILING& o) noexcept : D3D12_SUBRESOURCE_TILING(o) {} - CD3DX12_SUBRESOURCE_TILING(UINT widthInTiles, - UINT16 heightInTiles, - UINT16 depthInTiles, - UINT startTileIndexInOverallResource) - noexcept { - WidthInTiles = widthInTiles; - HeightInTiles = heightInTiles; - DepthInTiles = depthInTiles; - StartTileIndexInOverallResource = startTileIndexInOverallResource; - } -}; - -//------------------------------------------------------------------------------------------------ -struct CD3DX12_TILE_SHAPE : public D3D12_TILE_SHAPE { - CD3DX12_TILE_SHAPE() = default; - explicit CD3DX12_TILE_SHAPE(const D3D12_TILE_SHAPE& o) noexcept : D3D12_TILE_SHAPE(o) {} - CD3DX12_TILE_SHAPE(UINT widthInTexels, UINT heightInTexels, UINT depthInTexels) noexcept { - WidthInTexels = widthInTexels; - HeightInTexels = heightInTexels; - DepthInTexels = depthInTexels; - } -}; - -//------------------------------------------------------------------------------------------------ -struct CD3DX12_PACKED_MIP_INFO : public D3D12_PACKED_MIP_INFO { - CD3DX12_PACKED_MIP_INFO() = default; - explicit CD3DX12_PACKED_MIP_INFO(const D3D12_PACKED_MIP_INFO& o) noexcept : D3D12_PACKED_MIP_INFO(o) {} - CD3DX12_PACKED_MIP_INFO(UINT8 numStandardMips, - UINT8 numPackedMips, - UINT numTilesForPackedMips, - UINT startTileIndexInOverallResource) - noexcept { - NumStandardMips = numStandardMips; - NumPackedMips = numPackedMips; - NumTilesForPackedMips = numTilesForPackedMips; - StartTileIndexInOverallResource = startTileIndexInOverallResource; - } -}; - -//------------------------------------------------------------------------------------------------ -struct CD3DX12_SUBRESOURCE_FOOTPRINT : public D3D12_SUBRESOURCE_FOOTPRINT { - CD3DX12_SUBRESOURCE_FOOTPRINT() = default; - explicit CD3DX12_SUBRESOURCE_FOOTPRINT(const D3D12_SUBRESOURCE_FOOTPRINT& o) noexcept - : D3D12_SUBRESOURCE_FOOTPRINT(o) {} - CD3DX12_SUBRESOURCE_FOOTPRINT(DXGI_FORMAT format, UINT width, UINT height, UINT depth, UINT rowPitch) noexcept { - Format = format; - Width = width; - Height = height; - Depth = depth; - RowPitch = rowPitch; - } - explicit CD3DX12_SUBRESOURCE_FOOTPRINT(const D3D12_RESOURCE_DESC& resDesc, UINT rowPitch) noexcept { - Format = resDesc.Format; - Width = UINT(resDesc.Width); - Height = resDesc.Height; - Depth = (resDesc.Dimension == D3D12_RESOURCE_DIMENSION_TEXTURE3D ? resDesc.DepthOrArraySize : 1u); - RowPitch = rowPitch; - } -}; - -//------------------------------------------------------------------------------------------------ -struct CD3DX12_TEXTURE_COPY_LOCATION : public D3D12_TEXTURE_COPY_LOCATION { - CD3DX12_TEXTURE_COPY_LOCATION() = default; - explicit CD3DX12_TEXTURE_COPY_LOCATION(const D3D12_TEXTURE_COPY_LOCATION& o) noexcept - : D3D12_TEXTURE_COPY_LOCATION(o) {} - CD3DX12_TEXTURE_COPY_LOCATION(_In_ ID3D12Resource* pRes) noexcept { - pResource = pRes; - Type = D3D12_TEXTURE_COPY_TYPE_SUBRESOURCE_INDEX; - PlacedFootprint = {}; - } - CD3DX12_TEXTURE_COPY_LOCATION(_In_ ID3D12Resource* pRes, D3D12_PLACED_SUBRESOURCE_FOOTPRINT const& Footprint) - noexcept { - pResource = pRes; - Type = D3D12_TEXTURE_COPY_TYPE_PLACED_FOOTPRINT; - PlacedFootprint = Footprint; - } - CD3DX12_TEXTURE_COPY_LOCATION(_In_ ID3D12Resource* pRes, UINT Sub) noexcept { - pResource = pRes; - Type = D3D12_TEXTURE_COPY_TYPE_SUBRESOURCE_INDEX; - PlacedFootprint = {}; - SubresourceIndex = Sub; - } -}; - -//------------------------------------------------------------------------------------------------ -constexpr UINT D3D12CalcSubresource(UINT MipSlice, - UINT ArraySlice, - UINT PlaneSlice, - UINT MipLevels, - UINT ArraySize) noexcept { - return MipSlice + ArraySlice * MipLevels + PlaneSlice * MipLevels * ArraySize; -} - -//------------------------------------------------------------------------------------------------ -inline UINT8 D3D12GetFormatPlaneCount(_In_ ID3D12Device* pDevice, DXGI_FORMAT Format) noexcept { - D3D12_FEATURE_DATA_FORMAT_INFO formatInfo = {Format, 0}; - if (FAILED(pDevice->CheckFeatureSupport(D3D12_FEATURE_FORMAT_INFO, &formatInfo, sizeof(formatInfo)))) { - return 0; - } - return formatInfo.PlaneCount; -} - -//------------------------------------------------------------------------------------------------ -struct CD3DX12_RESOURCE_DESC : public D3D12_RESOURCE_DESC { - CD3DX12_RESOURCE_DESC() = default; - explicit CD3DX12_RESOURCE_DESC(const D3D12_RESOURCE_DESC& o) noexcept : D3D12_RESOURCE_DESC(o) {} - CD3DX12_RESOURCE_DESC(D3D12_RESOURCE_DIMENSION dimension, - UINT64 alignment, - UINT64 width, - UINT height, - UINT16 depthOrArraySize, - UINT16 mipLevels, - DXGI_FORMAT format, - UINT sampleCount, - UINT sampleQuality, - D3D12_TEXTURE_LAYOUT layout, - D3D12_RESOURCE_FLAGS flags) - noexcept { - Dimension = dimension; - Alignment = alignment; - Width = width; - Height = height; - DepthOrArraySize = depthOrArraySize; - MipLevels = mipLevels; - Format = format; - SampleDesc.Count = sampleCount; - SampleDesc.Quality = sampleQuality; - Layout = layout; - Flags = flags; - } - static inline CD3DX12_RESOURCE_DESC Buffer(const D3D12_RESOURCE_ALLOCATION_INFO& resAllocInfo, - D3D12_RESOURCE_FLAGS flags = D3D12_RESOURCE_FLAG_NONE) noexcept { - return CD3DX12_RESOURCE_DESC(D3D12_RESOURCE_DIMENSION_BUFFER, - resAllocInfo.Alignment, - resAllocInfo.SizeInBytes, - 1, - 1, - 1, - DXGI_FORMAT_UNKNOWN, - 1, - 0, - D3D12_TEXTURE_LAYOUT_ROW_MAJOR, - flags); - } - static inline CD3DX12_RESOURCE_DESC Buffer(UINT64 width, - D3D12_RESOURCE_FLAGS flags = D3D12_RESOURCE_FLAG_NONE, - UINT64 alignment = 0) noexcept { - return CD3DX12_RESOURCE_DESC(D3D12_RESOURCE_DIMENSION_BUFFER, - alignment, - width, - 1, - 1, - 1, - DXGI_FORMAT_UNKNOWN, - 1, - 0, - D3D12_TEXTURE_LAYOUT_ROW_MAJOR, - flags); - } - static inline CD3DX12_RESOURCE_DESC Tex1D(DXGI_FORMAT format, - UINT64 width, - UINT16 arraySize = 1, - UINT16 mipLevels = 0, - D3D12_RESOURCE_FLAGS flags = D3D12_RESOURCE_FLAG_NONE, - D3D12_TEXTURE_LAYOUT layout = D3D12_TEXTURE_LAYOUT_UNKNOWN, - UINT64 alignment = 0) noexcept { - return CD3DX12_RESOURCE_DESC(D3D12_RESOURCE_DIMENSION_TEXTURE1D, - alignment, - width, - 1, - arraySize, - mipLevels, - format, - 1, - 0, - layout, - flags); - } - static inline CD3DX12_RESOURCE_DESC Tex2D(DXGI_FORMAT format, - UINT64 width, - UINT height, - UINT16 arraySize = 1, - UINT16 mipLevels = 0, - UINT sampleCount = 1, - UINT sampleQuality = 0, - D3D12_RESOURCE_FLAGS flags = D3D12_RESOURCE_FLAG_NONE, - D3D12_TEXTURE_LAYOUT layout = D3D12_TEXTURE_LAYOUT_UNKNOWN, - UINT64 alignment = 0) noexcept { - return CD3DX12_RESOURCE_DESC(D3D12_RESOURCE_DIMENSION_TEXTURE2D, - alignment, - width, - height, - arraySize, - mipLevels, - format, - sampleCount, - sampleQuality, - layout, - flags); - } - static inline CD3DX12_RESOURCE_DESC Tex3D(DXGI_FORMAT format, - UINT64 width, - UINT height, - UINT16 depth, - UINT16 mipLevels = 0, - D3D12_RESOURCE_FLAGS flags = D3D12_RESOURCE_FLAG_NONE, - D3D12_TEXTURE_LAYOUT layout = D3D12_TEXTURE_LAYOUT_UNKNOWN, - UINT64 alignment = 0) noexcept { - return CD3DX12_RESOURCE_DESC(D3D12_RESOURCE_DIMENSION_TEXTURE3D, - alignment, - width, - height, - depth, - mipLevels, - format, - 1, - 0, - layout, - flags); - } - inline UINT16 Depth() const noexcept { - return (Dimension == D3D12_RESOURCE_DIMENSION_TEXTURE3D ? DepthOrArraySize : 1u); - } - inline UINT16 ArraySize() const noexcept { - return (Dimension != D3D12_RESOURCE_DIMENSION_TEXTURE3D ? DepthOrArraySize : 1u); - } - inline UINT8 PlaneCount(_In_ ID3D12Device* pDevice) const noexcept { - return D3D12GetFormatPlaneCount(pDevice, Format); - } - inline UINT Subresources(_In_ ID3D12Device* pDevice) const noexcept { - return static_cast(MipLevels) * ArraySize() * PlaneCount(pDevice); - } - inline UINT CalcSubresource(UINT MipSlice, UINT ArraySlice, UINT PlaneSlice) noexcept { - return D3D12CalcSubresource(MipSlice, ArraySlice, PlaneSlice, MipLevels, ArraySize()); - } -}; -inline bool operator==(const D3D12_RESOURCE_DESC& l, const D3D12_RESOURCE_DESC& r) noexcept { - return l.Dimension == r.Dimension && l.Alignment == r.Alignment && l.Width == r.Width && l.Height == r.Height && - l.DepthOrArraySize == r.DepthOrArraySize && l.MipLevels == r.MipLevels && l.Format == r.Format && - l.SampleDesc.Count == r.SampleDesc.Count && l.SampleDesc.Quality == r.SampleDesc.Quality && - l.Layout == r.Layout && l.Flags == r.Flags; -} -inline bool operator!=(const D3D12_RESOURCE_DESC& l, const D3D12_RESOURCE_DESC& r) noexcept { - return !(l == r); -} - -//------------------------------------------------------------------------------------------------ -struct CD3DX12_RESOURCE_DESC1 : public D3D12_RESOURCE_DESC1 { - CD3DX12_RESOURCE_DESC1() = default; - explicit CD3DX12_RESOURCE_DESC1(const D3D12_RESOURCE_DESC1& o) noexcept : D3D12_RESOURCE_DESC1(o) {} - explicit CD3DX12_RESOURCE_DESC1(const D3D12_RESOURCE_DESC& o) noexcept { - Dimension = o.Dimension; - Alignment = o.Alignment; - Width = o.Width; - Height = o.Height; - DepthOrArraySize = o.DepthOrArraySize; - MipLevels = o.MipLevels; - Format = o.Format; - SampleDesc = o.SampleDesc; - Layout = o.Layout; - Flags = o.Flags; - SamplerFeedbackMipRegion = {}; - } - CD3DX12_RESOURCE_DESC1(D3D12_RESOURCE_DIMENSION dimension, - UINT64 alignment, - UINT64 width, - UINT height, - UINT16 depthOrArraySize, - UINT16 mipLevels, - DXGI_FORMAT format, - UINT sampleCount, - UINT sampleQuality, - D3D12_TEXTURE_LAYOUT layout, - D3D12_RESOURCE_FLAGS flags, - UINT samplerFeedbackMipRegionWidth = 0, - UINT samplerFeedbackMipRegionHeight = 0, - UINT samplerFeedbackMipRegionDepth = 0) - noexcept { - Dimension = dimension; - Alignment = alignment; - Width = width; - Height = height; - DepthOrArraySize = depthOrArraySize; - MipLevels = mipLevels; - Format = format; - SampleDesc.Count = sampleCount; - SampleDesc.Quality = sampleQuality; - Layout = layout; - Flags = flags; - SamplerFeedbackMipRegion.Width = samplerFeedbackMipRegionWidth; - SamplerFeedbackMipRegion.Height = samplerFeedbackMipRegionHeight; - SamplerFeedbackMipRegion.Depth = samplerFeedbackMipRegionDepth; - } - - static inline CD3DX12_RESOURCE_DESC1 Buffer(const D3D12_RESOURCE_ALLOCATION_INFO& resAllocInfo, - D3D12_RESOURCE_FLAGS flags = D3D12_RESOURCE_FLAG_NONE) noexcept { - return CD3DX12_RESOURCE_DESC1(D3D12_RESOURCE_DIMENSION_BUFFER, - resAllocInfo.Alignment, - resAllocInfo.SizeInBytes, - 1, - 1, - 1, - DXGI_FORMAT_UNKNOWN, - 1, - 0, - D3D12_TEXTURE_LAYOUT_ROW_MAJOR, - flags, - 0, - 0, - 0); - } - static inline CD3DX12_RESOURCE_DESC1 Buffer(UINT64 width, - D3D12_RESOURCE_FLAGS flags = D3D12_RESOURCE_FLAG_NONE, - UINT64 alignment = 0) noexcept { - return CD3DX12_RESOURCE_DESC1(D3D12_RESOURCE_DIMENSION_BUFFER, - alignment, - width, - 1, - 1, - 1, - DXGI_FORMAT_UNKNOWN, - 1, - 0, - D3D12_TEXTURE_LAYOUT_ROW_MAJOR, - flags, - 0, - 0, - 0); - } - static inline CD3DX12_RESOURCE_DESC1 Tex1D(DXGI_FORMAT format, - UINT64 width, - UINT16 arraySize = 1, - UINT16 mipLevels = 0, - D3D12_RESOURCE_FLAGS flags = D3D12_RESOURCE_FLAG_NONE, - D3D12_TEXTURE_LAYOUT layout = D3D12_TEXTURE_LAYOUT_UNKNOWN, - UINT64 alignment = 0) noexcept { - return CD3DX12_RESOURCE_DESC1(D3D12_RESOURCE_DIMENSION_TEXTURE1D, - alignment, - width, - 1, - arraySize, - mipLevels, - format, - 1, - 0, - layout, - flags, - 0, - 0, - 0); - } - static inline CD3DX12_RESOURCE_DESC1 Tex2D(DXGI_FORMAT format, - UINT64 width, - UINT height, - UINT16 arraySize = 1, - UINT16 mipLevels = 0, - UINT sampleCount = 1, - UINT sampleQuality = 0, - D3D12_RESOURCE_FLAGS flags = D3D12_RESOURCE_FLAG_NONE, - D3D12_TEXTURE_LAYOUT layout = D3D12_TEXTURE_LAYOUT_UNKNOWN, - UINT64 alignment = 0, - UINT samplerFeedbackMipRegionWidth = 0, - UINT samplerFeedbackMipRegionHeight = 0, - UINT samplerFeedbackMipRegionDepth = 0) noexcept { - return CD3DX12_RESOURCE_DESC1(D3D12_RESOURCE_DIMENSION_TEXTURE2D, - alignment, - width, - height, - arraySize, - mipLevels, - format, - sampleCount, - sampleQuality, - layout, - flags, - samplerFeedbackMipRegionWidth, - samplerFeedbackMipRegionHeight, - samplerFeedbackMipRegionDepth); - } - static inline CD3DX12_RESOURCE_DESC1 Tex3D(DXGI_FORMAT format, - UINT64 width, - UINT height, - UINT16 depth, - UINT16 mipLevels = 0, - D3D12_RESOURCE_FLAGS flags = D3D12_RESOURCE_FLAG_NONE, - D3D12_TEXTURE_LAYOUT layout = D3D12_TEXTURE_LAYOUT_UNKNOWN, - UINT64 alignment = 0) noexcept { - return CD3DX12_RESOURCE_DESC1(D3D12_RESOURCE_DIMENSION_TEXTURE3D, - alignment, - width, - height, - depth, - mipLevels, - format, - 1, - 0, - layout, - flags, - 0, - 0, - 0); - } - inline UINT16 Depth() const noexcept { - return (Dimension == D3D12_RESOURCE_DIMENSION_TEXTURE3D ? DepthOrArraySize : 1u); - } - inline UINT16 ArraySize() const noexcept { - return (Dimension != D3D12_RESOURCE_DIMENSION_TEXTURE3D ? DepthOrArraySize : 1u); - } - inline UINT8 PlaneCount(_In_ ID3D12Device* pDevice) const noexcept { - return D3D12GetFormatPlaneCount(pDevice, Format); - } - inline UINT Subresources(_In_ ID3D12Device* pDevice) const noexcept { - return static_cast(MipLevels) * ArraySize() * PlaneCount(pDevice); - } - inline UINT CalcSubresource(UINT MipSlice, UINT ArraySlice, UINT PlaneSlice) noexcept { - return D3D12CalcSubresource(MipSlice, ArraySlice, PlaneSlice, MipLevels, ArraySize()); - } -}; -inline bool operator==(const D3D12_RESOURCE_DESC1& l, const D3D12_RESOURCE_DESC1& r) noexcept { - return l.Dimension == r.Dimension && l.Alignment == r.Alignment && l.Width == r.Width && l.Height == r.Height && - l.DepthOrArraySize == r.DepthOrArraySize && l.MipLevels == r.MipLevels && l.Format == r.Format && - l.SampleDesc.Count == r.SampleDesc.Count && l.SampleDesc.Quality == r.SampleDesc.Quality && - l.Layout == r.Layout && l.Flags == r.Flags && - l.SamplerFeedbackMipRegion.Width == r.SamplerFeedbackMipRegion.Width && - l.SamplerFeedbackMipRegion.Height == r.SamplerFeedbackMipRegion.Height && - l.SamplerFeedbackMipRegion.Depth == r.SamplerFeedbackMipRegion.Depth; -} -inline bool operator!=(const D3D12_RESOURCE_DESC1& l, const D3D12_RESOURCE_DESC1& r) noexcept { - return !(l == r); -} - -//------------------------------------------------------------------------------------------------ -// Fills in the mipmap and alignment values of pDesc when either members are zero -// Used to replace an implicit field to an explicit (0 mip map = max mip map level) -// If expansion has occured, returns LclDesc, else returns the original pDesc -inline const CD3DX12_RESOURCE_DESC1* D3DX12ConditionallyExpandAPIDesc(CD3DX12_RESOURCE_DESC1& LclDesc, - const CD3DX12_RESOURCE_DESC1* pDesc) { - // Expand mip levels: - if (pDesc->MipLevels == 0 || pDesc->Alignment == 0) { - LclDesc = *pDesc; - if (pDesc->MipLevels == 0) { - auto MaxMipLevels = [](UINT64 uiMaxDimension) -> UINT16 { - UINT16 uiRet = 0; - while (uiMaxDimension > 0) { - uiRet++; - uiMaxDimension >>= 1; - } - return uiRet; - }; - auto Max = [](UINT64 const& a, UINT64 const& b) { - return (a < b) ? b : a; - }; - - LclDesc.MipLevels = - MaxMipLevels(Max(LclDesc.Dimension == D3D12_RESOURCE_DIMENSION_TEXTURE3D ? LclDesc.DepthOrArraySize : 1, - Max(LclDesc.Width, LclDesc.Height))); - } - if (pDesc->Alignment == 0) { - if (pDesc->Layout == D3D12_TEXTURE_LAYOUT_64KB_UNDEFINED_SWIZZLE || - pDesc->Layout == D3D12_TEXTURE_LAYOUT_64KB_STANDARD_SWIZZLE) { - LclDesc.Alignment = D3D12_DEFAULT_RESOURCE_PLACEMENT_ALIGNMENT; - } else { - LclDesc.Alignment = (pDesc->SampleDesc.Count > 1 ? D3D12_DEFAULT_MSAA_RESOURCE_PLACEMENT_ALIGNMENT - : D3D12_DEFAULT_RESOURCE_PLACEMENT_ALIGNMENT); - } - } - return &LclDesc; - } else { - return pDesc; - } -} - -//------------------------------------------------------------------------------------------------ -struct CD3DX12_VIEW_INSTANCING_DESC : public D3D12_VIEW_INSTANCING_DESC { - CD3DX12_VIEW_INSTANCING_DESC() = default; - explicit CD3DX12_VIEW_INSTANCING_DESC(const D3D12_VIEW_INSTANCING_DESC& o) noexcept - : D3D12_VIEW_INSTANCING_DESC(o) {} - explicit CD3DX12_VIEW_INSTANCING_DESC(CD3DX12_DEFAULT) noexcept { - ViewInstanceCount = 0; - pViewInstanceLocations = nullptr; - Flags = D3D12_VIEW_INSTANCING_FLAG_NONE; - } - explicit CD3DX12_VIEW_INSTANCING_DESC(UINT InViewInstanceCount, - const D3D12_VIEW_INSTANCE_LOCATION* InViewInstanceLocations, - D3D12_VIEW_INSTANCING_FLAGS InFlags) noexcept { - ViewInstanceCount = InViewInstanceCount; - pViewInstanceLocations = InViewInstanceLocations; - Flags = InFlags; - } -}; - -//------------------------------------------------------------------------------------------------ -struct CD3DX12_RT_FORMAT_ARRAY : public D3D12_RT_FORMAT_ARRAY { - CD3DX12_RT_FORMAT_ARRAY() = default; - explicit CD3DX12_RT_FORMAT_ARRAY(const D3D12_RT_FORMAT_ARRAY& o) noexcept : D3D12_RT_FORMAT_ARRAY(o) {} - explicit CD3DX12_RT_FORMAT_ARRAY(_In_reads_(NumFormats) const DXGI_FORMAT* pFormats, UINT NumFormats) noexcept { - NumRenderTargets = NumFormats; - memcpy(RTFormats, pFormats, sizeof(RTFormats)); - // assumes ARRAY_SIZE(pFormats) == ARRAY_SIZE(RTFormats) - } -}; - -#endif diff --git a/src/plugins/intel_npu/tests/functional/behavior/remote_tensor_tests/d3dx12_default.h b/src/plugins/intel_npu/tests/functional/behavior/remote_tensor_tests/d3dx12_default.h deleted file mode 100644 index 2ae8f5c4bee1f6..00000000000000 --- a/src/plugins/intel_npu/tests/functional/behavior/remote_tensor_tests/d3dx12_default.h +++ /dev/null @@ -1,15 +0,0 @@ -//********************************************************* -// -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License (MIT). -// -//********************************************************* - -#pragma once - -#ifdef _WIN32 - -struct CD3DX12_DEFAULT {}; -extern const DECLSPEC_SELECTANY CD3DX12_DEFAULT D3D12_DEFAULT; - -#endif diff --git a/src/plugins/intel_npu/tests/functional/behavior/remote_tensor_tests/remote_run.cpp b/src/plugins/intel_npu/tests/functional/behavior/remote_tensor_tests/remote_run.cpp index 870f6596dca9ce..d3e537863227e4 100644 --- a/src/plugins/intel_npu/tests/functional/behavior/remote_tensor_tests/remote_run.cpp +++ b/src/plugins/intel_npu/tests/functional/behavior/remote_tensor_tests/remote_run.cpp @@ -10,7 +10,7 @@ using namespace ov::test::behavior; -const std::vector remoteConfigs = {{ov::log::level(ov::log::Level::ERR)}}; +const std::vector remoteConfigs = {{}}; INSTANTIATE_TEST_SUITE_P(smoke_BehaviorTest, RemoteRunTests, diff --git a/src/plugins/intel_npu/tests/functional/behavior/remote_tensor_tests/remote_run.hpp b/src/plugins/intel_npu/tests/functional/behavior/remote_tensor_tests/remote_run.hpp index fa58d4270889ad..c1992b3047996d 100644 --- a/src/plugins/intel_npu/tests/functional/behavior/remote_tensor_tests/remote_run.hpp +++ b/src/plugins/intel_npu/tests/functional/behavior/remote_tensor_tests/remote_run.hpp @@ -434,6 +434,380 @@ TEST_P(RemoteRunTests, CheckOutputDataFromTwoRunsInOutRemoteTensorsHostTensor2) 0); } +TEST_P(RemoteRunTests, checkResultsAfterChangingStateTensors) { + // Skip test according to plugin specific disabledTestPatterns() (if any) + SKIP_IF_CURRENT_TEST_IS_DISABLED() + + testing::internal::Random random(1); + ov::Tensor input_tensor; + + auto original_shape = Shape{1, 10, 10, 10}; + auto shape_size = ov::shape_size(original_shape); + auto model = createModelWithStates(element::f32, original_shape); + + auto context = core->get_default_context(target_device); + + compiled_model = core->compile_model(model, target_device, configuration); + ov::InferRequest inference_request; + inference_request = compiled_model.create_infer_request(); + + auto input = compiled_model.input(); + OV_ASSERT_NO_THROW(input_tensor = inference_request.get_tensor(input)); + auto* input_data = input_tensor.data(); + for (size_t i = 0; i < shape_size; ++i) { + input_data[i] = static_cast(random.Generate(10)); + } + + auto states = inference_request.query_state(); + + auto tensor_state = states[0].get_state(); + auto tensor_state_shape = tensor_state.get_shape(); + auto l0_host_tensor0 = context.create_host_tensor(ov::element::f32, tensor_state_shape); + + tensor_state = states[1].get_state(); + tensor_state_shape = tensor_state.get_shape(); + auto l0_host_tensor1 = context.create_host_tensor(ov::element::f32, tensor_state_shape); + + states[0].set_state(l0_host_tensor0); + states[0].reset(); + states[1].set_state(l0_host_tensor1); + states[1].reset(); + + OV_ASSERT_NO_THROW(inference_request.infer()); + + auto output_tensor = inference_request.get_tensor("sigmod_state"); + auto output_data = output_tensor.data(); + for (size_t i = 0; i < output_tensor.get_size(); i++) { + EXPECT_NEAR(0.5f, output_data[i], 1e-5); + } + + auto tensor_size = l0_host_tensor0.get_size(); + auto state_data = static_cast(l0_host_tensor0.data()); + for (size_t i = 0; i < tensor_size; ++i) { + EXPECT_NEAR(0.0, state_data[i], 1e-5); + } + + tensor_size = l0_host_tensor1.get_size(); + state_data = static_cast(l0_host_tensor1.data()); + for (size_t i = 0; i < tensor_size; ++i) { + EXPECT_NEAR(0.0, state_data[i], 1e-5); + } + + tensor_state = states[0].get_state(); + tensor_state_shape = tensor_state.get_shape(); + auto l0_host_tensor2 = context.create_host_tensor(ov::element::f32, tensor_state_shape); + + tensor_state = states[1].get_state(); + tensor_state_shape = tensor_state.get_shape(); + auto l0_host_tensor3 = context.create_host_tensor(ov::element::f32, tensor_state_shape); + + states[0].set_state(l0_host_tensor2); + states[1].set_state(l0_host_tensor3); + + tensor_size = l0_host_tensor2.get_size(); + state_data = static_cast(l0_host_tensor2.data()); + for (size_t i = 0; i < tensor_size; ++i) { + state_data[i] = 1.0f; + } + + tensor_size = l0_host_tensor3.get_size(); + state_data = static_cast(l0_host_tensor3.data()); + for (size_t i = 0; i < tensor_size; ++i) { + state_data[i] = 1.0f; + } + + OV_ASSERT_NO_THROW(inference_request.infer()); + + tensor_size = l0_host_tensor2.get_size(); + state_data = static_cast(l0_host_tensor2.data()); + for (size_t i = 0; i < tensor_size; ++i) { + EXPECT_NEAR(input_data[i], state_data[i], 1e-5); + } + + tensor_size = l0_host_tensor3.get_size(); + state_data = static_cast(l0_host_tensor3.data()); + for (size_t i = 0; i < tensor_size; ++i) { + EXPECT_NEAR(input_data[i], state_data[i], 1e-5); + } +} + +TEST_P(RemoteRunTests, checkResultsAfterChangingStateTensorsWithRemoteTensors) { + // Skip test according to plugin specific disabledTestPatterns() (if any) + SKIP_IF_CURRENT_TEST_IS_DISABLED() + + testing::internal::Random random(1); + ov::Tensor input_tensor; + + auto original_shape = Shape{1, 2, 2, 2}; + auto shape_size = ov::shape_size(original_shape); + auto model = createModelWithStates(element::f32, original_shape); + + auto context = core->get_default_context(target_device).as(); + ; + + compiled_model = core->compile_model(model, target_device, configuration); + ov::InferRequest inference_request; + inference_request = compiled_model.create_infer_request(); + + auto input = compiled_model.input(); + OV_ASSERT_NO_THROW(input_tensor = inference_request.get_tensor(input)); + auto* input_data = input_tensor.data(); + for (size_t i = 0; i < shape_size; ++i) { + input_data[i] = static_cast(random.Generate(10)); + } + + auto states = inference_request.query_state(); + + auto tensor_state = states[0].get_state(); + auto tensor_state_shape = tensor_state.get_shape(); + auto l0_host_tensor0 = context.create_l0_host_tensor(ov::element::f32, tensor_state_shape); + + tensor_state = states[1].get_state(); + tensor_state_shape = tensor_state.get_shape(); + auto l0_host_tensor1 = context.create_l0_host_tensor(ov::element::f32, tensor_state_shape); + + states[0].set_state(l0_host_tensor0); + states[0].reset(); + states[1].set_state(l0_host_tensor1); + states[1].reset(); + + OV_ASSERT_NO_THROW(inference_request.infer()); + + auto output_tensor = inference_request.get_tensor("sigmod_state"); + auto output_data = output_tensor.data(); + for (size_t i = 0; i < output_tensor.get_size(); i++) { + EXPECT_NEAR(0.5f, output_data[i], 1e-5); + } + + auto tensor_size = l0_host_tensor0.get_size(); + auto state_data = static_cast(l0_host_tensor0.get()); + for (size_t i = 0; i < tensor_size; ++i) { + EXPECT_NEAR(0.0, state_data[i], 1e-5); + } + + tensor_size = l0_host_tensor1.get_size(); + state_data = static_cast(l0_host_tensor1.get()); + for (size_t i = 0; i < tensor_size; ++i) { + EXPECT_NEAR(0.0, state_data[i], 1e-5); + } + + tensor_state = states[0].get_state(); + tensor_state_shape = tensor_state.get_shape(); + auto l0_host_tensor2 = context.create_l0_host_tensor(ov::element::f32, tensor_state_shape); + + tensor_state = states[1].get_state(); + tensor_state_shape = tensor_state.get_shape(); + auto l0_host_tensor3 = context.create_l0_host_tensor(ov::element::f32, tensor_state_shape); + + states[0].set_state(l0_host_tensor2); + states[1].set_state(l0_host_tensor3); + + tensor_size = l0_host_tensor2.get_size(); + state_data = static_cast(l0_host_tensor2.get()); + for (size_t i = 0; i < tensor_size; ++i) { + state_data[i] = 1.0f; + } + + tensor_size = l0_host_tensor3.get_size(); + state_data = static_cast(l0_host_tensor3.get()); + for (size_t i = 0; i < tensor_size; ++i) { + state_data[i] = 1.0f; + } + + OV_ASSERT_NO_THROW(inference_request.infer()); + + tensor_size = l0_host_tensor2.get_size(); + state_data = static_cast(l0_host_tensor2.get()); + for (size_t i = 0; i < tensor_size; ++i) { + EXPECT_NEAR(input_data[i], state_data[i], 1e-5); + } + + tensor_size = l0_host_tensor3.get_size(); + state_data = static_cast(l0_host_tensor3.get()); + for (size_t i = 0; i < tensor_size; ++i) { + EXPECT_NEAR(input_data[i], state_data[i], 1e-5); + } +} + +TEST_P(RemoteRunTests, checkResultsAfterChangingStateDataWithRemoteAndRandomTensors0) { + // Skip test according to plugin specific disabledTestPatterns() (if any) + SKIP_IF_CURRENT_TEST_IS_DISABLED() + + testing::internal::Random random(1); + ov::Tensor input_tensor; + + auto original_shape = Shape{1, 10, 10, 10}; + auto shape_size = ov::shape_size(original_shape); + auto model = createModelWithStates(element::f32, original_shape); + + auto context = core->get_default_context(target_device).as(); + ; + + compiled_model = core->compile_model(model, target_device, configuration); + ov::InferRequest inference_request; + inference_request = compiled_model.create_infer_request(); + + auto input = compiled_model.input(); + OV_ASSERT_NO_THROW(input_tensor = inference_request.get_tensor(input)); + auto* input_data = input_tensor.data(); + for (size_t i = 0; i < shape_size; ++i) { + input_data[i] = static_cast(random.Generate(10)); + } + + auto states = inference_request.query_state(); + + auto tensor_state = states[0].get_state(); + auto tensor_state_shape = tensor_state.get_shape(); + auto l0_host_tensor = context.create_l0_host_tensor(ov::element::f32, tensor_state_shape); + + tensor_state = states[1].get_state(); + tensor_state_shape = tensor_state.get_shape(); + auto byte_size = tensor_state.get_byte_size(); + float* data = new float[byte_size / sizeof(float)]; + ov::Tensor random_tensor{ov::element::f32, tensor_state_shape, data}; + + states[0].set_state(l0_host_tensor); + states[0].reset(); + states[1].set_state(random_tensor); + states[1].reset(); + + OV_ASSERT_NO_THROW(inference_request.infer()); + + auto output_tensor = inference_request.get_tensor("sigmod_state"); + auto output_data = output_tensor.data(); + for (size_t i = 0; i < output_tensor.get_size(); i++) { + EXPECT_NEAR(0.5f, output_data[i], 1e-5); + } + + auto tensor_size = l0_host_tensor.get_size(); + auto state_data = static_cast(l0_host_tensor.get()); + for (size_t i = 0; i < tensor_size; ++i) { + EXPECT_NEAR(0.0, state_data[i], 1e-5); + } + + tensor_size = random_tensor.get_size(); + state_data = static_cast(random_tensor.data()); + for (size_t i = 0; i < tensor_size; ++i) { + EXPECT_NEAR(0.0, state_data[i], 1e-5); + } + + tensor_size = l0_host_tensor.get_size(); + state_data = static_cast(l0_host_tensor.get()); + for (size_t i = 0; i < tensor_size; ++i) { + state_data[i] = 1.0f; + } + + tensor_size = random_tensor.get_size(); + state_data = static_cast(random_tensor.data()); + for (size_t i = 0; i < tensor_size; ++i) { + state_data[i] = 1.0f; + } + + OV_ASSERT_NO_THROW(inference_request.infer()); + + tensor_size = l0_host_tensor.get_size(); + state_data = static_cast(l0_host_tensor.get()); + for (size_t i = 0; i < tensor_size; ++i) { + EXPECT_NEAR(input_data[i], state_data[i], 1e-5); + } + + tensor_size = random_tensor.get_size(); + state_data = static_cast(random_tensor.data()); + for (size_t i = 0; i < tensor_size; ++i) { + EXPECT_NEAR(input_data[i], state_data[i], 1e-5); + } +} + +TEST_P(RemoteRunTests, checkResultsAfterChangingStateDataWithRemoteAndRandomTensors1) { + // Skip test according to plugin specific disabledTestPatterns() (if any) + SKIP_IF_CURRENT_TEST_IS_DISABLED() + + testing::internal::Random random(1); + ov::Tensor input_tensor; + + auto original_shape = Shape{1, 10, 10, 10}; + auto shape_size = ov::shape_size(original_shape); + auto model = createModelWithStates(element::f32, original_shape); + + auto context = core->get_default_context(target_device).as(); + ; + + compiled_model = core->compile_model(model, target_device, configuration); + ov::InferRequest inference_request; + inference_request = compiled_model.create_infer_request(); + + auto input = compiled_model.input(); + OV_ASSERT_NO_THROW(input_tensor = inference_request.get_tensor(input)); + auto* input_data = input_tensor.data(); + for (size_t i = 0; i < shape_size; ++i) { + input_data[i] = static_cast(random.Generate(10)); + } + + auto states = inference_request.query_state(); + + auto tensor_state = states[0].get_state(); + auto tensor_state_shape = tensor_state.get_shape(); + auto l0_host_tensor = context.create_l0_host_tensor(ov::element::f32, tensor_state_shape); + + tensor_state = states[1].get_state(); + tensor_state_shape = tensor_state.get_shape(); + auto byte_size = tensor_state.get_byte_size(); + float* data = new float[byte_size / sizeof(float)]; + ov::Tensor random_tensor{ov::element::f32, tensor_state_shape, data}; + + auto tensor_size = l0_host_tensor.get_size(); + auto state_data = static_cast(l0_host_tensor.get()); + for (size_t i = 0; i < tensor_size; ++i) { + state_data[i] = 1.0f; + } + + tensor_size = random_tensor.get_size(); + state_data = static_cast(random_tensor.data()); + for (size_t i = 0; i < tensor_size; ++i) { + state_data[i] = 1.0f; + } + + states[0].set_state(l0_host_tensor); + states[1].set_state(random_tensor); + + OV_ASSERT_NO_THROW(inference_request.infer()); + + tensor_size = l0_host_tensor.get_size(); + state_data = static_cast(l0_host_tensor.get()); + for (size_t i = 0; i < tensor_size; ++i) { + EXPECT_NEAR(input_data[i], state_data[i], 1e-5); + } + + tensor_size = random_tensor.get_size(); + state_data = static_cast(random_tensor.data()); + for (size_t i = 0; i < tensor_size; ++i) { + EXPECT_NEAR(input_data[i], state_data[i], 1e-5); + } + + states[0].reset(); + states[1].reset(); + + OV_ASSERT_NO_THROW(inference_request.infer()); + + auto output_tensor = inference_request.get_tensor("sigmod_state"); + auto output_data = output_tensor.data(); + for (size_t i = 0; i < output_tensor.get_size(); i++) { + EXPECT_NEAR(0.5f, output_data[i], 1e-5); + } + + tensor_size = l0_host_tensor.get_size(); + state_data = static_cast(l0_host_tensor.get()); + for (size_t i = 0; i < tensor_size; ++i) { + EXPECT_NEAR(0.0, state_data[i], 1e-5); + } + + tensor_size = random_tensor.get_size(); + state_data = static_cast(random_tensor.data()); + for (size_t i = 0; i < tensor_size; ++i) { + EXPECT_NEAR(0.0, state_data[i], 1e-5); + } +} + } // namespace behavior } // namespace test } // namespace ov diff --git a/src/plugins/intel_npu/tests/functional/common/utils.cpp b/src/plugins/intel_npu/tests/functional/common/utils.cpp index 91f78487934e38..b041e694b19ad0 100644 --- a/src/plugins/intel_npu/tests/functional/common/utils.cpp +++ b/src/plugins/intel_npu/tests/functional/common/utils.cpp @@ -7,6 +7,10 @@ #include #include "intel_npu/npu_private_properties.hpp" +#include "openvino/op/constant.hpp" +#include "openvino/op/multiply.hpp" +#include "openvino/op/op.hpp" +#include "openvino/op/sigmoid.hpp" std::string getBackendName(const ov::Core& core) { return core.get_property("NPU", ov::intel_npu::backend_name.name()).as(); @@ -99,3 +103,32 @@ std::vector getRWMandatoryPropertiesValues(std::vector p } return props; } + +std::shared_ptr createModelWithStates(ov::element::Type type, const ov::Shape& shape) { + auto input = std::make_shared(type, shape); + auto mem_i1 = std::make_shared(type, shape, 0); + auto mem_r1 = std::make_shared(mem_i1, "r_1-3"); + auto mul1 = std::make_shared(mem_r1, input); + + auto mem_i2 = std::make_shared(type, shape, 0); + auto mem_r2 = std::make_shared(mem_i2, "c_1-3"); + auto mul2 = std::make_shared(mem_r2, mul1); + auto mem_w2 = std::make_shared(mul2, "c_1-3"); + + auto mem_w1 = std::make_shared(mul2, "r_1-3"); + auto sigm = std::make_shared(mul2); + sigm->set_friendly_name("sigmod_state"); + sigm->get_output_tensor(0).set_names({"sigmod_state"}); + mem_r1->set_friendly_name("Memory_1"); + mem_r1->get_output_tensor(0).set_names({"Memory_1"}); + mem_w1->add_control_dependency(mem_r1); + sigm->add_control_dependency(mem_w1); + + mem_r2->set_friendly_name("Memory_2"); + mem_r2->get_output_tensor(0).set_names({"Memory_2"}); + mem_w2->add_control_dependency(mem_r2); + sigm->add_control_dependency(mem_w2); + + auto function = std::make_shared(ov::NodeVector{sigm}, ov::ParameterVector{input}, "add_output"); + return function; +} diff --git a/src/plugins/intel_npu/tests/functional/common/utils.hpp b/src/plugins/intel_npu/tests/functional/common/utils.hpp index 4ad54cc016302c..40ac987bd25487 100644 --- a/src/plugins/intel_npu/tests/functional/common/utils.hpp +++ b/src/plugins/intel_npu/tests/functional/common/utils.hpp @@ -6,6 +6,7 @@ #include #include + #include "common_test_utils/unicode_utils.hpp" std::string getBackendName(const ov::Core& core); @@ -18,6 +19,8 @@ std::string removeDeviceNameOnlyID(const std::string& device_name_id); std::vector getRWMandatoryPropertiesValues(std::vector props); +std::shared_ptr createModelWithStates(ov::element::Type type, const ov::Shape& shape); + template ::value || std::is_same::value)>::type> void removeDirFilesRecursive(const std::basic_string& path) { @@ -72,6 +75,8 @@ struct GenericTestCaseNameClass { }; template -constexpr bool GenericTestCaseNameClass::hasGetTestCaseName< - T, std::void_t().getTestCaseName( - std::declval>()))>> = true; +constexpr bool + GenericTestCaseNameClass::hasGetTestCaseName().getTestCaseName( + std::declval>()))>> = + true; diff --git a/src/plugins/intel_npu/tools/protopipe/main.cpp b/src/plugins/intel_npu/tools/protopipe/main.cpp index 8596ba864335ca..23840a9852a41a 100644 --- a/src/plugins/intel_npu/tools/protopipe/main.cpp +++ b/src/plugins/intel_npu/tools/protopipe/main.cpp @@ -90,7 +90,7 @@ static ICompiled::Ptr compileSimulation(Simulation::Ptr simulation, const bool p return simulation->compilePipelined(drop_frames); } return simulation->compileSync(drop_frames); -}; +} class ThreadRunner { public: @@ -112,8 +112,8 @@ void ThreadRunner::run() { } for (auto& future : futures) { future.get(); - }; -}; + } +} class Task { public: diff --git a/src/plugins/intel_npu/tools/single-image-test/main.cpp b/src/plugins/intel_npu/tools/single-image-test/main.cpp index 699e252eacf181..3188075fc58148 100644 --- a/src/plugins/intel_npu/tools/single-image-test/main.cpp +++ b/src/plugins/intel_npu/tools/single-image-test/main.cpp @@ -1569,8 +1569,8 @@ std::pair runInfer(ov::InferRequest& inferRequest, ov::Compi TensorMap out; for (const auto& outputInfo : compiledModel.outputs()) { - const std::string layer_name = outputInfo.get_any_name(); - out.insert({layer_name, inferRequest.get_tensor(layer_name)}); + const std::string layerName = outputInfo.get_any_name(); + out.insert({layerName, inferRequest.get_tensor(layerName)}); } ProfVec profData{}; @@ -1807,11 +1807,17 @@ bool testMeanIoU(const TensorMap& outputs, const TensorMap& references, const La } static ov::Shape parseDataShape(const std::string& dataShapeStr) { - std::vector dataShape; - std::istringstream ss(dataShapeStr); - std::string token; - while (std::getline(ss, token, ',')) { - dataShape.push_back(std::stoul(token)); + std::vector dataShape; + std::stringstream ss(dataShapeStr); + + char ch; // To discard non-numeric characters + int64_t dim; + while (ss >> ch) { + if (std::isdigit(ch)) { + ss.putback(ch); + ss >> dim; + dataShape.push_back(dim); + } } return ov::Shape(dataShape); } @@ -1906,11 +1912,11 @@ static int runSingleImageTest() { auto model = core.read_model(FLAGS_network); nameIOTensors(model); - auto inputs_info = std::const_pointer_cast(model)->inputs(); - InputsInfo info_map; + auto inputsInfo = std::const_pointer_cast(model)->inputs(); + InputsInfo infoMap; std::cout << "Performing reshape" << std::endl; - reshape(std::move(inputs_info), info_map, model, FLAGS_shape, + reshape(std::move(inputsInfo), infoMap, model, FLAGS_shape, FLAGS_override_model_batch_size, FLAGS_device); ov::preprocess::PrePostProcessor ppp(model); diff --git a/src/plugins/proxy/tests/proxy_tests.hpp b/src/plugins/proxy/tests/proxy_tests.hpp index 014c9ba51aa6b1..075c12c0d7dfa1 100644 --- a/src/plugins/proxy/tests/proxy_tests.hpp +++ b/src/plugins/proxy/tests/proxy_tests.hpp @@ -1,4 +1,4 @@ -// Copyright (C) 2018-2022 Intel Corporation +// Copyright (C) 2018-2025 Intel Corporation // SPDX-License-Identifier: Apache-2.0 // #pragma once diff --git a/src/plugins/template/tests/functional/op_reference/loop.cpp b/src/plugins/template/tests/functional/op_reference/loop.cpp index ffdbc0b8dc6ee2..430b9ee1c76560 100644 --- a/src/plugins/template/tests/functional/op_reference/loop.cpp +++ b/src/plugins/template/tests/functional/op_reference/loop.cpp @@ -1,4 +1,4 @@ -// Copyright (C) 2018-2021 Intel Corporation +// Copyright (C) 2018-2025 Intel Corporation // SPDX-License-Identifier: Apache-2.0 // diff --git a/src/plugins/template/tests/functional/op_reference/tensor_iterator.cpp b/src/plugins/template/tests/functional/op_reference/tensor_iterator.cpp index a2b3d199adf1bc..e6dcdc8900353b 100644 --- a/src/plugins/template/tests/functional/op_reference/tensor_iterator.cpp +++ b/src/plugins/template/tests/functional/op_reference/tensor_iterator.cpp @@ -1,4 +1,4 @@ -// Copyright (C) 2018-2021 Intel Corporation +// Copyright (C) 2018-2025 Intel Corporation // SPDX-License-Identifier: Apache-2.0 // diff --git a/src/plugins/template/tests/functional/shared_tests_instances/behavior/ov_infer_request/batched_tensors.cpp b/src/plugins/template/tests/functional/shared_tests_instances/behavior/ov_infer_request/batched_tensors.cpp index d8e9b3a6284d52..a97fcc4d719a00 100644 --- a/src/plugins/template/tests/functional/shared_tests_instances/behavior/ov_infer_request/batched_tensors.cpp +++ b/src/plugins/template/tests/functional/shared_tests_instances/behavior/ov_infer_request/batched_tensors.cpp @@ -1,4 +1,4 @@ -// Copyright (C) 2018-2021 Intel Corporation +// Copyright (C) 2018-2025 Intel Corporation // SPDX-License-Identifier: Apache-2.0 // diff --git a/src/plugins/template/tests/functional/shared_tests_instances/behavior/ov_infer_request/inference.cpp b/src/plugins/template/tests/functional/shared_tests_instances/behavior/ov_infer_request/inference.cpp index 2490bcb1a33cc2..e85c54f853b3cd 100644 --- a/src/plugins/template/tests/functional/shared_tests_instances/behavior/ov_infer_request/inference.cpp +++ b/src/plugins/template/tests/functional/shared_tests_instances/behavior/ov_infer_request/inference.cpp @@ -1,4 +1,4 @@ -// Copyright (C) 2018-2021 Intel Corporation +// Copyright (C) 2018-2025 Intel Corporation // SPDX-License-Identifier: Apache-2.0 // diff --git a/src/tests/functional/plugin/shared/include/behavior/ov_infer_request/batched_tensors.hpp b/src/tests/functional/plugin/shared/include/behavior/ov_infer_request/batched_tensors.hpp index 91baf94a800241..ec6ecba28d1f23 100644 --- a/src/tests/functional/plugin/shared/include/behavior/ov_infer_request/batched_tensors.hpp +++ b/src/tests/functional/plugin/shared/include/behavior/ov_infer_request/batched_tensors.hpp @@ -1,4 +1,4 @@ -// Copyright (C) 2018-2021 Intel Corporation +// Copyright (C) 2018-2025 Intel Corporation // SPDX-License-Identifier: Apache-2.0 // diff --git a/src/tests/functional/plugin/shared/include/behavior/ov_infer_request/inference.hpp b/src/tests/functional/plugin/shared/include/behavior/ov_infer_request/inference.hpp index 492a0a528298fc..79f73403e27252 100644 --- a/src/tests/functional/plugin/shared/include/behavior/ov_infer_request/inference.hpp +++ b/src/tests/functional/plugin/shared/include/behavior/ov_infer_request/inference.hpp @@ -1,4 +1,4 @@ -// Copyright (C) 2018-2021 Intel Corporation +// Copyright (C) 2018-2025 Intel Corporation // SPDX-License-Identifier: Apache-2.0 // diff --git a/src/tests/functional/plugin/shared/include/low_precision_transformations/gather_transformation.hpp b/src/tests/functional/plugin/shared/include/low_precision_transformations/gather_transformation.hpp index 69cc1c804257f0..2a461cfddb24db 100644 --- a/src/tests/functional/plugin/shared/include/low_precision_transformations/gather_transformation.hpp +++ b/src/tests/functional/plugin/shared/include/low_precision_transformations/gather_transformation.hpp @@ -1,4 +1,4 @@ -// Copyright (C) 2018-2022 Intel Corporation +// Copyright (C) 2018-2025 Intel Corporation // SPDX-License-Identifier: Apache-2.0 // diff --git a/src/tests/functional/plugin/shared/src/behavior/ov_infer_request/batched_tensors.cpp b/src/tests/functional/plugin/shared/src/behavior/ov_infer_request/batched_tensors.cpp index b0b926967d1e1a..21fb8dd6b6a9c3 100644 --- a/src/tests/functional/plugin/shared/src/behavior/ov_infer_request/batched_tensors.cpp +++ b/src/tests/functional/plugin/shared/src/behavior/ov_infer_request/batched_tensors.cpp @@ -1,4 +1,4 @@ -// Copyright (C) 2018-2021 Intel Corporation +// Copyright (C) 2018-2025 Intel Corporation // SPDX-License-Identifier: Apache-2.0 // diff --git a/src/tests/functional/plugin/shared/src/behavior/ov_infer_request/inference.cpp b/src/tests/functional/plugin/shared/src/behavior/ov_infer_request/inference.cpp index 8ba8d4ee933781..d84519f897986b 100644 --- a/src/tests/functional/plugin/shared/src/behavior/ov_infer_request/inference.cpp +++ b/src/tests/functional/plugin/shared/src/behavior/ov_infer_request/inference.cpp @@ -1,4 +1,4 @@ -// Copyright (C) 2018-2021 Intel Corporation +// Copyright (C) 2018-2025 Intel Corporation // SPDX-License-Identifier: Apache-2.0 // diff --git a/src/tests/functional/plugin/shared/src/low_precision_transformations/fuse_dequantize_to_fake_quantize_transformation.cpp b/src/tests/functional/plugin/shared/src/low_precision_transformations/fuse_dequantize_to_fake_quantize_transformation.cpp index fac36d8f56b863..6f5dc0648fcb69 100644 --- a/src/tests/functional/plugin/shared/src/low_precision_transformations/fuse_dequantize_to_fake_quantize_transformation.cpp +++ b/src/tests/functional/plugin/shared/src/low_precision_transformations/fuse_dequantize_to_fake_quantize_transformation.cpp @@ -1,4 +1,4 @@ -// Copyright (C) 2018-2022 Intel Corporation +// Copyright (C) 2018-2025 Intel Corporation // SPDX-License-Identifier: Apache-2.0 // diff --git a/src/tests/functional/plugin/shared/src/low_precision_transformations/gather_transformation.cpp b/src/tests/functional/plugin/shared/src/low_precision_transformations/gather_transformation.cpp index be0e5144163f19..839b9f05f97429 100644 --- a/src/tests/functional/plugin/shared/src/low_precision_transformations/gather_transformation.cpp +++ b/src/tests/functional/plugin/shared/src/low_precision_transformations/gather_transformation.cpp @@ -1,4 +1,4 @@ -// Copyright (C) 2018-2022 Intel Corporation +// Copyright (C) 2018-2025 Intel Corporation // SPDX-License-Identifier: Apache-2.0 // diff --git a/src/tests/functional/shared_test_classes/include/shared_test_classes/base/utils/calculate_thresholds.hpp b/src/tests/functional/shared_test_classes/include/shared_test_classes/base/utils/calculate_thresholds.hpp index afce941a948a81..f57d8f4caf89ac 100644 --- a/src/tests/functional/shared_test_classes/include/shared_test_classes/base/utils/calculate_thresholds.hpp +++ b/src/tests/functional/shared_test_classes/include/shared_test_classes/base/utils/calculate_thresholds.hpp @@ -1,4 +1,4 @@ -// Copyright (C) 2018-2021 Intel Corporation +// Copyright (C) 2018-2025 Intel Corporation // SPDX-License-Identifier: Apache-2.0 // diff --git a/src/tests/functional/shared_test_classes/include/shared_test_classes/base/utils/compare_results.hpp b/src/tests/functional/shared_test_classes/include/shared_test_classes/base/utils/compare_results.hpp index 1b04cf83b01b3c..5acab8dfa6e815 100644 --- a/src/tests/functional/shared_test_classes/include/shared_test_classes/base/utils/compare_results.hpp +++ b/src/tests/functional/shared_test_classes/include/shared_test_classes/base/utils/compare_results.hpp @@ -1,4 +1,4 @@ -// Copyright (C) 2018-2021 Intel Corporation +// Copyright (C) 2018-2025 Intel Corporation // SPDX-License-Identifier: Apache-2.0 // diff --git a/src/tests/functional/shared_test_classes/include/shared_test_classes/base/utils/generate_inputs.hpp b/src/tests/functional/shared_test_classes/include/shared_test_classes/base/utils/generate_inputs.hpp index d2930be59d5eac..1ac793ca97faa5 100644 --- a/src/tests/functional/shared_test_classes/include/shared_test_classes/base/utils/generate_inputs.hpp +++ b/src/tests/functional/shared_test_classes/include/shared_test_classes/base/utils/generate_inputs.hpp @@ -1,4 +1,4 @@ -// Copyright (C) 2018-2021 Intel Corporation +// Copyright (C) 2018-2025 Intel Corporation // SPDX-License-Identifier: Apache-2.0 // diff --git a/src/tests/functional/shared_test_classes/include/shared_test_classes/base/utils/ranges.hpp b/src/tests/functional/shared_test_classes/include/shared_test_classes/base/utils/ranges.hpp index 362258598a1344..3805fde5ce9bfb 100644 --- a/src/tests/functional/shared_test_classes/include/shared_test_classes/base/utils/ranges.hpp +++ b/src/tests/functional/shared_test_classes/include/shared_test_classes/base/utils/ranges.hpp @@ -1,4 +1,4 @@ -// Copyright (C) 2018-2021 Intel Corporation +// Copyright (C) 2018-2025 Intel Corporation // SPDX-License-Identifier: Apache-2.0 // diff --git a/src/tests/functional/shared_test_classes/src/base/utils/generate_inputs.cpp b/src/tests/functional/shared_test_classes/src/base/utils/generate_inputs.cpp index ae963375fc7f5d..b8f41c30b55993 100644 --- a/src/tests/functional/shared_test_classes/src/base/utils/generate_inputs.cpp +++ b/src/tests/functional/shared_test_classes/src/base/utils/generate_inputs.cpp @@ -1,4 +1,4 @@ -// Copyright (C) 2018-2021 Intel Corporation +// Copyright (C) 2018-2025 Intel Corporation // SPDX-License-Identifier: Apache-2.0 // diff --git a/src/tests/functional/shared_test_classes/src/single_op/dft.cpp b/src/tests/functional/shared_test_classes/src/single_op/dft.cpp index 322d73a08c3172..af7fbd954c7916 100644 --- a/src/tests/functional/shared_test_classes/src/single_op/dft.cpp +++ b/src/tests/functional/shared_test_classes/src/single_op/dft.cpp @@ -102,8 +102,6 @@ void DFTLayerTest::SetUp() { if (model_type == ov::element::f32) { abs_threshold = 8e-5; - } else if (model_type == ov::element::bf16) { - abs_threshold = 5e-7; } } } // namespace test diff --git a/src/tests/ov_helpers/ov_lpt_models/include/ov_lpt_models/gather.hpp b/src/tests/ov_helpers/ov_lpt_models/include/ov_lpt_models/gather.hpp index cfc92209501e6f..a8b5fcd15100f4 100644 --- a/src/tests/ov_helpers/ov_lpt_models/include/ov_lpt_models/gather.hpp +++ b/src/tests/ov_helpers/ov_lpt_models/include/ov_lpt_models/gather.hpp @@ -1,4 +1,4 @@ -// Copyright (C) 2018-2022 Intel Corporation +// Copyright (C) 2018-2025 Intel Corporation // SPDX-License-Identifier: Apache-2.0 // diff --git a/src/tests/ov_helpers/ov_lpt_models/src/gather.cpp b/src/tests/ov_helpers/ov_lpt_models/src/gather.cpp index 9d6e8b175b018d..f7f5b8a5716ed7 100644 --- a/src/tests/ov_helpers/ov_lpt_models/src/gather.cpp +++ b/src/tests/ov_helpers/ov_lpt_models/src/gather.cpp @@ -1,4 +1,4 @@ -// Copyright (C) 2018-2022 Intel Corporation +// Copyright (C) 2018-2025 Intel Corporation // SPDX-License-Identifier: Apache-2.0 // diff --git a/src/tests/test_utils/common_test_utils/include/common_test_utils/node_builders/broadcast.hpp b/src/tests/test_utils/common_test_utils/include/common_test_utils/node_builders/broadcast.hpp index c3e9cb4ae2cd07..4576caf18b89fd 100644 --- a/src/tests/test_utils/common_test_utils/include/common_test_utils/node_builders/broadcast.hpp +++ b/src/tests/test_utils/common_test_utils/include/common_test_utils/node_builders/broadcast.hpp @@ -1,4 +1,4 @@ -// Copyright (C) 2018-2022 Intel Corporation +// Copyright (C) 2018-2025 Intel Corporation // SPDX-License-Identifier: Apache-2.0 // diff --git a/src/tests/test_utils/common_test_utils/include/common_test_utils/node_builders/reshape.hpp b/src/tests/test_utils/common_test_utils/include/common_test_utils/node_builders/reshape.hpp index 3c13af77d110ca..44e5ed2303db4c 100644 --- a/src/tests/test_utils/common_test_utils/include/common_test_utils/node_builders/reshape.hpp +++ b/src/tests/test_utils/common_test_utils/include/common_test_utils/node_builders/reshape.hpp @@ -1,4 +1,4 @@ -// Copyright (C) 2018-2022 Intel Corporation +// Copyright (C) 2018-2025 Intel Corporation // SPDX-License-Identifier: Apache-2.0 // diff --git a/src/tests/test_utils/common_test_utils/src/node_builders/reshape.cpp b/src/tests/test_utils/common_test_utils/src/node_builders/reshape.cpp index 7ea8196f39eaf0..8876076d1bed0c 100644 --- a/src/tests/test_utils/common_test_utils/src/node_builders/reshape.cpp +++ b/src/tests/test_utils/common_test_utils/src/node_builders/reshape.cpp @@ -1,4 +1,4 @@ -// Copyright (C) 2018-2022 Intel Corporation +// Copyright (C) 2018-2025 Intel Corporation // SPDX-License-Identifier: Apache-2.0 // diff --git a/tests/constraints.txt b/tests/constraints.txt index e77b48a9e38662..45aac9051f2fd2 100644 --- a/tests/constraints.txt +++ b/tests/constraints.txt @@ -13,14 +13,14 @@ defusedxml>=0.7.1 tensorflow>=2.5,<2.19.0 requests>=2.25.1 opencv-python>=4.5 -paddlepaddle==2.6.1 -protobuf>=3.18.1,<4.0.0 +paddlepaddle==2.6.2 +protobuf>=3.18.1,<6.0.0 py>=1.9.0 pytest>=5.0,<8.4 -pytest-dependency==0.5.1 +pytest-dependency==0.6.0 pytest-html==4.1.1 pytest-timeout==2.3.1 -kornia==0.7.0 +kornia==0.8.0 --extra-index-url https://download.pytorch.org/whl/cpu torch~=2.5.1; platform_system != "Darwin" or platform_machine != "x86_64" diff --git a/tests/e2e_tests/requirements.txt b/tests/e2e_tests/requirements.txt index a2056071e5417e..a9d7bb0861ddd2 100644 --- a/tests/e2e_tests/requirements.txt +++ b/tests/e2e_tests/requirements.txt @@ -26,13 +26,13 @@ pytest-cov==2.11.1 pytest-html pytest-json-report==1.5.0 # pytest-metadata==1.7.0 -pytest-xdist==2.1.0 +pytest-xdist==3.6.1 pytest-timeout==2.3.1 # for common utils, e2e_tests openvino-dev distro==1.9.0 -pyyaml==6.0.1 +pyyaml==6.0.2 jsonschema==4.22.0 # filelock==3.9.0 omegaconf>=2.1,<2.4 diff --git a/tests/layer_tests/pytorch_tests/test_bernoulli.py b/tests/layer_tests/pytorch_tests/test_bernoulli.py new file mode 100644 index 00000000000000..691ec7ed4da6df --- /dev/null +++ b/tests/layer_tests/pytorch_tests/test_bernoulli.py @@ -0,0 +1,99 @@ +# Copyright (C) 2018-2025 Intel Corporation +# SPDX-License-Identifier: Apache-2.0 + +import numpy as np +import pytest +import torch + +from pytorch_layer_test_class import PytorchLayerTest + + +class TestBernoulli(PytorchLayerTest): + def _prepare_input(self, input, input_type, out): + model_inputs = [input.astype(input_type)] + if out: + model_inputs.append(np.zeros_like(input).astype(np.int64)) + return model_inputs + + def create_model(self, out, seed): + class aten_bernoulli(torch.nn.Module): + def __init__(self, out, seed) -> None: + super().__init__() + gen = torch.Generator() + gen.manual_seed(seed) + self.gen = gen + if not out: + self.forward = self.bernoulli + else: + self.forward = self.bernoulli_out + + def bernoulli(self, input): + bernoulli_res = torch.bernoulli(input, generator=self.gen) + return bernoulli_res + + def bernoulli_out(self, input, out): + bernoulli_res = torch.bernoulli(input, generator=self.gen, out=out) + return bernoulli_res + + ref_net = None + + return aten_bernoulli(out, seed), ref_net, "aten::bernoulli" + + @pytest.mark.parametrize("input", [ + np.array([[0, 1, 0, 0], [0, 0, 0, 1], [1, 0, 0, 0]]), + np.array([0.0, 0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9, 1.0]), + ]) + @pytest.mark.parametrize("input_type", [np.float32, np.float64]) + @pytest.mark.parametrize("out", [True, False]) + @pytest.mark.parametrize("seed", [1, 50, 1234]) + @pytest.mark.nightly + @pytest.mark.precommit + def test_bernoulli(self, input, input_type, out, seed, ie_device, precision, ir_version): + if input_type == np.float64: + pytest.skip("156027: Incorrect specification or reference for RandomUniform for fp64 output type") + self._test(*self.create_model(out, seed), + ie_device, precision, ir_version, + kwargs_to_prepare_input={"input": input, + "input_type": input_type, + "out": out}) + + +class TestBernoulliWithP(PytorchLayerTest): + def _prepare_input(self, input, input_type): + model_inputs = [input.astype(input_type)] + return model_inputs + + def create_model(self, p, seed): + class aten_bernoulli(torch.nn.Module): + def __init__(self, p, seed) -> None: + super().__init__() + gen = torch.Generator() + gen.manual_seed(seed) + self.gen = gen + self.p = p + self.forward = self.bernoulli_with_p + + def bernoulli_with_p(self, input): + bernoulli_res = torch.bernoulli(input, self.p, generator=self.gen) + return bernoulli_res + + ref_net = None + + return aten_bernoulli(p, seed), ref_net, "aten::bernoulli" + + @pytest.mark.parametrize("input", [ + np.array([[0, 1, 0, 0], [0, 0, 0, 1], [1, 0, 0, 0]]), + np.array([0.0, 0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9, 1.0]), + ]) + @pytest.mark.parametrize("input_type", [np.float32, np.int32, np.float64]) + @pytest.mark.parametrize("p", [0.0, 0.4, 1.0]) + @pytest.mark.parametrize("seed", [12]) + @pytest.mark.nightly + @pytest.mark.precommit + def test_bernoulli(self, input, input_type, p, seed, ie_device, precision, ir_version): + if p not in [0.0, 1.0]: + pytest.skip("156027: Incorrect specification or reference for RandomUniform for fp64 output type") + self._test(*self.create_model(p, seed), + ie_device, precision, ir_version, + kwargs_to_prepare_input={"input": input, + "input_type": input_type}) diff --git a/tests/layer_tests/pytorch_tests/test_constant_pad_nd.py b/tests/layer_tests/pytorch_tests/test_constant_pad_nd.py index 7a92983bb1819d..56c2417e7dfea1 100644 --- a/tests/layer_tests/pytorch_tests/test_constant_pad_nd.py +++ b/tests/layer_tests/pytorch_tests/test_constant_pad_nd.py @@ -1,4 +1,4 @@ -# Copyright (C) 2018-2023 Intel Corporation +# Copyright (C) 2018-2025 Intel Corporation # SPDX-License-Identifier: Apache-2.0 import pytest diff --git a/tests/layer_tests/pytorch_tests/test_hardtanh.py b/tests/layer_tests/pytorch_tests/test_hardtanh.py index d0c4c1aac1a38d..728a0cf1d6db42 100644 --- a/tests/layer_tests/pytorch_tests/test_hardtanh.py +++ b/tests/layer_tests/pytorch_tests/test_hardtanh.py @@ -1,4 +1,4 @@ -# Copyright (C) 2018-2023 Intel Corporation +# Copyright (C) 2018-2025 Intel Corporation # SPDX-License-Identifier: Apache-2.0 import platform diff --git a/tests/layer_tests/pytorch_tests/test_index_copy_.py b/tests/layer_tests/pytorch_tests/test_index_copy_.py index 725c95936664cf..bd9f26814e1082 100644 --- a/tests/layer_tests/pytorch_tests/test_index_copy_.py +++ b/tests/layer_tests/pytorch_tests/test_index_copy_.py @@ -1,4 +1,4 @@ -# Copyright (C) 2018-2023 Intel Corporation +# Copyright (C) 2018-2025 Intel Corporation # SPDX-License-Identifier: Apache-2.0 diff --git a/tests/layer_tests/pytorch_tests/test_index_fill_.py b/tests/layer_tests/pytorch_tests/test_index_fill_.py index 878dda7ab3bd7e..18c08669df1695 100644 --- a/tests/layer_tests/pytorch_tests/test_index_fill_.py +++ b/tests/layer_tests/pytorch_tests/test_index_fill_.py @@ -1,4 +1,4 @@ -# Copyright (C) 2018-2023 Intel Corporation +# Copyright (C) 2018-2025 Intel Corporation # SPDX-License-Identifier: Apache-2.0 diff --git a/tests/layer_tests/pytorch_tests/test_isfinite.py b/tests/layer_tests/pytorch_tests/test_isfinite.py index a72125799c8a49..00419cb89ceca8 100644 --- a/tests/layer_tests/pytorch_tests/test_isfinite.py +++ b/tests/layer_tests/pytorch_tests/test_isfinite.py @@ -1,4 +1,4 @@ -# Copyright (C) 2018-2023 Intel Corporation +# Copyright (C) 2018-2025 Intel Corporation # SPDX-License-Identifier: Apache-2.0 import numpy as np diff --git a/tests/layer_tests/pytorch_tests/test_isinf.py b/tests/layer_tests/pytorch_tests/test_isinf.py index 72e6ae1f198ea2..cd33fa6acf8473 100644 --- a/tests/layer_tests/pytorch_tests/test_isinf.py +++ b/tests/layer_tests/pytorch_tests/test_isinf.py @@ -1,4 +1,4 @@ -# Copyright (C) 2018-2023 Intel Corporation +# Copyright (C) 2018-2025 Intel Corporation # SPDX-License-Identifier: Apache-2.0 import numpy as np diff --git a/tests/layer_tests/pytorch_tests/test_isnan.py b/tests/layer_tests/pytorch_tests/test_isnan.py index 6645546c00707d..150c92ba92bdf6 100644 --- a/tests/layer_tests/pytorch_tests/test_isnan.py +++ b/tests/layer_tests/pytorch_tests/test_isnan.py @@ -1,4 +1,4 @@ -# Copyright (C) 2018-2023 Intel Corporation +# Copyright (C) 2018-2025 Intel Corporation # SPDX-License-Identifier: Apache-2.0 import numpy as np diff --git a/tests/layer_tests/pytorch_tests/test_logsumexp.py b/tests/layer_tests/pytorch_tests/test_logsumexp.py new file mode 100644 index 00000000000000..806e3b80540d5a --- /dev/null +++ b/tests/layer_tests/pytorch_tests/test_logsumexp.py @@ -0,0 +1,34 @@ +# Copyright (C) 2018-2025 Intel Corporation +# SPDX-License-Identifier: Apache-2.0 + +import numpy as np +import pytest +import torch + +from pytorch_layer_test_class import PytorchLayerTest + + +class aten_logsumexp(torch.nn.Module): + def __init__(self, dim, keepdim) -> None: + super().__init__() + self.dim = dim + self.keepdim = keepdim + + def forward(self, input_tensor): + return torch.logsumexp(input_tensor, dim=self.dim, keepdim=self.keepdim) + + +class TestLogsumexp(PytorchLayerTest): + def _prepare_input(self): + return (np.random.randn(2, 5, 9, 7),) + + @pytest.mark.parametrize("dim", [ + 0, 1, 2, 3, -1, -2, -3, -4 + ]) + @pytest.mark.parametrize("keepdim", [True, False]) + @pytest.mark.nightly + @pytest.mark.precommit + @pytest.mark.precommit_fx_backend + def test_logsumexp(self, dim, keepdim, ie_device, precision, ir_version): + self._test(aten_logsumexp(dim, keepdim), None, "aten::logsumexp", + ie_device, precision, ir_version) diff --git a/tests/layer_tests/pytorch_tests/test_permute.py b/tests/layer_tests/pytorch_tests/test_permute.py index d8fb94145bada7..efbd77d371eb89 100644 --- a/tests/layer_tests/pytorch_tests/test_permute.py +++ b/tests/layer_tests/pytorch_tests/test_permute.py @@ -11,46 +11,54 @@ def _prepare_input(self): import numpy as np return (np.random.randn(1, 3, 224, 224).astype(np.float32),) - def create_model(self, order): + def create_model(self, order, complex_type): import torch class aten_permute(torch.nn.Module): - def __init__(self, order): - super(aten_permute, self).__init__() + def __init__(self, order, complex_type): + super().__init__() self.order = order + self.complex_type = complex_type def forward(self, x): - return torch.permute(x, self.order) - - ref_net = None - - return aten_permute(order), ref_net, "aten::permute" - - @pytest.mark.parametrize("order", [[0, 2, 3, 1], [0, 3, 1, 2], [0, -1, 1, -2]]) + if self.complex_type: + x = torch.reshape(x, x.shape[:-1] + (-1, 2)) + x = torch.view_as_complex(x) + res = torch.permute(x, self.order) + if self.complex_type: + res = torch.view_as_real(res) + return res + + return aten_permute(order, complex_type), None, "aten::permute" + + @pytest.mark.parametrize("order", [[0, 2, 3, 1], + [0, 3, 1, 2], + [0, -1, 1, -2]]) + @pytest.mark.parametrize("complex_type", [True, False]) @pytest.mark.nightly @pytest.mark.precommit @pytest.mark.precommit_torch_export - def test_permute(self, order, ie_device, precision, ir_version): - self._test(*self.create_model(order), ie_device, precision, ir_version) + def test_permute(self, order, complex_type, ie_device, precision, ir_version): + self._test(*self.create_model(order, complex_type), ie_device, precision, ir_version) class TestPermuteList(PytorchLayerTest): def _prepare_input(self, permute_shape): import numpy as np - return (np.random.randn(1, 3, 224, 224).astype(np.float32), np.random.randn(*permute_shape).astype(np.float32)) + return (np.random.randn(1, 3, 224, 224).astype(np.float32), + np.random.randn(*permute_shape).astype(np.float32)) def create_model(self): import torch - class aten_permute(torch.nn.Module): - + class aten_permute_list(torch.nn.Module): def forward(self, x, y): y_shape = y.shape return torch.permute(x, [y_shape[0] - 1, y_shape[1] - 1, y_shape[2] - 1, y_shape[3] - 1]) ref_net = None - return aten_permute(), ref_net, ["aten::permute", "prim::ListConstruct"] + return aten_permute_list(), ref_net, ["aten::permute", "prim::ListConstruct"] @pytest.mark.parametrize("order", [[1, 3, 4, 2], [1, 4, 2, 3]]) @pytest.mark.nightly @@ -58,4 +66,5 @@ def forward(self, x, y): @pytest.mark.precommit_torch_export def test_permute_list(self, order, ie_device, precision, ir_version): self._test(*self.create_model(), ie_device, precision, ir_version, - kwargs_to_prepare_input={"permute_shape": order}, dynamic_shapes=ie_device != "GPU") + kwargs_to_prepare_input={"permute_shape": order}, + dynamic_shapes=ie_device != "GPU") diff --git a/tests/layer_tests/pytorch_tests/test_reshape.py b/tests/layer_tests/pytorch_tests/test_reshape.py index 7174d6022b4ca1..5266e8e00c5c1d 100644 --- a/tests/layer_tests/pytorch_tests/test_reshape.py +++ b/tests/layer_tests/pytorch_tests/test_reshape.py @@ -1,31 +1,38 @@ # Copyright (C) 2018-2025 Intel Corporation # SPDX-License-Identifier: Apache-2.0 +import random import numpy as np import pytest -import random from pytorch_layer_test_class import PytorchLayerTest class TestReshape(PytorchLayerTest): - def _prepare_input(self): - return (np.random.uniform(0, 50, (1, 12, 12, 24)).astype(np.float32)) + def _prepare_input(self, complex_type): + shape = (1, 12, 12, 24) + if complex_type: + shape += (2,) + return (np.random.uniform(0, 50, shape).astype(np.float32)) - def create_model(self, shape): + def create_model(self, shape, complex_type): import torch class aten_reshape(torch.nn.Module): - def __init__(self, shape): - super(aten_reshape, self).__init__() + def __init__(self, shape, complex_type): + super().__init__() self.shape = shape + self.complex_type = complex_type def forward(self, x): - return torch.reshape(x, self.shape) + if self.complex_type: + x = torch.view_as_complex(x) + res = torch.reshape(x, self.shape) + if self.complex_type: + res = torch.view_as_real(res) + return res - ref_net = None - - return aten_reshape(shape), ref_net, "aten::reshape" + return aten_reshape(shape, complex_type), None, "aten::reshape" @pytest.mark.parametrize(("shape"), [ [-1, 6], @@ -37,16 +44,20 @@ def forward(self, x): [24, 1, -1, 12], [24, 1, 1, -1, 12], ]) + @pytest.mark.parametrize("complex_type", [True, False]) @pytest.mark.nightly @pytest.mark.precommit @pytest.mark.precommit_torch_export @pytest.mark.precommit_fx_backend - def test_reshape(self, shape, ie_device, precision, ir_version): - self._test(*self.create_model(shape), ie_device, precision, ir_version) + def test_reshape(self, shape, complex_type, ie_device, precision, ir_version): + self._test(*self.create_model(shape, complex_type), + ie_device, precision, ir_version, + kwargs_to_prepare_input={"complex_type": complex_type}) + class TestDynamicReshape(PytorchLayerTest): def _prepare_input(self): - last_dym = random.randint(1,2) + last_dym = random.randint(1, 2) return (np.random.uniform(0, 50, (1, 12, 12, 24)).astype(np.float32), last_dym) def create_model(self, shape): @@ -54,17 +65,14 @@ def create_model(self, shape): class aten_reshape(torch.nn.Module): def __init__(self, shape): - super(aten_reshape, self).__init__() + super().__init__() self.shape = shape def forward(self, x, dym): - #return torch.reshape(x, self.shape) dym2 = int(torch.ops.aten.sym_size(x, 3)/dym) return torch.reshape(x, [12, 12, dym2, dym]) - ref_net = None - - return aten_reshape(shape), ref_net, "aten::reshape" + return aten_reshape(shape), None, "aten::reshape" @pytest.mark.parametrize(("shape"), [ [12, 12, 24, 1], diff --git a/tests/layer_tests/pytorch_tests/test_select_scatter.py b/tests/layer_tests/pytorch_tests/test_select_scatter.py index 112675264c74a5..c2a881ece0e358 100644 --- a/tests/layer_tests/pytorch_tests/test_select_scatter.py +++ b/tests/layer_tests/pytorch_tests/test_select_scatter.py @@ -1,4 +1,4 @@ -# Copyright (C) 2018-2023 Intel Corporation +# Copyright (C) 2018-2025 Intel Corporation # SPDX-License-Identifier: Apache-2.0 import pytest diff --git a/tests/layer_tests/pytorch_tests/test_size.py b/tests/layer_tests/pytorch_tests/test_size.py index 050d1d818df1b2..f3e0e98dccb327 100644 --- a/tests/layer_tests/pytorch_tests/test_size.py +++ b/tests/layer_tests/pytorch_tests/test_size.py @@ -7,24 +7,38 @@ class TestSize(PytorchLayerTest): - def _prepare_input(self, input_shape): + def _prepare_input(self, input_shape, complex_type): import numpy as np + if complex_type: + input_shape += [2] return (np.random.randn(*input_shape).astype(np.float32),) - def create_model(self): + def create_model(self, complex_type): import torch class aten_size(torch.nn.Module): + def __init__(self, complex_type): + super().__init__() + self.complex_type = complex_type + def forward(self, x): + if self.complex_type: + x = torch.view_as_complex(x) return torch.tensor(x.shape) - ref_net = None + op = aten_size(complex_type) - op = aten_size() + return op, None, "aten::size" - return op, ref_net, "aten::size" @pytest.mark.nightly @pytest.mark.precommit - @pytest.mark.parametrize("input_shape", [[1,], [1, 2], [1, 2, 3], [1, 2, 3, 4], [1, 2, 3, 4, 5]]) - def test_size(self, input_shape, ie_device, precision, ir_version): - self._test(*self.create_model(), ie_device, precision, ir_version, kwargs_to_prepare_input={"input_shape": input_shape}) + @pytest.mark.parametrize("input_shape", [[1,], + [1, 2], + [1, 2, 3], + [1, 2, 3, 4], + [1, 2, 3, 4, 5]]) + @pytest.mark.parametrize("complex_type", [True, False]) + def test_size(self, input_shape, complex_type, ie_device, precision, ir_version): + self._test(*self.create_model(complex_type), ie_device, precision, ir_version, + kwargs_to_prepare_input={"input_shape": input_shape, + "complex_type": complex_type}) diff --git a/tests/layer_tests/pytorch_tests/test_slice_scatter.py b/tests/layer_tests/pytorch_tests/test_slice_scatter.py index 0d291f6bb4d3aa..1357a06c645ef7 100644 --- a/tests/layer_tests/pytorch_tests/test_slice_scatter.py +++ b/tests/layer_tests/pytorch_tests/test_slice_scatter.py @@ -1,4 +1,4 @@ -# Copyright (C) 2018-2023 Intel Corporation +# Copyright (C) 2018-2025 Intel Corporation # SPDX-License-Identifier: Apache-2.0 import pytest diff --git a/tests/layer_tests/pytorch_tests/test_stft.py b/tests/layer_tests/pytorch_tests/test_stft.py index f90962e5f1daa7..a2097b1f1fe453 100644 --- a/tests/layer_tests/pytorch_tests/test_stft.py +++ b/tests/layer_tests/pytorch_tests/test_stft.py @@ -98,7 +98,7 @@ def __init__(self, n_fft, hop_length, win_length, center, pad_mode, normalized, self.return_complex = return_complex def forward(self, x): - return torch.stft( + stft = torch.stft( x, self.n_fft, hop_length=self.hop_length, @@ -110,6 +110,10 @@ def forward(self, x): onesided=self.onesided, return_complex=self.return_complex, ) + if self.return_complex: + return torch.view_as_real(stft) + else: + return stft ref_net = None @@ -128,9 +132,9 @@ def forward(self, x): [16, None, None, False, "reflect", False, True, False], # hop & win length None [16, 4, None, False, "reflect", False, True, False], # win_length None [16, 4, 16, False, "reflect", True, True, False], # normalized True + [16, 4, 16, False, "reflect", False, True, True], # return_complex True # Unsupported cases: [16, 4, 16, False, "reflect", False, False, False], # onesided False - [16, 4, 16, False, "reflect", False, True, True], # reutrn_complex True ]) def test_stft_not_supported_attrs(self, n_fft, hop_length, win_length, center, pad_mode, normalized, onesided, return_complex, ie_device, precision, ir_version, trace_model): if ie_device == "GPU": @@ -144,9 +148,5 @@ def test_stft_not_supported_attrs(self, n_fft, hop_length, win_length, center, p pytest.xfail( reason="aten::stft conversion is currently supported with onesided=True only") - if return_complex is True: - pytest.xfail( - reason="aten::stft conversion is currently supported with return_complex=False only") - self._test(*self.create_model_with_attrs(n_fft, hop_length, win_length, center, pad_mode, normalized, onesided, return_complex), ie_device, precision, ir_version, kwargs_to_prepare_input={}, trace_model=trace_model) diff --git a/tests/layer_tests/pytorch_tests/test_unary_ops.py b/tests/layer_tests/pytorch_tests/test_unary_ops.py index 9807343080043c..584a80fe4ce254 100644 --- a/tests/layer_tests/pytorch_tests/test_unary_ops.py +++ b/tests/layer_tests/pytorch_tests/test_unary_ops.py @@ -75,7 +75,7 @@ class unary_op_net(torch.nn.Module): def __init__(self, op, dtype): - super(unary_op_net, self).__init__() + super().__init__() self.dtype = dtype self.op = op @@ -87,7 +87,7 @@ def forward(self, x): class unary_op_out_net(torch.nn.Module): def __init__(self, op, dtype): - super(unary_op_out_net, self).__init__() + super().__init__() self.dtype = dtype self.op = op @@ -101,7 +101,7 @@ def forward(self, x): class unary_func_op_inplace_net(torch.nn.Module): def __init__(self, op, dtype): - super(unary_func_op_inplace_net, self).__init__() + super().__init__() self.dtype = dtype self.op = op @@ -111,6 +111,17 @@ def forward(self, x): return y, x1 +class prim_abs_net(torch.nn.Module): + def __init__(self, dtype): + super().__init__() + self.dtype = dtype + + def forward(self, x): + x1 = x.to(self.dtype) + y = abs(x1) + return y, x1 + + class TestUnaryOp(PytorchLayerTest): def _prepare_input(self): # random number in range [1, 11) @@ -265,3 +276,13 @@ def test_unary_func_op_inplace(self, op_type, dtype, ie_device, precision, ir_ve self.dtype = dtype self._test(unary_func_op_inplace_net(OPS[op_type], dtype), None, op_type + "_", ie_device, precision, ir_version) + + @pytest.mark.nightly + @pytest.mark.precommit + @pytest.mark.precommit_torch_export + @pytest.mark.precommit_fx_backend + @pytest.mark.parametrize("dtype", [torch.float32, torch.float64, torch.int8, torch.uint8, torch.int32, torch.int64]) + def test_prim_abs(self, dtype, ie_device, precision, ir_version): + self.dtype = dtype + self._test(prim_abs_net(dtype), None, "prim::abs", + ie_device, precision, ir_version) diff --git a/tests/layer_tests/tensorflow_tests/test_tf_TensorScatterAdd.py b/tests/layer_tests/tensorflow_tests/test_tf_TensorScatterAdd.py index 392469646b2803..8e6a64c141fa2c 100644 --- a/tests/layer_tests/tensorflow_tests/test_tf_TensorScatterAdd.py +++ b/tests/layer_tests/tensorflow_tests/test_tf_TensorScatterAdd.py @@ -1,4 +1,4 @@ -# Copyright (C) 2018-2024 Intel Corporation +# Copyright (C) 2018-2025 Intel Corporation # SPDX-License-Identifier: Apache-2.0 import numpy as np diff --git a/tests/model_hub_tests/transformation_tests/models/hf-tiny-random-vl-models-precommit b/tests/model_hub_tests/transformation_tests/models/hf-tiny-random-vl-models-precommit index 327ba3f7e8e966..7cdd3fdb3527be 100644 --- a/tests/model_hub_tests/transformation_tests/models/hf-tiny-random-vl-models-precommit +++ b/tests/model_hub_tests/transformation_tests/models/hf-tiny-random-vl-models-precommit @@ -1,4 +1,4 @@ katuni4ka/tiny-random-llava-next,https://huggingface.co/katuni4ka/tiny-random-llava-next katuni4ka/tiny-random-minicpmv-2_6,https://huggingface.co/katuni4ka/tiny-random-minicpmv-2_6 katuni4ka/tiny-random-llava,https://huggingface.co/katuni4ka/tiny-random-llava -katuni4ka/tiny-random-nanollava,https://huggingface.co/katuni4ka/tiny-random-nanollava,xfail,CVS-157416 \ No newline at end of file +katuni4ka/tiny-random-nanollava,https://huggingface.co/katuni4ka/tiny-random-nanollava \ No newline at end of file diff --git a/tests/model_hub_tests/transformation_tests/sdpa2pa_ref_diff.py b/tests/model_hub_tests/transformation_tests/sdpa2pa_ref_diff.py index b7131aeb024293..118ba5bcd392e7 100644 --- a/tests/model_hub_tests/transformation_tests/sdpa2pa_ref_diff.py +++ b/tests/model_hub_tests/transformation_tests/sdpa2pa_ref_diff.py @@ -133,7 +133,7 @@ "hf-tiny-model-private/tiny-random-OPTForCausalLM" : { "Assign" : -10, "PagedAttentionExtension" : 5, - "Parameter" : 14, + "Parameter" : 13, "ReadValue" : -10, "ScaledDotProductAttention" : -5, }, @@ -273,14 +273,14 @@ "facebook/opt-125m" : { "Assign" : -24, "PagedAttentionExtension" : 12, - "Parameter" : 28, + "Parameter" : 27, "ReadValue" : -24, "ScaledDotProductAttention" : -12, }, "facebook/opt-350m" : { "Assign" : -48, "PagedAttentionExtension" : 24, - "Parameter" : 52, + "Parameter" : 51, "ReadValue" : -48, "ScaledDotProductAttention" : -24, }, @@ -319,13 +319,13 @@ "ReadValue" : -4, "ScaledDotProductAttention" : -2, }, - # "katuni4ka/tiny-random-nanollava" : { - # "Assign" : -4, - # "PagedAttentionExtension" : 2, - # "Parameter" : 7, - # "ReadValue" : -4, - # "ScaledDotProductAttention" : -2, - # }, + "katuni4ka/tiny-random-nanollava" : { + "Assign" : -4, + "Parameter" : 7, + "ReadValue" : -4, + "ScaledDotProductAttention" : -2, + "PagedAttentionExtension" : 2, + }, "hf-internal-testing/tiny-random-GPTNeoForCausalLM" : { "ScaledDotProductAttention" : -4, "ReadValue" : -8, @@ -465,7 +465,7 @@ "hf-tiny-model-private/tiny-random-OPTForCausalLM" : { "Assign" : -10, "PagedAttentionExtension" : 5, - "Parameter" : 29, + "Parameter" : 28, "ReadValue" : -10, "ScaledDotProductAttention" : -5, }, @@ -605,14 +605,14 @@ "facebook/opt-125m" : { "Assign" : -24, "PagedAttentionExtension" : 12, - "Parameter" : 64, + "Parameter" : 63, "ReadValue" : -24, "ScaledDotProductAttention" : -12, }, "facebook/opt-350m" : { "Assign" : -48, "PagedAttentionExtension" : 24, - "Parameter" : 124, + "Parameter" : 123, "ReadValue" : -48, "ScaledDotProductAttention" : -24, }, @@ -651,13 +651,13 @@ "ReadValue" : -4, "ScaledDotProductAttention" : -2, }, - # "katuni4ka/tiny-random-nanollava" : { - # "Assign" : -4, - # "PagedAttentionExtension" : 2, - # "Parameter" : 13, - # "ReadValue" : -4, - # "ScaledDotProductAttention" : -2, - # }, + "katuni4ka/tiny-random-nanollava" : { + "Assign" : -4, + "PagedAttentionExtension" : 2, + "Parameter" : 13, + "ReadValue" : -4, + "ScaledDotProductAttention" : -2, + }, "hf-internal-testing/tiny-random-GPTNeoForCausalLM" : { "ScaledDotProductAttention" : -4, diff --git a/tests/requirements_pytorch b/tests/requirements_pytorch index 33907145f7de4b..e186c2ab63ab67 100644 --- a/tests/requirements_pytorch +++ b/tests/requirements_pytorch @@ -11,9 +11,8 @@ torchvision==0.20.1; platform_system != "Darwin" or platform_machine != "x86_64" torchvision==0.17.2; platform_system == "Darwin" and platform_machine == "x86_64" torchaudio==2.5.1; platform_system != "Darwin" or platform_machine != "x86_64" torchaudio==2.2.2; platform_system == "Darwin" and platform_machine == "x86_64" -# transformers 4.45.1 is available -# but optimum still requires <4.45.0 -transformers==4.44.2 +# before updating transformers version, make sure no tests (esp. sdpa2pa) are failing +transformers==4.47.1 pytest==7.0.1; python_version < '3.10' pytest==7.2.0; python_version >= '3.10' pytest-html==4.1.1 @@ -21,6 +20,8 @@ pytest-xdist[psutil]==3.6.1 defusedxml==0.7.1 autoawq==0.2.7; platform_system == "Linux" and platform_machine == "x86_64" +# triton is a dependency of autoawq, newer versions lead to TorchFX test failures +triton==3.1.0; platform_system == "Linux" and platform_machine == "x86_64" auto-gptq==0.7.1; platform_system == "Linux" and platform_machine == "x86_64" and python_version < "3.12" av==13.0.0 basicsr==1.4.2; python_version < "3.12" @@ -44,8 +45,9 @@ super-image==0.1.7 # huggingface-hub required for super-image huggingface-hub==0.25.2 -# use latest released version once it's available -git+https://github.com/huggingface/optimum-intel.git@5c735487d4bd3dd8d7dccb242d8d5988e7dd4069; python_version < "3.12" +# For now, we decided to pin a specific working version of optimum-intel. +# It will be discussed in the future how to manage versioning of the components properly. +git+https://github.com/huggingface/optimum-intel.git@190ae8737db68a826a86e48a709b41ae51d2e3ee; python_version < "3.12" # set 'export HF_HUB_ENABLE_HF_TRANSFER=1' to benefits from hf_transfer hf_transfer==0.1.8 diff --git a/tests/time_tests/src/timetests/timetest_infer_api_2.cpp b/tests/time_tests/src/timetests/timetest_infer_api_2.cpp index 67943bf27a68f9..08bf0edb6279e8 100644 --- a/tests/time_tests/src/timetests/timetest_infer_api_2.cpp +++ b/tests/time_tests/src/timetests/timetest_infer_api_2.cpp @@ -1,4 +1,4 @@ -// Copyright (C) 2018-2021 Intel Corporation +// Copyright (C) 2018-2025 Intel Corporation // SPDX-License-Identifier: Apache-2.0 // #include diff --git a/tools/constraints.txt b/tools/constraints.txt deleted file mode 100644 index 73d244545aa499..00000000000000 --- a/tools/constraints.txt +++ /dev/null @@ -1,16 +0,0 @@ -# EXCEPTIONS -# some package versions need to be specified in respective requirements.txt -# files because the version differs between them: -# tensorflow, numpy -h5py>=3.1.0,<3.11.0 -onnx>=1.8.1,<=1.17.0 -pytest>=5.0,<8.4 -protobuf>=3.18.1,<4.0.0 -defusedxml>=0.7.1 -requests>=2.25.1 -coverage>=4.4.2,<=7.0.5 -astroid>=2.9.0 -pylint>=2.7.0 -pyenchant>=3.0.0 -urllib3>=1.26.4 -openvino-telemetry>=2023.2.1 diff --git a/tools/ovc/openvino/tools/ovc/__init__.py b/tools/ovc/openvino/tools/ovc/__init__.py index 25d8b28298f5c9..db0c2e84309598 100644 --- a/tools/ovc/openvino/tools/ovc/__init__.py +++ b/tools/ovc/openvino/tools/ovc/__init__.py @@ -3,7 +3,7 @@ import sys from openvino.tools.ovc.convert import convert_model -from openvino.tools.ovc.telemetry_utils import is_optimum, init_ovc_telemetry, is_torch_compile +from openvino.tools.ovc.telemetry_utils import is_optimum, init_ovc_telemetry, is_torch_compile, is_keras3 import importlib.metadata as importlib_metadata @@ -24,3 +24,8 @@ torch_version = importlib_metadata.version("torch") telemetry = init_ovc_telemetry("torch.compile", torch_version) telemetry.send_event("torch.compile", "import", "Import from torch.compile(), ov_version: {}".format(get_rt_version())) + +if is_keras3() and 'keras' in sys.modules: + keras_version = importlib_metadata.version("keras") + telemetry = init_ovc_telemetry("keras3", keras_version) + telemetry.send_event("keras3", "import", "Import from keras3, ov_version: {}".format(get_rt_version())) diff --git a/tools/ovc/openvino/tools/ovc/telemetry_utils.py b/tools/ovc/openvino/tools/ovc/telemetry_utils.py index a2cc8dab2cf49b..aaa2080cca9c89 100644 --- a/tools/ovc/openvino/tools/ovc/telemetry_utils.py +++ b/tools/ovc/openvino/tools/ovc/telemetry_utils.py @@ -31,6 +31,13 @@ def is_torch_compile(): return True return False +def is_keras3(): + import traceback + for line in traceback.format_stack(): + if os.path.join("keras", "src", "backend", "openvino") in line: + return True + return False + def init_ovc_telemetry(app_name='OVC', app_version=None): app_version = app_version if app_version is not None else get_rt_version() return init_telemetry_class(tid=get_tid(),