diff --git a/.github/actions/common/artifact_utils.py b/.github/actions/common/artifact_utils.py index b5e95c65d5234b..58c96fbe5dedd6 100644 --- a/.github/actions/common/artifact_utils.py +++ b/.github/actions/common/artifact_utils.py @@ -3,7 +3,7 @@ import argparse import os from pathlib import Path -from .constants import EventType, ProductType +from .constants import EventType, ProductType, PlatformKey def add_common_args(parser: argparse.ArgumentParser): @@ -12,10 +12,14 @@ def add_common_args(parser: argparse.ArgumentParser): default=os.getenv('GITHUB_BASE_REF') or os.getenv('GITHUB_REF_NAME')) parser.add_argument('-e', '--event_name', help='Name of GitHub event', required=False, default=os.getenv('GITHUB_EVENT_NAME')) - parser.add_argument('--storage_dir', help='Subdirectory name for artifacts, same as product type', required=True, - choices=[product_type.value for product_type in ProductType]) parser.add_argument('--storage_root', help='Root path of the artifacts storage', required=False, default=os.getenv('ARTIFACTS_SHARE')) + group = parser.add_mutually_exclusive_group(required=True) + group.add_argument('-d', '--storage_dir', help='Subdirectory name for artifacts, same as product type', + choices=[platform_key.value for platform_key in ProductType]) + group.add_argument('-p', '--platform', type=str, + help='Platform for which to restore artifacts. Used if storage_dir is not set', + choices=[product_type.value for product_type in PlatformKey]) def get_event_type(event_name: str = os.getenv('GITHUB_EVENT_NAME')) -> str: diff --git a/.github/actions/common/constants.py b/.github/actions/common/constants.py index 01b705f137556e..da55ece2ee4258 100644 --- a/.github/actions/common/constants.py +++ b/.github/actions/common/constants.py @@ -18,3 +18,27 @@ class EventType(Enum): 'public_windows_vs2019_Debug', ) ProductType = Enum('ProductType', {t.upper(): t for t in productTypes}) + + +platformKeys = ( + 'centos7_x86_64', + 'debian10_armhf', + 'rhel8_x86_64', + 'ubuntu20_arm64', + 'ubuntu20_x86_64', + 'ubuntu22_x86_64', + 'ubuntu24_x86_64', + 'macos_12_6_arm64', + 'macos_12_6_x86_64', + 'windows_x86_64', +) +PlatformKey = Enum('PlatformKey', {t.upper(): t for t in platformKeys}) + +PlatformMapping = { + PlatformKey.DEBIAN10_ARMHF: ProductType.PUBLIC_LINUX_DEBIAN_10_ARM_RELEASE, + PlatformKey.UBUNTU20_X86_64: ProductType.PUBLIC_LINUX_UBUNTU_20_04_X86_64_RELEASE, + 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, +} diff --git a/.github/actions/openvino_provider/action.yml b/.github/actions/openvino_provider/action.yml index 85c304f43d92ad..8cc865c5f5b461 100644 --- a/.github/actions/openvino_provider/action.yml +++ b/.github/actions/openvino_provider/action.yml @@ -2,7 +2,8 @@ name: 'OpenVINO provider' description: 'Provides OpenVINO build artifacts from a requested source' inputs: revision: - description: 'Version of OpenVINO to provide - latest_available | HEAD | specific commit hash' + description: 'Version of OpenVINO to provide - latest_available_commit | HEAD | specific commit hash | + latest_nightly | specific package version (e.g. 2024.4.0rc2)' required: true branch_name: description: 'Branch of OpenVINO to take the revision from if no specific hash was provided. @@ -11,21 +12,25 @@ inputs: ov_artifact_name: description: "Name under which to upload provided OpenVINO build artifacts, set automatically by default" required: false + platform: + description: "Platform for which to get artifacts: centos7 | debian10 | rhel8 | ubuntu20 | + ubuntu20 | ubuntu22 | ubuntu24 | macos | macos_12_6 | windows" + required: false + arch: + description: "Architecture for which to get artifacts: x86_64 | armhf | arm64" + default: "x86_64" + required: false + install_dir: + description: 'Local path to install OpenVINO package to. If not specified, package is installed to GitHub workspace + and uploaded to GitHub' + required: false commit_packages_to_provide: description: "Comma-separated list of OpenVINO packages from post-commit to provide ('all' to get everything)" required: false - commit_build_key: - description: 'public_linux_ubuntu_20_04_release | public_linux_ubuntu_22_04_release | - public_linux_ubuntu_24_04_release | public_windows_vs2019_release' - required: false commit_share_path: description: 'Path to share holding OpenVINO post-commit artifacts' required: false default: '/mount/build-artifacts' - nightly_build_key: - description: 'centos7_x86_64 | debian9_armhf | rhel8_x86_64 | ubuntu20_arm64 | ubuntu20_x86_64 | ubuntu22_x86_64 | - ubuntu24_x86_64 | macos_12_6_arm64 | macos_12_6_x86_64 | windows_x86_64' - required: false nightly_package_source: description: 'Source URL hosting OpenVINO nightly archives' required: false @@ -34,40 +39,44 @@ inputs: description: 'Source URL hosting OpenVINO wheels, for passing to pip as --extra-index-url' required: false default: 'https://storage.openvinotoolkit.org/simple/wheels' - package_url: - description: 'Direct URL to OpenVINO archive to use, if neither post-commit nor nightly archives are required' - required: false + outputs: ov_artifact_name: description: "Name of the artifact to upload OpenVINO build artifacts under" - value: ${{ steps.openvino_download.outputs.ov_artifact_name || steps.openvino_commit_output.outputs.ov_artifact_name }} - ov_package_path: - description: "Path to OpenVINO core package relative to the root of uploaded artifacts" - value: ${{ steps.openvino_download.outputs.ov_package_path || steps.openvino_commit_output.outputs.ov_package_path }} - ov_wheel_input: - description: "Input for pip to install OpenVINO python wheel" - value: ${{ steps.openvino_wheel.outputs.ov_wheel_input || steps.openvino_commit_wheel.outputs.ov_wheel_input }} + value: ${{ steps.openvino_s3_download.outputs.ov_artifact_name || steps.openvino_commit_output.outputs.ov_artifact_name }} ov_wheel_source: description: "Pip option for custom OV wheel location (--find-links or --extra-index-url)" - value: ${{ steps.openvino_wheel.outputs.ov_wheel_source || steps.openvino_commit_wheel.outputs.ov_wheel_source }} + value: ${{ steps.openvino_s3_wheel.outputs.ov_wheel_source || steps.openvino_commit_wheel.outputs.ov_wheel_source }} + ov_version: + description: "OpenVINO product version" + value: ${{ steps.openvino_s3_wheel.outputs.ov_version || steps.openvino_commit_wheel.outputs.ov_version }} runs: using: "composite" steps: - - name: Verify parameters - if: ${{ !inputs.package_url && !inputs.nightly_build_key && !inputs.commit_build_key }} + - name: Identify artifacts source + id: get_source shell: bash run: | - echo "Please, set one parameter for action - nightly_build_key, commit_build_key or package_url" - exit 1 + artifacts_source="postcommit" + if [[ "${{ inputs.revision }}" == "latest_nightly" || "${{ inputs.revision }}" =~ ^[0-9]{4}\.[0-9]+\.*[0-9]* ]]; then + artifacts_source="s3" + fi + echo "artifacts_source=$artifacts_source" >> $GITHUB_OUTPUT + + - name: Get action revision + id: get_action_revision + run: echo "action_ref=${{ env.ACTION_REF }}" >> $GITHUB_OUTPUT + shell: bash + env: + ACTION_REF: ${{ github.action_ref || github.base_ref || github.event.merge_group.base_ref || github.ref }} - uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7 with: repository: 'openvinotoolkit/openvino' - ref: ${{ inputs.branch_name || github.base_ref || github.event.merge_group.base_ref || github.ref }} + ref: ${{ steps.get_action_revision.outputs.action_ref }} sparse-checkout: .github/actions - # --- Post-commit case --- - name: Clone OpenVINO to get HEAD commit if: inputs.revision == 'HEAD' uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7 @@ -84,18 +93,25 @@ runs: head=$(git -C openvino rev-parse HEAD) echo "head=$head" >> $GITHUB_OUTPUT + - name: Create install dir + if: inputs.install_dir + shell: bash + run: | + mkdir -p ${{ inputs.install_dir }} + + # --- Post-commit case --- - name: Download post-commit OpenVINO archives id: openvino_commit_download - if: inputs.commit_build_key + if: steps.get_source.outputs.artifacts_source == 'postcommit' uses: ./.github/actions/restore_artifacts with: - storage_dir: ${{ inputs.commit_build_key }} + platform: ${{ inputs.platform }}_${{ inputs.arch }} storage_root: ${{ inputs.commit_share_path }} event_name: "commit" trigger_repo_sha: ${{ env.OV_REVISION }} branch_name: ${{ inputs.branch_name }} - artifacts_key: ${{ inputs.ov_artifact_name || inputs.commit_build_key }} to_restore: ${{ inputs.commit_packages_to_provide }} + target_dir: ${{ inputs.install_dir }} env: OV_REVISION: ${{ inputs.revision == 'HEAD' && steps.get_openvino_head_commit.outputs.head || inputs.revision }} @@ -104,79 +120,98 @@ runs: if: steps.openvino_commit_download.outcome == 'success' shell: bash run: | - ov_artifact_name=${{ inputs.ov_artifact_name || steps.openvino_commit_download.outputs.restored_artifacts_key }} - cd ${{ steps.openvino_commit_download.outputs.artifacts_workspace_path }} + ov_artifact_name=${{ inputs.ov_artifact_name || inputs.platform }} + workspace_path=${{ steps.openvino_commit_download.outputs.artifacts_path }} + cd $workspace_path ov_package_path=$(find . -name 'openvino_package*' -printf "%P\n" -quit) [ -z "$ov_package_path" ] && echo "No openvino_package found in restored artifacts" && exit 1 + mv $ov_package_path/* . && rm -rf $ov_package_path echo "ov_artifact_name=$ov_artifact_name" >> $GITHUB_OUTPUT - echo "ov_package_path=$ov_package_path" >> $GITHUB_OUTPUT + echo "ov_package_path=$workspace_path" >> $GITHUB_OUTPUT - name: Get commit wheel id: openvino_commit_wheel if: steps.openvino_commit_download.outcome == 'success' shell: bash run: | - cd ${{ steps.openvino_commit_download.outputs.artifacts_workspace_path }} + artifacts_path=${{ steps.openvino_commit_download.outputs.artifacts_path }} + cd $artifacts_path version=$(yq eval '.components.dldt.custom_params.wheel_product_version' manifest.yml) - wheel_path=${{ steps.openvino_commit_output.outputs.ov_package_path }}/tools - default_find_links_cmd="--find-links=./$wheel_path" + wheel_path=${{ inputs.install_dir && '$artifacts_path/tools' || './tools' }} + default_find_links_cmd="--find-links=$wheel_path" find_links_cmd=$([[ -n "$PIP_FIND_LINKS" ]] && echo "" || echo "$default_find_links_cmd") - wheel_input="$find_links_cmd openvino==$version" - echo "ov_wheel_input=$wheel_input" >> $GITHUB_OUTPUT + echo "ov_version=$version" >> $GITHUB_OUTPUT echo "ov_wheel_source=$default_find_links_cmd" >> $GITHUB_OUTPUT + - name: Upload commit OpenVINO archives + if: steps.openvino_commit_download.outcome == 'success' && !inputs.install_dir + uses: actions/upload-artifact@v4 + with: + name: ${{ steps.openvino_commit_output.outputs.ov_artifact_name }} + path: ${{ steps.openvino_commit_output.outputs.ov_package_path }} + if-no-files-found: 'error' - # --- S3 case (nightly or direct URL) --- - - name: Verify parameters - if: (inputs.nightly_build_key || inputs.package_url) && inputs.revision != 'latest_available' + # --- S3 case --- + - name: Get a specific S3 package URL + id: get_s3_package + if: steps.get_source.outputs.artifacts_source == 's3' && inputs.revision != 'latest_nightly' shell: bash - run: | - echo "Nightly and package_url build sources provide only 'latest' artifacts, specific revision not supported" - exit 1 + run: >- + python3 -m venv venv && . venv/bin/activate && + pip install -r $GITHUB_ACTION_PATH/requirements.txt && + python $GITHUB_ACTION_PATH/get_s3_package.py --product openvino --platform ${{ inputs.platform }} --arch ${{ inputs.arch }} + --version ${{ inputs.revision }} - - name: Download OpenVINO archives - id: openvino_download - if: inputs.nightly_build_key || inputs.package_url + - name: Download nightly OpenVINO archives + id: openvino_s3_download + if: steps.get_source.outputs.artifacts_source == 's3' shell: bash run: | - if [ ${{ inputs.package_url }} ]; then - ov_package_url=${{ inputs.package_url }} + if [ ${{ steps.get_s3_package.outcome }} != 'skipped' ]; then + ov_package_url=${{ steps.get_s3_package.outputs.package_url }} else - ov_package_url=$(curl -s ${{ inputs.nightly_package_source }} | jq -r '.${{ inputs.nightly_build_key }}') + ov_package_url=$(curl -s ${{ inputs.nightly_package_source }} | jq -r '.${{ inputs.platform }}_${{ inputs.arch }}') fi + cd ${{ inputs.install_dir || env.GITHUB_WORKSPACE }} package_basename=$(basename $ov_package_url) wget $ov_package_url --progress=bar:force:noscroll -O $package_basename - package_folder=${package_basename%.*} && mkdir $package_folder - [[ "$package_basename" == *.zip ]] && unzip "$package_basename" -d $package_folder || tar -xvf "$package_basename" -C $package_folder + package_folder=${package_basename%.*} + [[ "$package_basename" == *.zip ]] && unzip "$package_basename" || tar -xvf "$package_basename" + rm $package_basename + if [ ${{ inputs.install_dir }} ]; then + mv $package_folder/* . && rm -rf $package_folder + fi ov_artifact_name=$([ ${{ inputs.ov_artifact_name }} ] && echo ${{ inputs.ov_artifact_name }} || echo $package_folder) + echo "ov_package_url=$ov_package_url" >> $GITHUB_OUTPUT echo "ov_artifact_name=$ov_artifact_name" >> $GITHUB_OUTPUT echo "ov_package_path=$package_folder" >> $GITHUB_OUTPUT - name: Upload OpenVINO archives - if: steps.openvino_download.outcome == 'success' + if: steps.openvino_s3_download.outcome == 'success' && !inputs.install_dir uses: actions/upload-artifact@v4 with: - name: ${{ steps.openvino_download.outputs.ov_artifact_name }} - path: ${{ steps.openvino_download.outputs.ov_package_path }} + name: ${{ steps.openvino_s3_download.outputs.ov_artifact_name }} + path: ${{ steps.openvino_s3_download.outputs.ov_package_path }} if-no-files-found: 'error' - name: Get wheel - id: openvino_wheel - if: steps.openvino_download.outcome == 'success' + id: openvino_s3_wheel + if: steps.openvino_s3_download.outcome == 'success' shell: bash run: | - rc_version=$(echo ${{ inputs.package_url }} | + rc_version=$(echo ${{ steps.openvino_s3_download.outputs.ov_package_url }} | grep -oP '(?<=pre-release\/)\d{4}\.\d+\.\d+rc\d+' || true) - release_version=$(echo ${{ steps.openvino_download.outputs.ov_package_path }} | + release_version=$(echo ${{ steps.openvino_s3_download.outputs.ov_package_path }} | grep -oP '_\K\d{4}\.\d+\.\d+') - dev_version=$(echo ${{ steps.openvino_download.outputs.ov_package_path }} | + dev_version=$(echo ${{ steps.openvino_s3_download.outputs.ov_package_path }} | grep -oP "${release_version//./\\.}\.dev\d{8}" || true) version=${rc_version:-${dev_version:-$release_version}} + extra_index="--pre --extra-index-url ${{ inputs.pip_extra_url }}/nightly \ --extra-index-url ${{ inputs.pip_extra_url }}/pre-release" - wheel_input="$extra_index openvino==$version" - echo "ov_wheel_input=$wheel_input" >> $GITHUB_OUTPUT + + echo "ov_version=$version" >> $GITHUB_OUTPUT echo "ov_wheel_source=$extra_index" >> $GITHUB_OUTPUT diff --git a/.github/actions/openvino_provider/get_s3_package.py b/.github/actions/openvino_provider/get_s3_package.py new file mode 100644 index 00000000000000..df253a422421ec --- /dev/null +++ b/.github/actions/openvino_provider/get_s3_package.py @@ -0,0 +1,77 @@ +import requests +import re +import argparse +import logging +import sys + +from pathlib import Path + +sys.path.append(str(Path(__file__).parents[1])) +from common import action_utils + + +# Function to download the JSON file +def load_json_file(url): + response = requests.get(url) + if response.status_code == 200: + return response.json() + else: + raise Exception(f"Failed to download the file, status code: {response.status_code}") + + +# Function to recursively gather all file paths from the JSON structure +def gather_all_files(node, base_path=''): + all_files = [] + if 'children' in node: + for child in node['children']: + new_base = f"{base_path}/{child['name']}" + if 'children' in child: + all_files += gather_all_files(child, new_base) + else: + all_files.append(new_base) + return all_files + + +# Function to filter files based on the product, version, platform, architecture, and folder +def filter_files_by_criteria(files, product, version_pattern, platform, arch, folder): + matching_files = [] + for file in files: + if re.search( + fr"{product}/packages/{folder}(/?.*/)?{version_pattern}/.*{platform}.*{arch}.*\.(tar\.gz|tgz|zip)$", + file): + matching_files.append(file) + return matching_files + + +# Main function to load the JSON, gather file paths, and filter based on criteria +def main(product, version_pattern, platform, arch, folder): + action_utils.init_logger() + logger = logging.getLogger(__name__) + + url = 'https://storage.openvinotoolkit.org/filetree.json' + filetree = load_json_file(url) + all_files = gather_all_files(filetree) + matching_files = filter_files_by_criteria(all_files, product, version_pattern, platform, arch, folder) + if matching_files: + logger.info(f"Matching packages: {sorted(matching_files)}") + package_url = f"https://storage.openvinotoolkit.org{sorted(matching_files)[-1]}" + logger.info(f"Returning package URL: {package_url}") + action_utils.set_github_output("package_url", package_url) + else: + logger.error("No matching files found.") + sys.exit(1) + + +if __name__ == "__main__": + parser = argparse.ArgumentParser( + description='Search OpenVINO archives based on product, version, platform, architecture, and folder.') + parser.add_argument('--product', required=True, choices=['openvino', 'openvino_genai', 'openvino_tokenizers'], + help='Product name') + parser.add_argument('--version', required=True, help='Version pattern (supports regex)') + parser.add_argument('--platform', default='ubuntu22', help='Platform (default: ubuntu22)') + parser.add_argument('--arch', default='x86_64', help='Architecture (default: x86_64)') + parser.add_argument('--folder', default='(.*/)?', help='Folder type (e.g., pre-release, nightly, default: (.*)?') + + args = parser.parse_args() + + main(args.product, args.version, args.platform, args.arch, args.folder) diff --git a/.github/actions/openvino_provider/requirements.txt b/.github/actions/openvino_provider/requirements.txt new file mode 100644 index 00000000000000..fb1be95648e227 --- /dev/null +++ b/.github/actions/openvino_provider/requirements.txt @@ -0,0 +1 @@ +requests~=2.32 diff --git a/.github/actions/restore_artifacts/action.yml b/.github/actions/restore_artifacts/action.yml index f86bd0060860dd..efa0dfe87ae28f 100644 --- a/.github/actions/restore_artifacts/action.yml +++ b/.github/actions/restore_artifacts/action.yml @@ -1,9 +1,12 @@ name: 'Restore artifacts' -description: 'Take artifacts from a shared drive and load them back to GitHub' +description: 'Take artifacts from a shared drive and store them in a workspace' inputs: storage_dir: - description: "Subdirectory name for artifacts, same as product type" - required: true + description: "Subdirectory name for artifacts, same as product type. Optional if 'platform' argument is set" + required: false + platform: + description: "Platform for which to restore artifacts. Used if 'storage_dir' is not set" + required: false storage_root: description: "Root path of the artifacts storage" required: true @@ -16,9 +19,6 @@ inputs: trigger_repo_sha: description: "Commit hash of a trigger repo. If not set - taken from github context" required: false - artifacts_key: - description: "A key under which to upload the artifacts to storage, product type by default" - required: false to_restore: description: "Comma-separated list of packages to restore, all available by default" required: false @@ -26,28 +26,27 @@ inputs: description: "Whether to unpack all artifact archives once retrieved" required: false default: 'true' - + target_dir: + description: "Where to place artifact archives once retrieved" + required: false outputs: - artifacts_workspace_path: - description: "Path within the workspace where the artifacts are stored" - value: ${{ steps.restore.outputs.artifacts_workspace_path }} - restored_artifacts_key: - description: "Key under which the restored artifacts, if any, were uploaded to GitHub" - value: ${{ steps.restore.outputs.restored_artifacts_key }} + artifacts_path: + description: "Path where the artifacts are stored" + value: ${{ steps.restore.outputs.artifacts_path }} runs: using: "composite" steps: - name: Restore artifacts id: restore - if: "!inputs.artifacts" shell: ${{ runner.os == 'Windows' && 'pwsh' || 'bash' }} run: >- python3 ${{ env.ACTION_PATH }}/restore_artifacts.py - -t "${{ env.GITHUB_WORKSPACE }}/${{ inputs.storage_dir }}" - --storage_dir "${{ inputs.storage_dir }}" --storage_root "${{ inputs.storage_root }}" + -t "${{ inputs.target_dir || env.DEFAULT_TARGET_DIR }}" + --storage_root "${{ inputs.storage_root }}" -s "${{ inputs.trigger_repo_sha || github.event.pull_request.head.sha || github.sha }}" + ${{ inputs.storage_dir && env.STORAGE_PARAM || env.PLATFORM_PARAM }} ${{ inputs.unpack_archives == 'true' && '--unpack_archives' || '' }} ${{ inputs.branch_name && env.BRANCH_PARAM || '' }} ${{ inputs.event_name && env.EVENT_PARAM || '' }} @@ -55,14 +54,9 @@ runs: env: ACTION_PATH: ${{ runner.os == 'Windows' && '$env:GITHUB_ACTION_PATH' || '$GITHUB_ACTION_PATH' }} GITHUB_WORKSPACE: ${{ runner.os == 'Windows' && '$env:GITHUB_WORKSPACE' || '$GITHUB_WORKSPACE' }} + STORAGE_PARAM: "--storage_dir ${{ inputs.storage_dir }}" + PLATFORM_PARAM: "--platform ${{ inputs.platform }}" BRANCH_PARAM: "-b ${{ inputs.branch_name }}" EVENT_PARAM: "-e ${{ inputs.event_name }}" TO_RESTORE: "-r ${{ inputs.to_restore }}" - - - name: Upload artifacts - if: "!inputs.artifacts" - uses: actions/upload-artifact@65462800fd760344b1a7b4382951275a0abb4808 # v4.3.3 - with: - name: ${{ inputs.artifacts_key || steps.restore.outputs.restored_artifacts_key }} - path: ${{ steps.restore.outputs.artifacts_workspace_path }} - if-no-files-found: 'error' + DEFAULT_TARGET_DIR: "${{ env.GITHUB_WORKSPACE }}/${{ inputs.storage_dir || inputs.platform }}" diff --git a/.github/actions/restore_artifacts/restore_artifacts.py b/.github/actions/restore_artifacts/restore_artifacts.py index 8a780ce174470f..d79388a27f5616 100644 --- a/.github/actions/restore_artifacts/restore_artifacts.py +++ b/.github/actions/restore_artifacts/restore_artifacts.py @@ -14,16 +14,13 @@ sys.path.append(str(Path(__file__).parents[1])) from common import artifact_utils, action_utils - +from common.constants import PlatformMapping, PlatformKey def parse_args(): parser = argparse.ArgumentParser(description='Returns a path to artifacts for a given revision on a shared drive') artifact_utils.add_common_args(parser) parser.add_argument('-t', '--target_dir', type=str, help='Path to a dir in a workspace to download artifacts into', required=True) - parser.add_argument('-k', '--artifact_key', type=str, - help='A key under which to upload the artifacts to storage, product type by default', - required=False) parser.add_argument('-r', '--to_restore', type=str, required=False, help='Comma-separated list of packages to restore, all available by default') parser.add_argument('-u', '--unpack_archives', action='store_true', required=False, @@ -49,20 +46,22 @@ def main(): logger = logging.getLogger(__name__) args = parse_args() - if args.commit_sha == 'latest_available': - latest_artifacts_link = artifact_utils.get_latest_artifacts_link(args.storage_dir, args.storage_root, + storage_dir = args.storage_dir or PlatformMapping[PlatformKey[args.platform.upper()]].value + + if args.commit_sha == 'latest_available_commit': + latest_artifacts_link = artifact_utils.get_latest_artifacts_link(storage_dir, args.storage_root, args.branch_name, args.event_name) latest_artifacts_path = PureWindowsPath(latest_artifacts_link.read_text()) normalized_path = latest_artifacts_path.as_posix() if os.name == 'posix' else latest_artifacts_path storage = Path(args.storage_root) / normalized_path else: - storage = artifact_utils.get_storage_dir(args.storage_dir, args.commit_sha, args.storage_root, args.branch_name, + storage = artifact_utils.get_storage_dir(storage_dir, args.commit_sha, args.storage_root, args.branch_name, args.event_name) action_utils.set_github_output("artifacts_storage_path", str(storage)) logger.info(f"Artifacts are taken from here: {storage}") - main_package_extension = 'zip' if 'windows' in args.storage_dir else 'tar.gz' + main_package_extension = 'zip' if 'windows' in storage_dir else 'tar.gz' main_package_name = f'openvino_package.{main_package_extension}' defaults = [main_package_name, 'manifest.yml'] to_restore = set(args.to_restore.split(',')).union(defaults) if args.to_restore else defaults @@ -82,8 +81,7 @@ def main(): shutil.unpack_archive(file, output_dir) file.unlink() - action_utils.set_github_output("artifacts_workspace_path", args.target_dir) - action_utils.set_github_output("restored_artifacts_key", args.artifact_key or args.storage_dir) + action_utils.set_github_output("artifacts_path", args.target_dir) if __name__ == '__main__': diff --git a/.github/actions/store_artifacts/action.yml b/.github/actions/store_artifacts/action.yml index 2ada54cd8e7709..4e50953d8c9874 100644 --- a/.github/actions/store_artifacts/action.yml +++ b/.github/actions/store_artifacts/action.yml @@ -4,9 +4,12 @@ inputs: artifacts: description: "Multi-line list of artifacts to store" required: true + platform: + description: "Platform for which to restore artifacts. Used if 'storage_dir' is not set" + required: false storage_dir: - description: "Subdirectory name for stored artifacts, same as product type" - required: true + description: "Subdirectory name for stored artifacts, same as product type. Optional if 'platform' argument is set" + required: false storage_root: description: "Root path to place artifacts to" required: true @@ -45,12 +48,15 @@ runs: shell: ${{ runner.os == 'Windows' && 'pwsh' || 'bash' }} run: >- python3 ${{ env.ACTION_PATH }}/store_artifacts.py - --storage_dir "${{ inputs.storage_dir }}" --storage_root "${{ inputs.storage_root }}" + --storage_root "${{ inputs.storage_root }}" -a "${{ inputs.artifacts }}" -s "${{ inputs.trigger_repo_sha || github.event.pull_request.head.sha || github.sha }}" + ${{ inputs.storage_dir && env.STORAGE_PARAM || env.PLATFORM_PARAM }} ${{ inputs.branch_name && env.BRANCH_PARAM || '' }} ${{ inputs.event_name && env.EVENT_PARAM || '' }} env: ACTION_PATH: ${{ runner.os == 'Windows' && '$env:GITHUB_ACTION_PATH' || '$GITHUB_ACTION_PATH' }} BRANCH_PARAM: "-b ${{ inputs.branch_name }}" EVENT_PARAM: "-e ${{ inputs.event_name }}" + STORAGE_PARAM: "--storage_dir ${{ inputs.storage_dir }}" + PLATFORM_PARAM: "--platform ${{ inputs.platform }}" diff --git a/.github/actions/store_artifacts/store_artifacts.py b/.github/actions/store_artifacts/store_artifacts.py index bbab2c8e694778..75cd452b562070 100644 --- a/.github/actions/store_artifacts/store_artifacts.py +++ b/.github/actions/store_artifacts/store_artifacts.py @@ -13,6 +13,7 @@ sys.path.append(str(Path(__file__).parents[1])) from common import artifact_utils, action_utils +from common.constants import PlatformMapping, PlatformKey def parse_args(): @@ -67,7 +68,8 @@ def main(): args = parse_args() storage_root = args.storage_root or os.getenv('ARTIFACTS_SHARE') - storage = artifact_utils.get_storage_dir(args.storage_dir, args.commit_sha, args.storage_root, args.branch_name, + storage_dir = args.storage_dir or PlatformMapping[PlatformKey[args.platform.upper()]].value + storage = artifact_utils.get_storage_dir(storage_dir, args.commit_sha, args.storage_root, args.branch_name, args.event_name) action_utils.set_github_output("artifacts_storage_path", str(storage)) @@ -96,7 +98,7 @@ def main(): with open(storage / 'workflow_link.txt', 'w') as file: file.write(workflow_link) - latest_artifacts_for_branch = artifact_utils.get_latest_artifacts_link(args.storage_dir, args.storage_root, + latest_artifacts_for_branch = artifact_utils.get_latest_artifacts_link(storage_dir, args.storage_root, args.branch_name, args.event_name) # Overwrite path to "latest" built artifacts only if a given commit is the head of a given branch if args.event_name != 'pull_request' and args.commit_sha == os.getenv('GITHUB_SHA'): diff --git a/.github/workflows/android_arm64.yml b/.github/workflows/android_arm64.yml index bbd737dff0e569..6a67e8f6793ec9 100644 --- a/.github/workflows/android_arm64.yml +++ b/.github/workflows/android_arm64.yml @@ -24,7 +24,7 @@ jobs: skip_workflow: "${{ steps.smart_ci.outputs.skip_workflow }}" steps: - name: checkout action - uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7 + uses: actions/checkout@d632683dd7b4114ad314bca15554477dd762a938 # v4.2.0 with: sparse-checkout: .github/actions/smart-ci @@ -53,7 +53,7 @@ jobs: images: "${{ steps.handle_docker.outputs.images }}" steps: - name: Checkout - uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7 + uses: actions/checkout@d632683dd7b4114ad314bca15554477dd762a938 # v4.2.0 - uses: ./.github/actions/handle_docker id: handle_docker @@ -98,7 +98,7 @@ jobs: SCCACHE_AZURE_KEY_PREFIX: android_arm64 steps: - name: Clone OpenVINO - uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7 + uses: actions/checkout@d632683dd7b4114ad314bca15554477dd762a938 # v4.2.0 with: path: 'openvino' @@ -116,7 +116,7 @@ jobs: popd - name: Clone vcpkg - uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7 + uses: actions/checkout@d632683dd7b4114ad314bca15554477dd762a938 # v4.2.0 with: repository: 'microsoft/vcpkg' ref: ${{ env.VCPKG_VERSION }} diff --git a/.github/workflows/android_x64.yml b/.github/workflows/android_x64.yml index 3504b8cf2fdeb1..cab5239b4c45c0 100644 --- a/.github/workflows/android_x64.yml +++ b/.github/workflows/android_x64.yml @@ -27,7 +27,7 @@ jobs: skip_workflow: "${{ steps.smart_ci.outputs.skip_workflow }}" steps: - name: checkout action - uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7 + uses: actions/checkout@d632683dd7b4114ad314bca15554477dd762a938 # v4.2.0 with: sparse-checkout: .github/actions/smart-ci @@ -56,7 +56,7 @@ jobs: images: "${{ steps.handle_docker.outputs.images }}" steps: - name: Checkout - uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7 + uses: actions/checkout@d632683dd7b4114ad314bca15554477dd762a938 # v4.2.0 - uses: ./.github/actions/handle_docker id: handle_docker @@ -97,13 +97,13 @@ jobs: SCCACHE_AZURE_KEY_PREFIX: android_x64 steps: - name: Clone OpenVINO - uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7 + uses: actions/checkout@d632683dd7b4114ad314bca15554477dd762a938 # v4.2.0 with: path: 'openvino' submodules: 'true' - name: Clone OpenVINO GenAI - uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7 + uses: actions/checkout@d632683dd7b4114ad314bca15554477dd762a938 # v4.2.0 with: repository: 'openvinotoolkit/openvino.genai' path: ${{ env.OPENVINO_GENAI_REPO }} diff --git a/.github/workflows/build_doc.yml b/.github/workflows/build_doc.yml index d6d3a63e431ecd..ec08a12352d0f4 100644 --- a/.github/workflows/build_doc.yml +++ b/.github/workflows/build_doc.yml @@ -18,7 +18,7 @@ jobs: if: ${{ github.repository_owner == 'openvinotoolkit' }} steps: - name: Clone OpenVINO - uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7 + uses: actions/checkout@d632683dd7b4114ad314bca15554477dd762a938 # v4.2.0 with: submodules: 'true' lfs: 'true' diff --git a/.github/workflows/check_pr_commits.yml b/.github/workflows/check_pr_commits.yml index 690b85046a108b..5710736f322652 100644 --- a/.github/workflows/check_pr_commits.yml +++ b/.github/workflows/check_pr_commits.yml @@ -9,7 +9,7 @@ jobs: if: ${{ github.repository_owner == 'openvinotoolkit' }} steps: - name: Clone OpenVINO - uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7 + uses: actions/checkout@d632683dd7b4114ad314bca15554477dd762a938 # v4.2.0 - name: Install dependencies run: python3 -m pip install -r ./.github/github_org_control/requirements.txt diff --git a/.github/workflows/cleanup_caches.yml b/.github/workflows/cleanup_caches.yml index 948b73466ab903..53a426bfa32b42 100644 --- a/.github/workflows/cleanup_caches.yml +++ b/.github/workflows/cleanup_caches.yml @@ -48,7 +48,7 @@ jobs: steps: - name: Checkout cach action - uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7 + uses: actions/checkout@d632683dd7b4114ad314bca15554477dd762a938 # v4.2.0 with: sparse-checkout: .github/actions/cache diff --git a/.github/workflows/code_snippets.yml b/.github/workflows/code_snippets.yml index 82daec9ee791f9..5384ece83fb207 100644 --- a/.github/workflows/code_snippets.yml +++ b/.github/workflows/code_snippets.yml @@ -28,7 +28,7 @@ jobs: if: ${{ github.repository_owner == 'openvinotoolkit' }} steps: - name: Clone OpenVINO - uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7 + uses: actions/checkout@d632683dd7b4114ad314bca15554477dd762a938 # v4.2.0 with: submodules: 'true' diff --git a/.github/workflows/code_style.yml b/.github/workflows/code_style.yml index c2db68edca3956..777ba7694d0be5 100644 --- a/.github/workflows/code_style.yml +++ b/.github/workflows/code_style.yml @@ -10,11 +10,11 @@ permissions: read-all jobs: clang-format: runs-on: ubuntu-22.04 + if: ${{ github.repository_owner == 'openvinotoolkit' }} permissions: pull-requests: write - if: ${{ github.repository_owner == 'openvinotoolkit' }} steps: - - uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7 + - uses: actions/checkout@d632683dd7b4114ad314bca15554477dd762a938 # v4.2.0 with: submodules: 'true' @@ -40,10 +40,11 @@ jobs: ShellCheck: runs-on: ubuntu-22.04 + if: ${{ github.repository_owner == 'openvinotoolkit' }} permissions: pull-requests: write steps: - - uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7 + - uses: actions/checkout@d632683dd7b4114ad314bca15554477dd762a938 # v4.2.0 with: submodules: 'true' @@ -73,8 +74,9 @@ jobs: NamingConventionCheck: runs-on: ubuntu-22.04 + if: ${{ github.repository_owner == 'openvinotoolkit' }} steps: - - uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7 + - uses: actions/checkout@d632683dd7b4114ad314bca15554477dd762a938 # v4.2.0 with: submodules: 'true' diff --git a/.github/workflows/coverage.yml b/.github/workflows/coverage.yml index b9b70e90668498..44ba4445ba8bb8 100644 --- a/.github/workflows/coverage.yml +++ b/.github/workflows/coverage.yml @@ -32,7 +32,7 @@ jobs: max-size: 50G - name: Clone OpenVINO - uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7 + uses: actions/checkout@d632683dd7b4114ad314bca15554477dd762a938 # v4.2.0 with: submodules: 'true' diff --git a/.github/workflows/coverity.yml b/.github/workflows/coverity.yml index 0de4cb045bfeb4..25daf31604ab18 100644 --- a/.github/workflows/coverity.yml +++ b/.github/workflows/coverity.yml @@ -51,14 +51,14 @@ jobs: apt-get install --assume-yes --no-install-recommends git ca-certificates - name: Clone OpenVINO - uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7 + uses: actions/checkout@d632683dd7b4114ad314bca15554477dd762a938 # v4.2.0 with: path: ${{ env.OPENVINO_REPO }} submodules: 'true' ref: ${{ inputs.openvinoRef }} - name: Clone OpenVINO Contrib - uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7 + uses: actions/checkout@d632683dd7b4114ad314bca15554477dd762a938 # v4.2.0 with: repository: 'openvinotoolkit/openvino_contrib' path: ${{ env.OPENVINO_CONTRIB_REPO }} diff --git a/.github/workflows/debian_10_arm.yml b/.github/workflows/debian_10_arm.yml index 7fab775b45b886..2bac51f3fefeb8 100644 --- a/.github/workflows/debian_10_arm.yml +++ b/.github/workflows/debian_10_arm.yml @@ -24,7 +24,7 @@ jobs: skip_workflow: "${{ steps.smart_ci.outputs.skip_workflow }}" steps: - name: checkout action - uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7 + uses: actions/checkout@d632683dd7b4114ad314bca15554477dd762a938 # v4.2.0 with: sparse-checkout: .github/actions/smart-ci @@ -58,7 +58,7 @@ jobs: images: "${{ steps.handle_docker.outputs.images }}" steps: - name: Checkout - uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7 + uses: actions/checkout@d632683dd7b4114ad314bca15554477dd762a938 # v4.2.0 - uses: ./.github/actions/handle_docker id: handle_docker diff --git a/.github/workflows/dependency_review.yml b/.github/workflows/dependency_review.yml index e73acd765ed7f9..3dcd9a367b018c 100644 --- a/.github/workflows/dependency_review.yml +++ b/.github/workflows/dependency_review.yml @@ -9,7 +9,7 @@ jobs: if: ${{ github.repository_owner == 'openvinotoolkit' }} steps: - name: Clone OpenVINO - uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7 + uses: actions/checkout@d632683dd7b4114ad314bca15554477dd762a938 # v4.2.0 - name: Dependency Review uses: actions/dependency-review-action@72eb03d02c7872a771aacd928f3123ac62ad6d3a # v4.3.3 diff --git a/.github/workflows/dev_cpu_linux_snippets_libxsmm.yml b/.github/workflows/dev_cpu_linux_snippets_libxsmm.yml index 8c4cfb5523efa6..fef0b0dec8b433 100644 --- a/.github/workflows/dev_cpu_linux_snippets_libxsmm.yml +++ b/.github/workflows/dev_cpu_linux_snippets_libxsmm.yml @@ -32,7 +32,7 @@ jobs: skip_workflow: "${{ steps.smart_ci.outputs.skip_workflow }}" steps: - name: checkout action - uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7 + uses: actions/checkout@d632683dd7b4114ad314bca15554477dd762a938 # v4.2.0 with: sparse-checkout: .github/actions/smart-ci @@ -65,7 +65,7 @@ jobs: images: "${{ steps.handle_docker.outputs.images }}" steps: - name: Checkout - uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7 + uses: actions/checkout@d632683dd7b4114ad314bca15554477dd762a938 # v4.2.0 - uses: ./.github/actions/handle_docker id: handle_docker @@ -109,7 +109,7 @@ jobs: steps: - name: Clone OpenVINO - uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7 + uses: actions/checkout@d632683dd7b4114ad314bca15554477dd762a938 # v4.2.0 with: path: ${{ env.OPENVINO_REPO }} submodules: 'true' @@ -295,7 +295,7 @@ jobs: popd - name: Fetch setup_python action - uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7 + uses: actions/checkout@d632683dd7b4114ad314bca15554477dd762a938 # v4.2.0 with: sparse-checkout: | .github/actions/setup_python/action.yml diff --git a/.github/workflows/fedora_29.yml b/.github/workflows/fedora_29.yml index b3a540fb287bd8..ba4e8940f3182a 100644 --- a/.github/workflows/fedora_29.yml +++ b/.github/workflows/fedora_29.yml @@ -24,7 +24,7 @@ jobs: skip_workflow: "${{ steps.smart_ci.outputs.skip_workflow }}" steps: - name: checkout action - uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7 + uses: actions/checkout@d632683dd7b4114ad314bca15554477dd762a938 # v4.2.0 with: sparse-checkout: .github/actions/smart-ci @@ -58,7 +58,7 @@ jobs: images: "${{ steps.handle_docker.outputs.images }}" steps: - name: Checkout - uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7 + uses: actions/checkout@d632683dd7b4114ad314bca15554477dd762a938 # v4.2.0 - uses: ./.github/actions/handle_docker id: handle_docker diff --git a/.github/workflows/files_size.yml b/.github/workflows/files_size.yml index 6a006cc7d4ada8..3733ad48ca49d2 100644 --- a/.github/workflows/files_size.yml +++ b/.github/workflows/files_size.yml @@ -12,7 +12,7 @@ jobs: runs-on: ubuntu-22.04 if: ${{ github.repository_owner == 'openvinotoolkit' }} steps: - - uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7 + - uses: actions/checkout@d632683dd7b4114ad314bca15554477dd762a938 # v4.2.0 - name: git ls-tree run: git ls-tree -r -t -l --full-name HEAD | sort -n -r -k 4 diff --git a/.github/workflows/job_build_linux.yml b/.github/workflows/job_build_linux.yml index 244bb0ca2ca113..0520336ccd20c0 100644 --- a/.github/workflows/job_build_linux.yml +++ b/.github/workflows/job_build_linux.yml @@ -91,7 +91,7 @@ jobs: PRODUCT_TYPE: public_linux_${{ inputs.os }}_${{ inputs.arch }}_release steps: - name: Clone OpenVINO - uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7 + uses: actions/checkout@d632683dd7b4114ad314bca15554477dd762a938 # v4.2.0 with: path: ${{ env.OPENVINO_REPO }} submodules: 'true' @@ -106,7 +106,7 @@ jobs: git rev-parse HEAD - name: Clone OpenVINO Contrib - uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7 + uses: actions/checkout@d632683dd7b4114ad314bca15554477dd762a938 # v4.2.0 with: repository: 'openvinotoolkit/openvino_contrib' path: ${{ env.OPENVINO_CONTRIB_REPO }} diff --git a/.github/workflows/job_build_windows.yml b/.github/workflows/job_build_windows.yml index 81283ecfafb729..bd6d6074382f73 100644 --- a/.github/workflows/job_build_windows.yml +++ b/.github/workflows/job_build_windows.yml @@ -47,13 +47,13 @@ jobs: PRODUCT_TYPE: 'public_windows_vs2019_${{ inputs.build-type }}' steps: - name: Clone OpenVINO - uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7 + uses: actions/checkout@d632683dd7b4114ad314bca15554477dd762a938 # v4.2.0 with: path: 'openvino' submodules: 'true' - name: Clone OpenVINO Contrib - uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7 + uses: actions/checkout@d632683dd7b4114ad314bca15554477dd762a938 # v4.2.0 with: repository: 'openvinotoolkit/openvino_contrib' path: 'openvino_contrib' diff --git a/.github/workflows/job_cpu_functional_tests.yml b/.github/workflows/job_cpu_functional_tests.yml index d924ba4003d5d8..1ad48695eb5bcb 100644 --- a/.github/workflows/job_cpu_functional_tests.yml +++ b/.github/workflows/job_cpu_functional_tests.yml @@ -63,7 +63,7 @@ jobs: popd - name: Fetch setup_python action - uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7 + uses: actions/checkout@d632683dd7b4114ad314bca15554477dd762a938 # v4.2.0 with: sparse-checkout: | .github/actions/setup_python/action.yml diff --git a/.github/workflows/job_jax_models_tests.yml b/.github/workflows/job_jax_models_tests.yml index 0d1a2944bf8ccf..74dc28078e300f 100644 --- a/.github/workflows/job_jax_models_tests.yml +++ b/.github/workflows/job_jax_models_tests.yml @@ -72,7 +72,7 @@ jobs: popd - name: Fetch setup_python action - uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7 + uses: actions/checkout@d632683dd7b4114ad314bca15554477dd762a938 # v4.2.0 with: sparse-checkout: | .github/actions/setup_python/action.yml diff --git a/.github/workflows/job_openvino_js.yml b/.github/workflows/job_openvino_js.yml index 3b1911c28cea4e..e722af78832c12 100644 --- a/.github/workflows/job_openvino_js.yml +++ b/.github/workflows/job_openvino_js.yml @@ -32,7 +32,7 @@ jobs: DISPLAY: ':99' steps: - name: Fetch OpenVINO JS sources - uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7 + uses: actions/checkout@d632683dd7b4114ad314bca15554477dd762a938 # v4.2.0 with: sparse-checkout: | src/bindings/js diff --git a/.github/workflows/job_python_unit_tests.yml b/.github/workflows/job_python_unit_tests.yml index 4074fe53a6eab3..e4d4a1f1a9f75b 100644 --- a/.github/workflows/job_python_unit_tests.yml +++ b/.github/workflows/job_python_unit_tests.yml @@ -29,7 +29,7 @@ env: jobs: Python_Unit_Tests: name: Python unit tests - timeout-minutes: 60 + timeout-minutes: 70 runs-on: ${{ inputs.runner }} container: ${{ fromJSON(inputs.container) }} defaults: @@ -73,7 +73,7 @@ jobs: popd - name: Fetch setup_python action - uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7 + uses: actions/checkout@d632683dd7b4114ad314bca15554477dd762a938 # v4.2.0 with: sparse-checkout: | .github/actions/setup_python/action.yml @@ -283,7 +283,7 @@ jobs: - name: Clone API snippets if: runner.os != 'macOS' - uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7 + uses: actions/checkout@d632683dd7b4114ad314bca15554477dd762a938 # v4.2.0 with: sparse-checkout: docs/articles_en/assets/snippets path: ${{ env.OPENVINO_REPO }} diff --git a/.github/workflows/job_pytorch_models_tests.yml b/.github/workflows/job_pytorch_models_tests.yml index 957debd77deb39..8b26d1c6ecc3d4 100644 --- a/.github/workflows/job_pytorch_models_tests.yml +++ b/.github/workflows/job_pytorch_models_tests.yml @@ -85,7 +85,7 @@ jobs: popd - name: Fetch setup_python action - uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7 + uses: actions/checkout@d632683dd7b4114ad314bca15554477dd762a938 # v4.2.0 with: sparse-checkout: | .github/actions/setup_python/action.yml diff --git a/.github/workflows/job_samples_tests.yml b/.github/workflows/job_samples_tests.yml index 59392daa52a3e3..0ada0e1557d965 100644 --- a/.github/workflows/job_samples_tests.yml +++ b/.github/workflows/job_samples_tests.yml @@ -68,7 +68,7 @@ jobs: - name: Fetch setup_python action # Python is already installed on Ubuntu within Dockerfile if: runner.os != 'Linux' - uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7 + uses: actions/checkout@d632683dd7b4114ad314bca15554477dd762a938 # v4.2.0 with: sparse-checkout: | .github/actions/setup_python/action.yml diff --git a/.github/workflows/job_tensorflow_layer_tests.yml b/.github/workflows/job_tensorflow_layer_tests.yml index 2de80c76637ba4..4cf82dcce6192c 100644 --- a/.github/workflows/job_tensorflow_layer_tests.yml +++ b/.github/workflows/job_tensorflow_layer_tests.yml @@ -91,7 +91,7 @@ jobs: popd - name: Fetch setup_python action - uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7 + uses: actions/checkout@d632683dd7b4114ad314bca15554477dd762a938 # v4.2.0 with: sparse-checkout: | .github/actions/setup_python/action.yml diff --git a/.github/workflows/job_tensorflow_models_tests.yml b/.github/workflows/job_tensorflow_models_tests.yml index 7793449c0365db..bad1be6de41954 100644 --- a/.github/workflows/job_tensorflow_models_tests.yml +++ b/.github/workflows/job_tensorflow_models_tests.yml @@ -77,7 +77,7 @@ jobs: popd - name: Fetch setup_python action - uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7 + uses: actions/checkout@d632683dd7b4114ad314bca15554477dd762a938 # v4.2.0 with: sparse-checkout: | .github/actions/setup_python/action.yml diff --git a/.github/workflows/job_tokenizers.yml b/.github/workflows/job_tokenizers.yml index 7bb8c1fcae4b82..fdd0a76088c725 100644 --- a/.github/workflows/job_tokenizers.yml +++ b/.github/workflows/job_tokenizers.yml @@ -51,7 +51,7 @@ jobs: echo "EXTENSION_BUILD_DIR=$GITHUB_WORKSPACE/build" >> "$GITHUB_ENV" - name: checkout action - uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7 + uses: actions/checkout@d632683dd7b4114ad314bca15554477dd762a938 # v4.2.0 with: sparse-checkout: | .github/actions/setup_python @@ -67,7 +67,7 @@ jobs: self-hosted-runner: ${{ runner.os == 'Linux' }} - name: Clone OpenVINO Tokenizers - uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7 + uses: actions/checkout@d632683dd7b4114ad314bca15554477dd762a938 # v4.2.0 with: repository: 'openvinotoolkit/openvino_tokenizers' path: ${{ env.OPENVINO_TOKENIZERS_REPO }} diff --git a/.github/workflows/labeler.yml b/.github/workflows/labeler.yml index f6464838555e50..4c631b673f8cc2 100644 --- a/.github/workflows/labeler.yml +++ b/.github/workflows/labeler.yml @@ -10,6 +10,7 @@ jobs: contents: read pull-requests: write runs-on: ubuntu-latest + if: ${{ github.repository_owner == 'openvinotoolkit' }} steps: - uses: akladiev/labeler@eeac5941e7fb6f980d47e038ac0665168851c874 # v4.3.1 with: @@ -22,9 +23,10 @@ jobs: external_pr_labeller: name: Label External PR runs-on: ubuntu-latest + if: ${{ github.repository_owner == 'openvinotoolkit' }} steps: - name: Checkout Labeller Script - uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7 + uses: actions/checkout@d632683dd7b4114ad314bca15554477dd762a938 # v4.2.0 with: sparse-checkout: '.github' diff --git a/.github/workflows/linux_arm64.yml b/.github/workflows/linux_arm64.yml index 2e557ebc5ef477..9a52bf294461d5 100644 --- a/.github/workflows/linux_arm64.yml +++ b/.github/workflows/linux_arm64.yml @@ -28,7 +28,7 @@ jobs: skip_workflow: "${{ steps.smart_ci.outputs.skip_workflow }}" steps: - name: checkout action - uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7 + uses: actions/checkout@d632683dd7b4114ad314bca15554477dd762a938 # v4.2.0 with: sparse-checkout: .github/actions/smart-ci @@ -62,7 +62,7 @@ jobs: images: "${{ steps.handle_docker.outputs.images }}" steps: - name: Checkout - uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7 + uses: actions/checkout@d632683dd7b4114ad314bca15554477dd762a938 # v4.2.0 - uses: ./.github/actions/handle_docker id: handle_docker diff --git a/.github/workflows/linux_conditional_compilation.yml b/.github/workflows/linux_conditional_compilation.yml index f9359e323d4baf..f8abe78439dbf6 100644 --- a/.github/workflows/linux_conditional_compilation.yml +++ b/.github/workflows/linux_conditional_compilation.yml @@ -29,7 +29,7 @@ jobs: skip_workflow: "${{ steps.smart_ci.outputs.skip_workflow }}" steps: - name: checkout action - uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7 + uses: actions/checkout@d632683dd7b4114ad314bca15554477dd762a938 # v4.2.0 with: sparse-checkout: .github/actions/smart-ci @@ -63,7 +63,7 @@ jobs: images: "${{ steps.handle_docker.outputs.images }}" steps: - name: Checkout - uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7 + uses: actions/checkout@d632683dd7b4114ad314bca15554477dd762a938 # v4.2.0 - uses: ./.github/actions/handle_docker id: handle_docker @@ -109,13 +109,13 @@ jobs: steps: - name: Clone OpenVINO - uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7 + uses: actions/checkout@d632683dd7b4114ad314bca15554477dd762a938 # v4.2.0 with: path: ${{ env.OPENVINO_REPO }} submodules: 'true' - name: Clone test models - uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7 + uses: actions/checkout@d632683dd7b4114ad314bca15554477dd762a938 # v4.2.0 with: repository: 'openvinotoolkit/testdata' path: ${{ env.MODELS_PATH }} @@ -282,13 +282,13 @@ jobs: steps: - name: Clone OpenVINO - uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7 + uses: actions/checkout@d632683dd7b4114ad314bca15554477dd762a938 # v4.2.0 with: path: ${{ env.OPENVINO_REPO }} submodules: 'true' - name: Clone test models - uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7 + uses: actions/checkout@d632683dd7b4114ad314bca15554477dd762a938 # v4.2.0 with: repository: 'openvinotoolkit/testdata' path: ${{ env.MODELS_PATH }} diff --git a/.github/workflows/linux_riscv.yml b/.github/workflows/linux_riscv.yml index 3de8b56ad773cc..f124aae2e60ed2 100644 --- a/.github/workflows/linux_riscv.yml +++ b/.github/workflows/linux_riscv.yml @@ -24,7 +24,7 @@ jobs: skip_workflow: "${{ steps.smart_ci.outputs.skip_workflow }}" steps: - name: checkout action - uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7 + uses: actions/checkout@d632683dd7b4114ad314bca15554477dd762a938 # v4.2.0 with: sparse-checkout: .github/actions/smart-ci @@ -53,7 +53,7 @@ jobs: images: "${{ steps.handle_docker.outputs.images }}" steps: - name: Checkout - uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7 + uses: actions/checkout@d632683dd7b4114ad314bca15554477dd762a938 # v4.2.0 - uses: ./.github/actions/handle_docker id: handle_docker @@ -92,7 +92,7 @@ jobs: if: ${{ github.event_name != 'merge_group' }} steps: - name: Clone OpenVINO - uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7 + uses: actions/checkout@d632683dd7b4114ad314bca15554477dd762a938 # v4.2.0 with: path: 'openvino' diff --git a/.github/workflows/linux_sanitizers.yml b/.github/workflows/linux_sanitizers.yml index 367fce8eb98683..6facb984136067 100644 --- a/.github/workflows/linux_sanitizers.yml +++ b/.github/workflows/linux_sanitizers.yml @@ -66,13 +66,13 @@ jobs: apt-get install --assume-yes --no-install-recommends git ca-certificates - name: Clone OpenVINO - uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7 + uses: actions/checkout@d632683dd7b4114ad314bca15554477dd762a938 # v4.2.0 with: path: ${{ env.OPENVINO_REPO }} submodules: 'true' - name: Clone OpenVINO Contrib - uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7 + uses: actions/checkout@d632683dd7b4114ad314bca15554477dd762a938 # v4.2.0 with: repository: 'openvinotoolkit/openvino_contrib' path: ${{ env.OPENVINO_CONTRIB_REPO }} @@ -269,7 +269,7 @@ jobs: apt update && apt --assume-yes install clang lld - name: Fetch Sanitizer Suppression Lists - uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7 + uses: actions/checkout@d632683dd7b4114ad314bca15554477dd762a938 # v4.2.0 with: sparse-checkout: | tests/lsan/suppressions.txt diff --git a/.github/workflows/mac.yml b/.github/workflows/mac.yml index d60ef4608093b2..0846165711f772 100644 --- a/.github/workflows/mac.yml +++ b/.github/workflows/mac.yml @@ -42,7 +42,7 @@ jobs: skip_workflow: "${{ steps.smart_ci.outputs.skip_workflow }}" steps: - name: checkout action - uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7 + uses: actions/checkout@d632683dd7b4114ad314bca15554477dd762a938 # v4.2.0 with: sparse-checkout: .github/actions/smart-ci @@ -81,13 +81,13 @@ jobs: if: "!needs.smart_ci.outputs.skip_workflow" steps: - name: Clone OpenVINO - uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7 + uses: actions/checkout@d632683dd7b4114ad314bca15554477dd762a938 # v4.2.0 with: path: 'openvino' submodules: 'true' - name: Clone OpenVINO Contrib - uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7 + uses: actions/checkout@d632683dd7b4114ad314bca15554477dd762a938 # v4.2.0 with: repository: 'openvinotoolkit/openvino_contrib' path: 'openvino_contrib' diff --git a/.github/workflows/mac_arm64.yml b/.github/workflows/mac_arm64.yml index 73890d1284222e..abec86659c925b 100644 --- a/.github/workflows/mac_arm64.yml +++ b/.github/workflows/mac_arm64.yml @@ -42,7 +42,7 @@ jobs: skip_workflow: "${{ steps.smart_ci.outputs.skip_workflow }}" steps: - name: checkout action - uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7 + uses: actions/checkout@d632683dd7b4114ad314bca15554477dd762a938 # v4.2.0 with: sparse-checkout: .github/actions/smart-ci @@ -81,13 +81,13 @@ jobs: if: "!needs.smart_ci.outputs.skip_workflow" steps: - name: Clone OpenVINO - uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7 + uses: actions/checkout@d632683dd7b4114ad314bca15554477dd762a938 # v4.2.0 with: path: 'openvino' submodules: 'true' - name: Clone OpenVINO Contrib - uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7 + uses: actions/checkout@d632683dd7b4114ad314bca15554477dd762a938 # v4.2.0 with: repository: 'openvinotoolkit/openvino_contrib' path: 'openvino_contrib' diff --git a/.github/workflows/mo.yml b/.github/workflows/mo.yml index 9a112e7e53ced2..ee3e3e9fe5af77 100644 --- a/.github/workflows/mo.yml +++ b/.github/workflows/mo.yml @@ -24,7 +24,7 @@ jobs: if: ${{ github.repository_owner == 'openvinotoolkit' }} steps: - name: Clone OpenVINO - uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7 + uses: actions/checkout@d632683dd7b4114ad314bca15554477dd762a938 # v4.2.0 - name: Setup Python uses: actions/setup-python@f677139bbe7f9c59b41e40162b753c062f5d49a3 # v5.2.0 diff --git a/.github/workflows/ovc.yml b/.github/workflows/ovc.yml index 1e2668f26cb579..2e6986a96e3f29 100644 --- a/.github/workflows/ovc.yml +++ b/.github/workflows/ovc.yml @@ -19,7 +19,7 @@ jobs: if: ${{ github.repository_owner == 'openvinotoolkit' }} steps: - name: Clone OpenVINO - uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7 + uses: actions/checkout@d632683dd7b4114ad314bca15554477dd762a938 # v4.2.0 - name: Setup Python uses: actions/setup-python@f677139bbe7f9c59b41e40162b753c062f5d49a3 # v5.2.0 diff --git a/.github/workflows/py_checks.yml b/.github/workflows/py_checks.yml index 75a8a1b83f03d0..ae0625ce4a453c 100644 --- a/.github/workflows/py_checks.yml +++ b/.github/workflows/py_checks.yml @@ -28,7 +28,7 @@ jobs: if: ${{ github.repository_owner == 'openvinotoolkit' }} steps: - name: Clone OpenVINO - uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7 + uses: actions/checkout@d632683dd7b4114ad314bca15554477dd762a938 # v4.2.0 - name: Setup Python uses: actions/setup-python@f677139bbe7f9c59b41e40162b753c062f5d49a3 # v5.2.0 diff --git a/.github/workflows/send_workflows_to_opentelemetry.yml b/.github/workflows/send_workflows_to_opentelemetry.yml index ef597e55858b0e..687b79d2606bec 100644 --- a/.github/workflows/send_workflows_to_opentelemetry.yml +++ b/.github/workflows/send_workflows_to_opentelemetry.yml @@ -41,7 +41,7 @@ jobs: steps: - name: Checkout - uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7 + uses: actions/checkout@d632683dd7b4114ad314bca15554477dd762a938 # v4.2.0 with: sparse-checkout: '.github' diff --git a/.github/workflows/ubuntu_20.yml b/.github/workflows/ubuntu_20.yml index df1450a98e46a1..27d21707d117e6 100644 --- a/.github/workflows/ubuntu_20.yml +++ b/.github/workflows/ubuntu_20.yml @@ -30,7 +30,7 @@ jobs: skip_workflow: "${{ steps.smart_ci.outputs.skip_workflow }}" steps: - name: checkout action - uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7 + uses: actions/checkout@d632683dd7b4114ad314bca15554477dd762a938 # v4.2.0 with: sparse-checkout: .github/actions/smart-ci @@ -64,7 +64,7 @@ jobs: images: "${{ steps.handle_docker.outputs.images }}" steps: - name: Checkout - uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7 + uses: actions/checkout@d632683dd7b4114ad314bca15554477dd762a938 # v4.2.0 - uses: ./.github/actions/handle_docker id: handle_docker diff --git a/.github/workflows/ubuntu_22.yml b/.github/workflows/ubuntu_22.yml index 90618357b2c63f..ad53b5e0892590 100644 --- a/.github/workflows/ubuntu_22.yml +++ b/.github/workflows/ubuntu_22.yml @@ -32,7 +32,7 @@ jobs: skip_workflow: "${{ steps.smart_ci.outputs.skip_workflow }}" steps: - name: checkout action - uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7 + uses: actions/checkout@d632683dd7b4114ad314bca15554477dd762a938 # v4.2.0 with: sparse-checkout: .github/actions/smart-ci @@ -66,7 +66,7 @@ jobs: images: "${{ steps.handle_docker.outputs.images }}" steps: - name: Checkout - uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7 + uses: actions/checkout@d632683dd7b4114ad314bca15554477dd762a938 # v4.2.0 - uses: ./.github/actions/handle_docker id: handle_docker @@ -183,7 +183,7 @@ jobs: popd - name: Fetch setup_python action - uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7 + uses: actions/checkout@d632683dd7b4114ad314bca15554477dd762a938 # v4.2.0 with: sparse-checkout: | .github/actions/setup_python/action.yml @@ -447,7 +447,7 @@ jobs: popd - name: Clone OpenVINO Contrib - uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7 + uses: actions/checkout@d632683dd7b4114ad314bca15554477dd762a938 # v4.2.0 with: repository: 'openvinotoolkit/openvino_contrib' path: ${{ env.OPENVINO_CONTRIB_REPO }} diff --git a/.github/workflows/ubuntu_22_dpcpp.yml b/.github/workflows/ubuntu_22_dpcpp.yml index 1ee9df0095ff02..9ca27262a5dcde 100644 --- a/.github/workflows/ubuntu_22_dpcpp.yml +++ b/.github/workflows/ubuntu_22_dpcpp.yml @@ -20,7 +20,7 @@ jobs: skip_workflow: "${{ steps.smart_ci.outputs.skip_workflow }}" steps: - name: checkout action - uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7 + uses: actions/checkout@d632683dd7b4114ad314bca15554477dd762a938 # v4.2.0 with: sparse-checkout: .github/actions/smart-ci @@ -54,7 +54,7 @@ jobs: images: "${{ steps.handle_docker.outputs.images }}" steps: - name: Checkout - uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7 + uses: actions/checkout@d632683dd7b4114ad314bca15554477dd762a938 # v4.2.0 - uses: ./.github/actions/handle_docker id: handle_docker diff --git a/.github/workflows/ubuntu_24.yml b/.github/workflows/ubuntu_24.yml index 474e8a46ae57aa..abb160e62c4d75 100644 --- a/.github/workflows/ubuntu_24.yml +++ b/.github/workflows/ubuntu_24.yml @@ -27,7 +27,7 @@ jobs: skip_workflow: "${{ steps.smart_ci.outputs.skip_workflow }}" steps: - name: checkout action - uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7 + uses: actions/checkout@d632683dd7b4114ad314bca15554477dd762a938 # v4.2.0 with: sparse-checkout: .github/actions/smart-ci @@ -61,7 +61,7 @@ jobs: images: "${{ steps.handle_docker.outputs.images }}" steps: - name: Checkout - uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7 + uses: actions/checkout@d632683dd7b4114ad314bca15554477dd762a938 # v4.2.0 - uses: ./.github/actions/handle_docker id: handle_docker diff --git a/.github/workflows/webassembly.yml b/.github/workflows/webassembly.yml index a4a1a17af9d5ce..c4d835637352ad 100644 --- a/.github/workflows/webassembly.yml +++ b/.github/workflows/webassembly.yml @@ -24,7 +24,7 @@ jobs: skip_workflow: "${{ steps.smart_ci.outputs.skip_workflow }}" steps: - name: checkout action - uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7 + uses: actions/checkout@d632683dd7b4114ad314bca15554477dd762a938 # v4.2.0 with: sparse-checkout: .github/actions/smart-ci @@ -58,7 +58,7 @@ jobs: images: "${{ steps.handle_docker.outputs.images }}" steps: - name: Checkout - uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7 + uses: actions/checkout@d632683dd7b4114ad314bca15554477dd762a938 # v4.2.0 - uses: ./.github/actions/handle_docker id: handle_docker @@ -91,7 +91,7 @@ jobs: SCCACHE_AZURE_KEY_PREFIX: webassembly_Release steps: - name: Clone OpenVINO - uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7 + uses: actions/checkout@d632683dd7b4114ad314bca15554477dd762a938 # v4.2.0 with: path: 'openvino' submodules: 'true' diff --git a/.github/workflows/windows_conditional_compilation.yml b/.github/workflows/windows_conditional_compilation.yml index eaf97ddd7f9dfc..ed6599a038a748 100644 --- a/.github/workflows/windows_conditional_compilation.yml +++ b/.github/workflows/windows_conditional_compilation.yml @@ -30,7 +30,7 @@ jobs: skip_workflow: "${{ steps.smart_ci.outputs.skip_workflow }}" steps: - name: checkout action - uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7 + uses: actions/checkout@d632683dd7b4114ad314bca15554477dd762a938 # v4.2.0 with: sparse-checkout: .github/actions/smart-ci @@ -73,13 +73,13 @@ jobs: steps: - name: Clone OpenVINO - uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7 + uses: actions/checkout@d632683dd7b4114ad314bca15554477dd762a938 # v4.2.0 with: path: 'openvino' submodules: 'true' - name: Clone test models - uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7 + uses: actions/checkout@d632683dd7b4114ad314bca15554477dd762a938 # v4.2.0 with: repository: 'openvinotoolkit/testdata' path: 'testdata' @@ -282,13 +282,13 @@ jobs: steps: - name: Clone OpenVINO - uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7 + uses: actions/checkout@d632683dd7b4114ad314bca15554477dd762a938 # v4.2.0 with: path: 'openvino' submodules: 'true' - name: Clone test models - uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7 + uses: actions/checkout@d632683dd7b4114ad314bca15554477dd762a938 # v4.2.0 with: repository: 'openvinotoolkit/testdata' path: 'testdata' @@ -369,7 +369,7 @@ jobs: run: Expand-Archive ${{ env.INSTALL_TEST_DIR }}/openvino_tests.zip -DestinationPath "${{ env.INSTALL_TEST_DIR }}" - name: Fetch setup_python action - uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7 + uses: actions/checkout@d632683dd7b4114ad314bca15554477dd762a938 # v4.2.0 with: sparse-checkout: | .github/actions/setup_python/action.yml diff --git a/.github/workflows/windows_vs2019_debug.yml b/.github/workflows/windows_vs2019_debug.yml index f52b58d1a81197..0c0cec15a8cdc8 100644 --- a/.github/workflows/windows_vs2019_debug.yml +++ b/.github/workflows/windows_vs2019_debug.yml @@ -21,7 +21,7 @@ jobs: skip_workflow: "${{ steps.smart_ci.outputs.skip_workflow }}" steps: - name: checkout action - uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7 + uses: actions/checkout@d632683dd7b4114ad314bca15554477dd762a938 # v4.2.0 with: sparse-checkout: .github/actions/smart-ci diff --git a/.github/workflows/windows_vs2019_release.yml b/.github/workflows/windows_vs2019_release.yml index 43c3879ba4ae8d..59e2fdd56de5f3 100644 --- a/.github/workflows/windows_vs2019_release.yml +++ b/.github/workflows/windows_vs2019_release.yml @@ -26,7 +26,7 @@ jobs: skip_workflow: "${{ steps.smart_ci.outputs.skip_workflow }}" steps: - name: checkout action - uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7 + uses: actions/checkout@d632683dd7b4114ad314bca15554477dd762a938 # v4.2.0 with: sparse-checkout: .github/actions/smart-ci @@ -90,7 +90,7 @@ jobs: popd - name: Fetch setup_python action - uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7 + uses: actions/checkout@d632683dd7b4114ad314bca15554477dd762a938 # v4.2.0 with: sparse-checkout: | .github/actions/setup_python/action.yml @@ -156,7 +156,7 @@ jobs: steps: - name: Fetch OpenVINO JS sources - uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7 + uses: actions/checkout@d632683dd7b4114ad314bca15554477dd762a938 # v4.2.0 with: sparse-checkout: | src/bindings/js @@ -255,7 +255,7 @@ jobs: popd - name: Fetch setup_python action - uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7 + uses: actions/checkout@d632683dd7b4114ad314bca15554477dd762a938 # v4.2.0 with: sparse-checkout: | .github/actions/setup_python/action.yml @@ -455,7 +455,7 @@ jobs: popd - name: Fetch setup_python action - uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7 + uses: actions/checkout@d632683dd7b4114ad314bca15554477dd762a938 # v4.2.0 with: sparse-checkout: | .github/actions/setup_python/action.yml diff --git a/.github/workflows/workflow_rerunner.yml b/.github/workflows/workflow_rerunner.yml index 1c193f35dfa17e..7da00df4e46d32 100644 --- a/.github/workflows/workflow_rerunner.yml +++ b/.github/workflows/workflow_rerunner.yml @@ -31,7 +31,7 @@ jobs: checks: read steps: - name: Checkout - uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7 + uses: actions/checkout@d632683dd7b4114ad314bca15554477dd762a938 # v4.2.0 with: sparse-checkout: '.github/scripts/workflow_rerun' @@ -58,11 +58,11 @@ jobs: rerunner_tests: name: Rerunner Tests - if: ${{ github.event_name == 'pull_request' }} + if: ${{ github.event_name == 'pull_request' && github.repository_owner == 'openvinotoolkit' }} runs-on: aks-linux-2-cores-8gb steps: - name: Checkout - uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7 + uses: actions/checkout@d632683dd7b4114ad314bca15554477dd762a938 # v4.2.0 with: sparse-checkout: '.github/scripts/workflow_rerun' lfs: true diff --git a/docs/articles_en/about-openvino/release-notes-openvino.rst b/docs/articles_en/about-openvino/release-notes-openvino.rst index 0e3e84cfdc2aad..903cf854b24d48 100644 --- a/docs/articles_en/about-openvino/release-notes-openvino.rst +++ b/docs/articles_en/about-openvino/release-notes-openvino.rst @@ -63,7 +63,7 @@ Now deprecated * The macOS x86_64 debug bins * Python 3.8 - * dKMB support + * Discrete Keem Bay support * 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. @@ -1323,7 +1323,12 @@ Deprecated and to be removed in the future with OpenVINO 2024.5. * Python 3.8 is now considered deprecated, and it will not be available beyond the 2024.4 OpenVINO version. -* dKMB support is now considered deprecated and will be fully removed with OpenVINO 2024.5 + + * As MxNet doesn't support Python version higher than 3.8, according to the + `MxNet PyPI project `__, + it will no longer be supported in future versions, either. + +* Discrete Keem Bay support is now considered deprecated and will be fully removed with OpenVINO 2024.5 * 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 * The openvino-nightly PyPI module will soon be discontinued. End-users should proceed with the diff --git a/docs/articles_en/about-openvino/release-notes-openvino/system-requirements.rst b/docs/articles_en/about-openvino/release-notes-openvino/system-requirements.rst index e12cefe0048470..50ac3a3350658e 100644 --- a/docs/articles_en/about-openvino/release-notes-openvino/system-requirements.rst +++ b/docs/articles_en/about-openvino/release-notes-openvino/system-requirements.rst @@ -89,7 +89,7 @@ Intel® Neural Processing Unit * Ubuntu 24.04 long-term support (LTS), 64-bit (preview support) * Ubuntu 22.04 long-term support (LTS), 64-bit - * Windows 11, 64-bit (22H2, 23H2) + * Windows 11, 64-bit (22H2 and later) .. tab-item:: Additional considerations diff --git a/docs/sphinx_setup/_static/js/custom.js b/docs/sphinx_setup/_static/js/custom.js index 5ee1260c8f400e..797b0a93766529 100644 --- a/docs/sphinx_setup/_static/js/custom.js +++ b/docs/sphinx_setup/_static/js/custom.js @@ -108,18 +108,20 @@ $(document).ready(function () { function handleSidebar() { const resizer = document.querySelector("#bd-resizer"); - const sidebar = document.querySelector("#bd-sidebar"); - resizer.addEventListener("mousedown", (event) => { - document.addEventListener("mousemove", resize, false); - document.addEventListener("mouseup", () => { - document.removeEventListener("mousemove", resize, false); - }, false); - }); - - function resize(e) { - const size = `${e.x}px`; - localStorage['resizeSidebarX'] = size; - sidebar.style.flexBasis = size; + if(resizer){ + const sidebar = document.querySelector("#bd-sidebar"); + resizer.addEventListener("mousedown", (event) => { + document.addEventListener("mousemove", resize, false); + document.addEventListener("mouseup", () => { + document.removeEventListener("mousemove", resize, false); + }, false); + }); + + function resize(e) { + const size = `${e.x}px`; + localStorage['resizeSidebarX'] = size; + sidebar.style.flexBasis = size; + } } } @@ -346,52 +348,60 @@ function addFooter() { const footerAnchor = $('.footer'); fetch('/footer.html').then((response) => response.text()).then((text) => { - console.log(text) const footerContent = $(text); footerAnchor.append(footerContent); }); } function initSplide() { - var splide = new Splide('.splide', { - type: 'fade', - autoHeight: true, - perPage: 1, - autoplay: true, - arrows: false, - waitForTransition: true, - wheel: true, - wheelSleep: 250, - interval: 3000, - }); - splide.mount(); + var splider = document.getElementsByClassName('.splide'); + if(splider.length != 0){ + var splide = new Splide('.splide', { + type: 'fade', + autoHeight: true, + perPage: 1, + autoplay: true, + arrows: false, + waitForTransition: true, + wheel: true, + wheelSleep: 250, + interval: 3000, + }); + splide.mount(); + } } // ---------- COVEO SEARCH ----------- -function selectResultViewType(type, gridButton, listButton) { - type === "grid" ? gridButton.click() : listButton.click(); -} function addViewTypeListeners() { const resultViewTypeFromLs = window.localStorage.getItem('atomicResultViewType'); let list = document.getElementById("atomic-result-list"); + var viewSelectorGrid = document.getElementById("view-selector-grid"); - viewSelectorGrid.addEventListener('click', function () { - list.display = "grid"; - window.localStorage.setItem('atomicResultViewType', "grid"); - viewSelectorGrid.classList.add('selected'); - viewSelectorList.classList.remove('selected'); - selectResultViewType("grid", viewSelectorGrid, viewSelectorList); - }); var viewSelectorList = document.getElementById("view-selector-list"); - viewSelectorList.addEventListener('click', function () { - list.display = "list"; - window.localStorage.setItem('atomicResultViewType', "list"); - viewSelectorList.classList.add('selected'); - viewSelectorGrid.classList.remove('selected'); - selectResultViewType("list", viewSelectorGrid, viewSelectorList); - }); - selectResultViewType(resultViewTypeFromLs || "grid", viewSelectorGrid, viewSelectorList); + + if(viewSelectorGrid){ + viewSelectorGrid.addEventListener('click', function () { + list.display = "grid"; + window.localStorage.setItem('atomicResultViewType', "grid"); + viewSelectorGrid.classList.add('selected'); + viewSelectorList.classList.remove('selected'); + viewSelectorGrid.click(); + }); + } + + if(viewSelectorList){ + viewSelectorList.addEventListener('click', function () { + list.display = "list"; + window.localStorage.setItem('atomicResultViewType', "list"); + viewSelectorList.classList.add('selected'); + viewSelectorGrid.classList.remove('selected'); + viewSelectorList.click(); + }); + } + if(viewSelectorList && viewSelectorGrid) { + viewSelectorGrid.classList.add('selected'); + } } document.addEventListener('DOMContentLoaded', function () { diff --git a/src/plugins/auto_batch/src/async_infer_request.cpp b/src/plugins/auto_batch/src/async_infer_request.cpp index a92e8c7f06ff43..d740d9d5861ed6 100644 --- a/src/plugins/auto_batch/src/async_infer_request.cpp +++ b/src/plugins/auto_batch/src/async_infer_request.cpp @@ -69,6 +69,7 @@ AsyncInferRequest::AsyncInferRequest(const std::shared_ptr& re // it is ok to call size() here as the queue only grows (and the bulk removal happens under the mutex) const int sz = static_cast(workerInferRequest->_tasks.size()); if (sz == workerInferRequest->_batch_size) { + workerInferRequest->_is_wakeup = true; workerInferRequest->_cond.notify_one(); } }; diff --git a/src/plugins/auto_batch/src/compiled_model.cpp b/src/plugins/auto_batch/src/compiled_model.cpp index 68de2481a3e019..b02759f53dc1d1 100644 --- a/src/plugins/auto_batch/src/compiled_model.cpp +++ b/src/plugins/auto_batch/src/compiled_model.cpp @@ -64,6 +64,7 @@ CompiledModel::GetWorkerInferRequest() const { workerRequestPtr->_infer_request_batched._so = m_compiled_model_with_batch._so; workerRequestPtr->_batch_size = m_device_info.device_batch_size; workerRequestPtr->_completion_tasks.resize(workerRequestPtr->_batch_size); + workerRequestPtr->_is_wakeup = false; workerRequestPtr->_infer_request_batched->set_callback( [workerRequestPtr](std::exception_ptr exceptionPtr) mutable { if (exceptionPtr) @@ -74,6 +75,7 @@ CompiledModel::GetWorkerInferRequest() const { workerRequestPtr->_completion_tasks[c](); } // reset the timeout + workerRequestPtr->_is_wakeup = true; workerRequestPtr->_cond.notify_one(); }); @@ -83,6 +85,9 @@ CompiledModel::GetWorkerInferRequest() const { { std::unique_lock lock(workerRequestPtr->_mutex); status = workerRequestPtr->_cond.wait_for(lock, std::chrono::milliseconds(m_time_out)); + if ((status != std::cv_status::timeout) && (workerRequestPtr->_is_wakeup == false)) + continue; + workerRequestPtr->_is_wakeup = false; } if (m_terminate) { break; diff --git a/src/plugins/auto_batch/src/compiled_model.hpp b/src/plugins/auto_batch/src/compiled_model.hpp index 200445f0140495..c4cf38d0e701ea 100644 --- a/src/plugins/auto_batch/src/compiled_model.hpp +++ b/src/plugins/auto_batch/src/compiled_model.hpp @@ -30,6 +30,7 @@ class CompiledModel : public ov::ICompiledModel { std::condition_variable _cond; std::mutex _mutex; std::exception_ptr _exception_ptr; + bool _is_wakeup; }; CompiledModel(const std::shared_ptr& model, diff --git a/src/plugins/intel_cpu/src/dnnl_extension_utils.cpp b/src/plugins/intel_cpu/src/dnnl_extension_utils.cpp index d60ede1decf6c1..3d9b2f69bd8f66 100644 --- a/src/plugins/intel_cpu/src/dnnl_extension_utils.cpp +++ b/src/plugins/intel_cpu/src/dnnl_extension_utils.cpp @@ -171,30 +171,14 @@ DnnlMemoryDescPtr DnnlExtensionUtils::makeDescriptor(const_dnnl_memory_desc_t de } } -static size_t sub_byte_data_type_multiplier(dnnl::memory::data_type dataType) { - switch (dataType) { - case dnnl::memory::data_type::nf4: - case dnnl::memory::data_type::s4: - case dnnl::memory::data_type::u4: - case dnnl::memory::data_type::f4_e2m1: - return 2; - default: - return 1; - } -} - size_t DnnlExtensionUtils::getMemSizeForDnnlDesc(const dnnl::memory::desc& desc) { - auto tmpDesc = desc; - - const auto offset0 = tmpDesc.get()->offset0; - tmpDesc.get()->offset0 = 0; + OPENVINO_ASSERT(IMPLICATION(desc.get_format_kind() == dnnl::memory::format_kind::blocked, desc.get()->offset0 == 0), + "Unexpected non zero offset for a dnnl blocked memory desc"); - size_t size = tmpDesc.get_size(); + size_t size = desc.get_size(); if (size == DNNL_RUNTIME_SIZE_VAL) return MemoryDesc::UNDEFINED_SIZE; - size += div_up(offset0 * sizeOfDataType(tmpDesc.get_data_type()), - sub_byte_data_type_multiplier(tmpDesc.get_data_type())); return size; } diff --git a/src/plugins/intel_cpu/src/graph.h b/src/plugins/intel_cpu/src/graph.h index 97c11dba6f77c1..b3634800fb2e05 100644 --- a/src/plugins/intel_cpu/src/graph.h +++ b/src/plugins/intel_cpu/src/graph.h @@ -21,7 +21,7 @@ #include #include "openvino/runtime/so_ptr.hpp" -#include "proxy_mem_mgr.h" +#include "proxy_mem_blk.h" namespace ov { namespace intel_cpu { diff --git a/src/plugins/intel_cpu/src/infer_request.cpp b/src/plugins/intel_cpu/src/infer_request.cpp index 85bc5c2fe38f45..f255a46efe7d0a 100644 --- a/src/plugins/intel_cpu/src/infer_request.cpp +++ b/src/plugins/intel_cpu/src/infer_request.cpp @@ -15,7 +15,7 @@ #include "openvino/core/shape.hpp" #include "openvino/runtime/make_tensor.hpp" #include "openvino/runtime/tensor.hpp" -#include "proxy_mem_mgr.h" +#include "proxy_mem_blk.h" #include "utils/general_utils.h" #include "utils/ngraph_utils.hpp" #include "openvino/runtime/threading/cpu_message.hpp" diff --git a/src/plugins/intel_cpu/src/node.cpp b/src/plugins/intel_cpu/src/node.cpp index 05c31da0623d45..34e48dea50cbfa 100644 --- a/src/plugins/intel_cpu/src/node.cpp +++ b/src/plugins/intel_cpu/src/node.cpp @@ -5,7 +5,7 @@ #include "node.h" #include "cpu_types.h" #include "edge.h" -#include "partitioned_mem_mgr.h" +#include "partitioned_mem_blk.h" #include #include @@ -281,7 +281,6 @@ void Node::selectPreferPrimitiveDescriptor(const std::vector& pr auto parentDesc = parent_spd->getConfig().outConfs[inNum].getMemDesc(); const bool isCompatible = curDesc->isCompatible(*parentDesc); - if (isCompatible) { equalsLocalFormatCount++; } @@ -316,6 +315,126 @@ void Node::selectPreferPrimitiveDescriptor(const std::vector& pr selectPrimitiveDescriptorByIndex(0); } +bool Node::isOneDimShape(const ov::PartialShape& pshape) { + int value_1_num = 0; + int sz = static_cast(pshape.size()); + for (auto s : pshape) { + if (s.is_static() && s.get_length() == 1) { + value_1_num++; + } + } + return value_1_num >= sz - 1; +} + +bool Node::isReorderRequired(ov::intel_cpu::MemoryDescPtr desc1, ov::intel_cpu::MemoryDescPtr desc2) { + bool samePrec = desc1->getPrecision() == desc2->getPrecision(); + bool isOneDimShape1 = isOneDimShape(desc1->getShape().toPartialShape()); + bool isOneDimShape2 = isOneDimShape(desc2->getShape().toPartialShape()); + return !(isOneDimShape1 && isOneDimShape2 && samePrec); +} + +void Node::selectPreferPrimitiveDescriptorWithShape(const std::vector& priority, bool ignoreConstInputs) { + // Filter out dynamic shape. + if (isDynamic) { + return selectPreferPrimitiveDescriptor(priority, ignoreConstInputs); + } + + auto estimateReorderOverhead = [&](const ov::intel_cpu::NodeDesc& supportedPrimitiveDesc, size_t i) { + int estimate = 0; + auto inputNodesNum = supportedPrimitiveDesc.getConfig().inConfs.size(); + for (size_t j = 0; j < inputNodesNum; j++) { + auto parentEdge = getParentEdgeAt(j); + auto parentPtr = parentEdge->getParent(); + + // We don't take into account constant edges since reorders on them will be executed on load network + // stage + if (ignoreConstInputs && j > 0 && parentPtr->isConstant()) { + continue; + } + + auto parent_spd = parentPtr->getSelectedPrimitiveDescriptor(); + if (parent_spd != nullptr && !parent_spd->getConfig().outConfs.empty()) { + int inNum = parentEdge->getInputNum(); + if (inNum < 0 || inNum >= static_cast(parent_spd->getConfig().outConfs.size())) { + inNum = 0; + } + auto curDesc = supportedPrimitiveDesc.getConfig().inConfs[j].getMemDesc(); + auto parentDesc = parent_spd->getConfig().outConfs[inNum].getMemDesc(); + + const bool isCompatible = curDesc->isCompatible(*parentDesc); + if (!isCompatible) { + if (!isReorderRequired(parentDesc, curDesc)) { + estimate += 1; + } else { + estimate += ov::shape_size(curDesc->getShape().getMinDims()); + } + } + + DEBUG_LOG(getName(), " pd[", i, "].inConfs[", j, "]" + " is ", (isCompatible ? "compatible" : "not compatible"), + " shape is ", (isOneDimShape(curDesc->getShape().toPartialShape()) ? "one dim shape" : "not one dim shape"), + " with parent ", parentPtr->getName(), + " outConfs[", inNum, "], estimate add to ", estimate); + } + } + return estimate; + }; + + auto selectSPDwithType = [&](const impl_desc_type type) { + int selectedPrimitive = -1; + int bestEstimate = std::numeric_limits::max(); + for (size_t i = 0; i < getSupportedPrimitiveDescriptors().size(); i++) { + const auto& supportedPrimitiveDesc = getSupportedPrimitiveDescriptors()[i]; + const impl_desc_type supportedType = supportedPrimitiveDesc.getImplementationType(); + if (supportedType != type) { + continue; + } + + const size_t descInConfSize = supportedPrimitiveDesc.getConfig().inConfs.size(); + + if (descInConfSize > getParentEdges().size()) { + OPENVINO_THROW(getName(), + " Desc ", + i, + " with type: ", + supportedType, + " has more input ports than node: ", + descInConfSize, + " vs ", + getParentEdges().size()); + continue; + } + + auto estimate = estimateReorderOverhead(supportedPrimitiveDesc, i); + + if (estimate < bestEstimate) { + bestEstimate = estimate; + selectedPrimitive = static_cast(i); + DEBUG_LOG(getName(), " Select primitive desc: ", i, " ", supportedPrimitiveDesc); + } + } + return selectedPrimitive; + }; + + // loop kernel priority + for (auto& type : priority) { + int selectedPrimitive = selectSPDwithType(type); + if (selectedPrimitive >= 0) { + selectPrimitiveDescriptorByIndex(selectedPrimitive); + return; + } + } + + OPENVINO_ASSERT(!getSupportedPrimitiveDescriptors().empty(), + "Supported primitive descriptors list is empty for node: ", + getName(), + " type: ", + NameFromType(getType())); + + // fallback. If there are no primitives from priority list just select a first + selectPrimitiveDescriptorByIndex(0); +} + bool Node::canBeInPlace() const { // TODO [DS]: enable inPlace for dynamic shapes if (isDynamicNode()) { diff --git a/src/plugins/intel_cpu/src/node.h b/src/plugins/intel_cpu/src/node.h index df44056b023b9f..948bd6999ce27a 100644 --- a/src/plugins/intel_cpu/src/node.h +++ b/src/plugins/intel_cpu/src/node.h @@ -715,6 +715,9 @@ class Node { friend class GraphOptimizer; void selectPreferPrimitiveDescriptor(const std::vector& priority, bool ignoreConstInputs); + void selectPreferPrimitiveDescriptorWithShape(const std::vector& priority, bool ignoreConstInputs); + bool isOneDimShape(const ov::PartialShape& pshape); + bool isReorderRequired(ov::intel_cpu::MemoryDescPtr desc1, ov::intel_cpu::MemoryDescPtr desc2); bool isConfigDefined(const NodeConfig &config) const; virtual bool canBeInPlace() const; diff --git a/src/plugins/intel_cpu/src/nodes/concat.cpp b/src/plugins/intel_cpu/src/nodes/concat.cpp index 6ca87ab31e6b37..576361de7e692b 100644 --- a/src/plugins/intel_cpu/src/nodes/concat.cpp +++ b/src/plugins/intel_cpu/src/nodes/concat.cpp @@ -19,7 +19,7 @@ #include "common/cpu_memcpy.h" #include "common/blocked_desc_creator.h" #include -#include +#include using namespace dnnl; namespace ov { @@ -559,8 +559,8 @@ void Concat::execNspcSpecCase() { nonZeroInShapes++; } - - const size_t iter_count = getParentEdgeAt(firstNonZeroEdge)->getMemory().getSize() / channelsDataSize[0]; + const Shape& shape = getSrcMemoryAtPort(firstNonZeroEdge)->getShape(); + const size_t iter_count = shape.getElementsCount() / shape.getStaticDims()[channelAxis]; parallel_for(iter_count, [&](int i) { const size_t dst_off = i * channels_size; diff --git a/src/plugins/intel_cpu/src/nodes/gather.cpp b/src/plugins/intel_cpu/src/nodes/gather.cpp index 94debfba1901ab..81f6f36b84dd89 100644 --- a/src/plugins/intel_cpu/src/nodes/gather.cpp +++ b/src/plugins/intel_cpu/src/nodes/gather.cpp @@ -4,7 +4,7 @@ #include "gather.h" -#include +#include #include #include diff --git a/src/plugins/intel_cpu/src/nodes/interpolate.cpp b/src/plugins/intel_cpu/src/nodes/interpolate.cpp index e61fccd3328639..19a19a36840947 100644 --- a/src/plugins/intel_cpu/src/nodes/interpolate.cpp +++ b/src/plugins/intel_cpu/src/nodes/interpolate.cpp @@ -2835,11 +2835,12 @@ void Interpolate::InterpolateJitExecutor::pillowCGathered(const uint8_t *in_ptr_ size_t threadsNum = parallel_get_num_threads(); size_t parallelNum = B; // IH * OW * C buf needed + size_t buffer_size = static_cast(OW * IH * C); if (parallelNum < threadsNum) { - arg.src_ptr[1] = static_cast(&pillow_working_buf[(b * OW * IH * C) * srcDataSize]); + arg.src_ptr[1] = static_cast(&pillow_working_buf[b * buffer_size * srcDataSize]); } else { size_t threadsIdx = parallel_get_thread_num(); - arg.src_ptr[1] = static_cast(&pillow_working_buf[(threadsIdx * OW * IH * C) * srcDataSize]); + arg.src_ptr[1] = static_cast(&pillow_working_buf[threadsIdx * buffer_size * srcDataSize]); } } arg.dst = out_ptr_ + (OW * OH * C * b) * dstDataSize; @@ -3719,8 +3720,9 @@ void Interpolate::InterpolateRefExecutor::pillowRef(const uint8_t *in_ptr_, uint ypass_in_ptr_nc = static_cast(&pillow_working_buf[(OW * IH * C * b + OW * IH * c) * srcDataSize]); } else { size_t threadsIdx = parallel_get_thread_num(); - xpass_out_ptr_nc = static_cast(&pillow_working_buf[(threadsIdx * OW * IH) * srcDataSize]); - ypass_in_ptr_nc = static_cast(&pillow_working_buf[(threadsIdx * OW * IH) * srcDataSize]); + size_t buffer_size = static_cast(OW * IH); + xpass_out_ptr_nc = static_cast(&pillow_working_buf[threadsIdx * buffer_size * srcDataSize]); + ypass_in_ptr_nc = static_cast(&pillow_working_buf[threadsIdx * buffer_size * srcDataSize]); } } else if (xPass && !yPass) { xpass_out_ptr_nc = out_ptr_nc; diff --git a/src/plugins/intel_cpu/src/nodes/memory.hpp b/src/plugins/intel_cpu/src/nodes/memory.hpp index 88b6a3d1250f0f..c5a83cfa5cad1a 100644 --- a/src/plugins/intel_cpu/src/nodes/memory.hpp +++ b/src/plugins/intel_cpu/src/nodes/memory.hpp @@ -7,7 +7,7 @@ #include "input.h" #include "memory_state_base.h" #include "ov_optional.hpp" -#include "proxy_mem_mgr.h" +#include "proxy_mem_blk.h" #include diff --git a/src/plugins/intel_cpu/src/nodes/mvn.cpp b/src/plugins/intel_cpu/src/nodes/mvn.cpp index cc6054a6e7717a..58d5252c0719a1 100644 --- a/src/plugins/intel_cpu/src/nodes/mvn.cpp +++ b/src/plugins/intel_cpu/src/nodes/mvn.cpp @@ -2562,7 +2562,7 @@ void MVN::MVNJitExecutor::mvn_blk(const uint8_t* src_data, uint8_t* dst_data, co // // | // // \|/ ///////////////////////////////// - auto mean_buffer_ptr = &mean_buffer[aux_buffer_size * parallel_get_thread_num()]; + auto mean_buffer_ptr = &mean_buffer[aux_buffer_size * static_cast(parallel_get_thread_num())]; for (size_t i = 0; i < blk_size; i++) mean_buffer_ptr[i] = 0.f; @@ -2589,7 +2589,7 @@ void MVN::MVNJitExecutor::mvn_blk(const uint8_t* src_data, uint8_t* dst_data, co size_t src_offset = b_offset + cb * C2 + d * C1 + h * C0; float variance_internal = 0.0f; - auto variance_buffer_ptr = &variance_buffer[aux_buffer_size * parallel_get_thread_num()]; + auto variance_buffer_ptr = &variance_buffer[aux_buffer_size * static_cast(parallel_get_thread_num())]; for (size_t i = 0; i < blk_size; i++) variance_buffer_ptr[i] = 0.f; diff --git a/src/plugins/intel_cpu/src/nodes/roi_align.cpp b/src/plugins/intel_cpu/src/nodes/roi_align.cpp index 1de72415e1cbc0..7857a8c569f18c 100644 --- a/src/plugins/intel_cpu/src/nodes/roi_align.cpp +++ b/src/plugins/intel_cpu/src/nodes/roi_align.cpp @@ -1088,7 +1088,7 @@ void ROIAlign::executeSpecified() { arg.num_samples = numSamplesROI; float numSamplesInBinInvert = 1.f / numSamplesROI; arg.scale = static_cast(&numSamplesInBinInvert); - float *threadBuf = static_cast(&workingBuf[parallel_get_thread_num() * bufSize]); + float *threadBuf = static_cast(&workingBuf[static_cast(parallel_get_thread_num()) * static_cast(bufSize)]); memset(threadBuf, 0, bufSize * sizeof(float)); arg.buffer = threadBuf; size_t dstOffset = n * batchOutputStride + yBinInd * pooledW * lastBlockDim + xBinInd * lastBlockDim; diff --git a/src/plugins/intel_cpu/src/nodes/split.cpp b/src/plugins/intel_cpu/src/nodes/split.cpp index 157dbfd84a7f6c..72af54e619dbf3 100644 --- a/src/plugins/intel_cpu/src/nodes/split.cpp +++ b/src/plugins/intel_cpu/src/nodes/split.cpp @@ -12,7 +12,7 @@ #include "utils/general_utils.h" #include #include "utils/ngraph_utils.hpp" -#include +#include #include "openvino/op/split.hpp" #include "openvino/op/variadic_split.hpp" diff --git a/src/plugins/intel_cpu/src/nodes/subgraph.cpp b/src/plugins/intel_cpu/src/nodes/subgraph.cpp index 8d04c41676b193..2b727839a003ff 100644 --- a/src/plugins/intel_cpu/src/nodes/subgraph.cpp +++ b/src/plugins/intel_cpu/src/nodes/subgraph.cpp @@ -508,7 +508,7 @@ void Subgraph::initSupportedPrimitiveDescriptors() { } void Subgraph::selectOptimalPrimitiveDescriptor() { - selectPreferPrimitiveDescriptor(getImplPriority(), true); + selectPreferPrimitiveDescriptorWithShape(getImplPriority(), true); } ov::element::Type Subgraph::getRuntimePrecision() const { diff --git a/src/plugins/intel_cpu/src/partitioned_mem_mgr.cpp b/src/plugins/intel_cpu/src/partitioned_mem_blk.cpp similarity index 96% rename from src/plugins/intel_cpu/src/partitioned_mem_mgr.cpp rename to src/plugins/intel_cpu/src/partitioned_mem_blk.cpp index bd4376c8a2812e..0d20e58ba87074 100644 --- a/src/plugins/intel_cpu/src/partitioned_mem_mgr.cpp +++ b/src/plugins/intel_cpu/src/partitioned_mem_blk.cpp @@ -2,7 +2,7 @@ // SPDX-License-Identifier: Apache-2.0 // -#include "partitioned_mem_mgr.h" +#include "partitioned_mem_blk.h" using namespace ov::intel_cpu; diff --git a/src/plugins/intel_cpu/src/partitioned_mem_mgr.h b/src/plugins/intel_cpu/src/partitioned_mem_blk.h similarity index 100% rename from src/plugins/intel_cpu/src/partitioned_mem_mgr.h rename to src/plugins/intel_cpu/src/partitioned_mem_blk.h diff --git a/src/plugins/intel_cpu/src/proxy_mem_mgr.cpp b/src/plugins/intel_cpu/src/proxy_mem_blk.cpp similarity index 98% rename from src/plugins/intel_cpu/src/proxy_mem_mgr.cpp rename to src/plugins/intel_cpu/src/proxy_mem_blk.cpp index 1ab2f639985e67..a10aaca9a9743b 100644 --- a/src/plugins/intel_cpu/src/proxy_mem_mgr.cpp +++ b/src/plugins/intel_cpu/src/proxy_mem_blk.cpp @@ -2,7 +2,7 @@ // SPDX-License-Identifier: Apache-2.0 // -#include "proxy_mem_mgr.h" +#include "proxy_mem_blk.h" #include "utils/debug_capabilities.h" using namespace ov::intel_cpu; diff --git a/src/plugins/intel_cpu/src/proxy_mem_mgr.h b/src/plugins/intel_cpu/src/proxy_mem_blk.h similarity index 100% rename from src/plugins/intel_cpu/src/proxy_mem_mgr.h rename to src/plugins/intel_cpu/src/proxy_mem_blk.h diff --git a/src/plugins/intel_cpu/src/sub_memory_manager.hpp b/src/plugins/intel_cpu/src/sub_memory_manager.hpp index 4a0fd7ea0a21b3..641584626e2873 100644 --- a/src/plugins/intel_cpu/src/sub_memory_manager.hpp +++ b/src/plugins/intel_cpu/src/sub_memory_manager.hpp @@ -16,17 +16,15 @@ namespace intel_cpu { class SubMemoryManager { public: struct MemoryInfo { - void* send_buf; - bool flag; - bool last_used; + void* send_buf = nullptr; + bool flag = false; + bool last_used = false; }; SubMemoryManager(int num_sub_streams) { assert(num_sub_streams); _num_sub_streams = num_sub_streams; MemoryInfo memory_info; - memory_info.flag = false; - memory_info.last_used = false; std::vector memorys; memorys.assign(_num_sub_streams, memory_info); _memorys_table.assign(2, memorys); diff --git a/src/plugins/intel_cpu/tests/functional/custom/subgraph_tests/src/subgraph_select_pd.cpp b/src/plugins/intel_cpu/tests/functional/custom/subgraph_tests/src/subgraph_select_pd.cpp new file mode 100644 index 00000000000000..2d44492c13c106 --- /dev/null +++ b/src/plugins/intel_cpu/tests/functional/custom/subgraph_tests/src/subgraph_select_pd.cpp @@ -0,0 +1,120 @@ +// Copyright (C) 2024 Intel Corporation +// SPDX-License-Identifier: Apache-2.0 +// + +#include "common_test_utils/node_builders/constant.hpp" +#include "openvino/opsets/opset8.hpp" +#include "shared_test_classes/base/ov_subgraph.hpp" +#include "utils/cpu_test_utils.hpp" + +namespace ov { +namespace test { + +/* + input1(f32_abcd_{1,64,32,32}) input2(f16_abcd_{1,128,1,1}) + | | + Reorder(f32_acdb_{1,64,32,32}) const Convert(f32_abcd_{1,128,1,1}) + | / | + | / | + Convolution(f32_acdb_{1,1,30,30}) Range_1520 VariadicSplit(f32_abcd_{1,64,1,1}, f32_abcd_{1,64,1,1}) + | / \ / + | / \ / + | / \ / + | / \ / + MVN(f32_acdb_{1,1,30,30}) Reorder1(f32_acdb_{1,64,1,1}) Reorder2(f32_acdb_{1,64,1,1}) + \ / / + \ / / + \ / / + \ / / + Subgraph(f32_acdb_{1,64,30,30}) + | + | + Convolution(f32_acdb_{1,1,28,28}) + | + Result + The Subgraph node have 3 inputs: they don't have same layout. + Expected: Reorder is inserted after VariadicSplit[0] and VariadicSplit[1], not inserted after MVN. + Because VariadicSplit's output layout is scalar shape([1,64,1,1]), its reorder has less computation. +*/ + +class SubgraphSelectPD : virtual public SubgraphBaseStaticTest { +protected: + void SetUp() override { + targetDevice = ov::test::utils::DEVICE_CPU; + abs_threshold = 2e-2; + + auto type = element::f32; + constexpr int const1 = 32; + auto input1 = std::make_shared(type, Shape{1, const1 / 2, 8, 8}); + input1->set_friendly_name("input1"); + auto input2 = std::make_shared(type, Shape{1, const1, 1, 1}); + input2->set_friendly_name("input2"); + + auto variadicSplit = std::make_shared( + input2, + ov::opset8::Constant::create(element::i64, Shape{1}, {1}), + ov::opset8::Constant::create(element::i64, Shape{2}, {const1 / 2, const1 / 2})); + variadicSplit->set_friendly_name("variadicSplit"); + + auto add1 = std::make_shared(variadicSplit->output(0), + ov::opset8::Constant::create(type, Shape{1}, {0})); + add1->set_friendly_name("add1"); + auto shapeof = std::make_shared(input1); + auto rankof = std::make_shared(shapeof); + auto squeeze = + std::make_shared(rankof, ov::opset8::Constant::create(element::i64, Shape{1}, {0})); + + auto range = std::make_shared(ov::opset8::Constant::create(element::i64, Shape{}, {2}), + squeeze, + ov::opset8::Constant::create(element::i64, Shape{}, {1}), + ov::element::i64); + auto create_conv = [&](const std::shared_ptr& input_node) { + ov::test::utils::InputGenerateData in_gen_data(0, 1); + auto conv = std::make_shared( + input_node, + ov::test::utils::make_constant(type, Shape{1, const1 / 2u, 3, 3}, ov::test::utils::InputGenerateData(0, 1)), + Strides{1, 1}, + CoordinateDiff{1, 1}, + CoordinateDiff{1, 1}, + Strides{1, 1}); + conv->get_rt_info() = + CPUTestUtils::CPUTestsBase::makeCPUInfo({CPUTestUtils::nhwc}, {CPUTestUtils::nhwc}, {}); + return conv; + }; + auto create_relu = [&](const std::shared_ptr& input_node) { + return std::make_shared(input_node, + ov::opset8::Constant::create(element::f32, Shape{1}, {1})); + }; + auto conv1 = create_conv(input1); + auto mvn = + std::make_shared(create_relu(conv1), range, false, 0.1, op::MVNEpsMode::INSIDE_SQRT); + auto mul = std::make_shared(create_relu(add1), mvn); + auto add2 = std::make_shared(variadicSplit->output(1), mul); + auto conv2 = create_conv(create_relu(add2)); + conv2->set_friendly_name("conv2"); + + function = std::make_shared(conv2, ParameterVector{input1, input2}); + } + + void TearDown() override { + auto runtime_function = compiledModel.get_runtime_model(); + int nodes_found = 0; + for (const auto& n : runtime_function->get_ordered_ops()) { + auto layer_type = n->get_rt_info().at(ov::exec_model_info::LAYER_TYPE).as(); + if (layer_type == "Subgraph") { + nodes_found++; + auto output_layout = n->get_rt_info().at(ov::exec_model_info::OUTPUT_LAYOUTS).as(); + // The optimal choose should be: 'nhwc'. + ASSERT_EQ(output_layout, "acdb"); + } + } + ASSERT_GT(nodes_found, 0); + } +}; + +TEST_F(SubgraphSelectPD, smoke_CompareWithRefs) { + run(); +} + +} // namespace test +} // namespace ov diff --git a/src/plugins/intel_gpu/include/intel_gpu/runtime/device.hpp b/src/plugins/intel_gpu/include/intel_gpu/runtime/device.hpp index 63f0311f675123..bf305e787e82c9 100644 --- a/src/plugins/intel_gpu/include/intel_gpu/runtime/device.hpp +++ b/src/plugins/intel_gpu/include/intel_gpu/runtime/device.hpp @@ -24,6 +24,7 @@ struct device { virtual bool is_same(const device::ptr other) = 0; float get_gops(cldnn::data_types dt) const; + bool use_unified_shared_memory() const; virtual ~device() = default; }; diff --git a/src/plugins/intel_gpu/include/intel_gpu/runtime/engine.hpp b/src/plugins/intel_gpu/include/intel_gpu/runtime/engine.hpp index 79e37d1890b78d..9638bf5fbf8379 100644 --- a/src/plugins/intel_gpu/include/intel_gpu/runtime/engine.hpp +++ b/src/plugins/intel_gpu/include/intel_gpu/runtime/engine.hpp @@ -6,6 +6,7 @@ #include "device.hpp" #include "event.hpp" +#include "kernel.hpp" #include "memory_caps.hpp" #include "memory_pool.hpp" #include "layout.hpp" @@ -149,6 +150,10 @@ class engine { virtual dnnl::engine& get_onednn_engine() const = 0; #endif + /// This method is intended to create kernel handle for current engine from handle from arbitrary engine + /// For instance, source kernel can be compiled using ocl engine, and then we can build L0 kernel object based on that + virtual kernel::ptr prepare_kernel(const kernel::ptr kernel) const = 0; + /// Factory method which creates engine object with impl configured by @p engine_type /// @param engine_type requested engine type /// @param runtime_type requested execution runtime for the engine. @note some runtime/engine types configurations might be unsupported diff --git a/src/plugins/intel_gpu/include/intel_gpu/runtime/stream.hpp b/src/plugins/intel_gpu/include/intel_gpu/runtime/stream.hpp index f2cd18f069e16d..d990f356333d70 100644 --- a/src/plugins/intel_gpu/include/intel_gpu/runtime/stream.hpp +++ b/src/plugins/intel_gpu/include/intel_gpu/runtime/stream.hpp @@ -18,10 +18,36 @@ namespace cldnn { +// Possible sync methods for kernels in stream +enum class SyncMethods { + /* Build dependency graph using events. Each kernel creates proper ze_event which is set as dependency of users + At this moment it requires multiple retain/release calls for ze_event after each enqueueNDRange + which is less performant comparing to the barriers version + */ + events = 0, + /* Enqueue barriers between dependent kernels. For example consider the following dimond dependency graph: + kernel_0 + / \ + kernel_1 kernel_2 + \ / + kernel_3 + In that case we do the following: + 1. Enqueue kernel_0 + 2. Enqueue barrier (ensures kernel_0 is completed) + 3. Enqueue kernel_1 + 4. Enqueue kernel_2 (doesn't depend on kernel_1) + 5. Enqueue barrier (ensures kernel_1 and kernel_2 are completed) + 6. Enqueue kernel_3 + */ + barriers = 1, + /* No explicit syncronization is needed. Applicable for in-order queue only */ + none = 2 +}; + class stream { public: using ptr = std::shared_ptr; - explicit stream(QueueTypes queue_type) : queue_type(queue_type) {} + explicit stream(QueueTypes queue_type, SyncMethods sync_method) : m_queue_type(queue_type), m_sync_method(sync_method) {} virtual ~stream() = default; virtual void flush() const = 0; @@ -42,16 +68,18 @@ class stream { virtual event::ptr create_base_event() = 0; virtual event::ptr aggregate_events(const std::vector& events, bool group = false, bool is_output = false); - QueueTypes get_queue_type() const { return queue_type; } + QueueTypes get_queue_type() const { return m_queue_type; } static QueueTypes detect_queue_type(engine_types engine_type, void* queue_handle); + static SyncMethods get_expected_sync_method(const ExecutionConfig& config); #ifdef ENABLE_ONEDNN_FOR_GPU virtual dnnl::stream& get_onednn_stream() = 0; #endif protected: - QueueTypes queue_type; + QueueTypes m_queue_type; + SyncMethods m_sync_method; }; } // namespace cldnn 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 9f2895a008cfa8..b0c6758af7d909 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 @@ -478,6 +478,17 @@ bool crop_in_place_optimization::match(const program_node& node, // TODO: Need to allow optimization for gemm user if (node.is_dynamic() && (user->is_type() || user->is_type())) return false; + // For static shape, gemm ref kernel is selected if there is padding on the feature, x, or y axes. + // In such cases, do not optimize out this crop to use the opt kernel. + // TODO: Modify gemm_tiled_opt kernel to support padding even in static shape. + if ((!node.is_dynamic() || is_runtime) && user->is_type() && + (user->get_dependency_index(node) == 0 || user->get_dependency_index(node) == 1)) { + if (crop_params.input_offsets[0].feature[0] != 0 || + crop_params.input_offsets[0].spatial[0] != 0 || + crop_params.input_offsets[0].spatial[1] != 0) { + return false; + } + } if (user->is_type()) { // runtime buffer fusing is only handled when there is only one reshape user if (node.is_dynamic() && node.get_users().size() != 1) 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 8e7cdd0337874c..b42ab89eafd61a 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 @@ -534,11 +534,11 @@ void prepare_primitive_fusing::fuse_simple_primitives(program &p) { return does_support_fusings; }; - auto mvn_supports_fusings = [](mvn_node& node, bool for_eltwise = false) -> bool { + auto mvn_supports_fusings = [](mvn_node& node) -> bool { auto in_layout = node.get_input_layout(0); if (node.get_primitive()->requires_alignment(in_layout.get_partial_shape())) return false; - return data_type_traits::is_i8_u8(in_layout.data_type) || for_eltwise; + return true; }; auto dts_supports_fusings = [](depth_to_space_node& node) -> bool { @@ -896,7 +896,7 @@ void prepare_primitive_fusing::fuse_simple_primitives(program &p) { can_fuse_parents[i] = (parents[i].first->is_type() && conv_supports_fusings(parents[i].first->as())) || (parents[i].first->is_type() && - mvn_supports_fusings(parents[i].first->as(), true)) || + mvn_supports_fusings(parents[i].first->as())) || (parents[i].first->is_type()) || (parents[i].first->is_type()) || (parents[i].first->is_type()) || diff --git a/src/plugins/intel_gpu/src/graph/impls/ocl/kernel_selector_helper.cpp b/src/plugins/intel_gpu/src/graph/impls/ocl/kernel_selector_helper.cpp index 762118ec5b1af2..fbf885ff3dd816 100644 --- a/src/plugins/intel_gpu/src/graph/impls/ocl/kernel_selector_helper.cpp +++ b/src/plugins/intel_gpu/src/graph/impls/ocl/kernel_selector_helper.cpp @@ -43,7 +43,7 @@ #include "kernel_selector/kernels/quantize/quantize_kernel_params.h" #include "kernel_selector/kernels/reorder/reorder_kernel_base.h" -#include "runtime/kernels_cache.hpp" +#include "impls/ocl/kernels_cache.hpp" #include #include diff --git a/src/plugins/intel_gpu/src/runtime/kernels_cache.cpp b/src/plugins/intel_gpu/src/graph/impls/ocl/kernels_cache.cpp similarity index 90% rename from src/plugins/intel_gpu/src/runtime/kernels_cache.cpp rename to src/plugins/intel_gpu/src/graph/impls/ocl/kernels_cache.cpp index d6dcaf5dd72d14..5db452dcda26f0 100644 --- a/src/plugins/intel_gpu/src/runtime/kernels_cache.cpp +++ b/src/plugins/intel_gpu/src/graph/impls/ocl/kernels_cache.cpp @@ -2,19 +2,23 @@ // SPDX-License-Identifier: Apache-2.0 // -#include "kernels_factory.hpp" #include "kernels_cache.hpp" -#include "ocl/ocl_kernel.hpp" -#include "ocl/ocl_engine.hpp" -#include "ocl/ocl_common.hpp" + +#include "openvino/util/pp.hpp" #include "intel_gpu/graph/serialization/set_serializer.hpp" #include "intel_gpu/graph/serialization/vector_serializer.hpp" #include "intel_gpu/graph/serialization/map_serializer.hpp" #include "intel_gpu/graph/serialization/string_serializer.hpp" +#include "intel_gpu/graph/program.hpp" + +#include "intel_gpu/runtime/utils.hpp" #include "intel_gpu/runtime/debug_configuration.hpp" #include "intel_gpu/runtime/itt.hpp" #include "intel_gpu/runtime/file_util.hpp" -#include "openvino/util/pp.hpp" + +#include "ocl/ocl_kernel.hpp" +#include "ocl/ocl_common.hpp" +#include "ocl/ocl_device.hpp" #ifdef WIN32 #include @@ -23,7 +27,6 @@ #endif #endif -#include #include #include #include @@ -47,6 +50,26 @@ namespace { std::mutex cacheAccessMutex; +static const cldnn::device::ptr get_target_device(const cldnn::engine& engine) { + using namespace cldnn; + if (engine.runtime_type() == runtime_types::ocl) { + return engine.get_device(); + } else { + ocl::ocl_device_detector detector; + auto device_map = detector.get_available_devices(nullptr, nullptr); + auto original_device = engine.get_device(); + + for (auto& d : device_map) { + const auto& target_uuid = d.second->get_info().uuid; + const auto& original_uuid = original_device->get_info().uuid; + if (target_uuid.uuid == original_uuid.uuid) + return d.second; + } + } + + OPENVINO_THROW("[GPU] Couldn't find target device for kernels cache"); +} + #ifdef ENABLE_ONEDNN_FOR_GPU cl::Program fuse_microkernels(const cl::Context& context, const cl::Device& device, cl::Program& program, const std::string& code) { using namespace dnnl::impl::gpu::intel; @@ -212,8 +235,8 @@ void kernels_cache::get_program_source(const kernels_code& kernels_source_code, auto options = c.first; auto& batches = std::get<1>(c.second); for (auto& b : batches) { - std::string full_code = options + " " + _engine.get_device_info().driver_version; - full_code += _engine.get_device_info().dev_name; + std::string full_code = options + " " + _device->get_info().driver_version; + full_code += _device->get_info().dev_name; for (auto& ss : b.source) full_code += ss; @@ -248,7 +271,7 @@ kernels_cache::kernels_cache(engine& engine, uint32_t prog_id, std::shared_ptr task_executor, const std::map& batch_headers) - : _engine(engine) + : _device(get_target_device(engine)) , _task_executor(task_executor) , _config(config) , _prog_id(prog_id) @@ -271,10 +294,10 @@ static std::vector getProgramBinaries(cl::Program program) { } // TODO: This build_batch method should be backend specific -void kernels_cache::build_batch(const engine& build_engine, const batch_program& batch, compiled_kernels& compiled_kernels) { +void kernels_cache::build_batch(const batch_program& batch, compiled_kernels& compiled_kernels) { OV_ITT_SCOPED_TASK(ov::intel_gpu::itt::domains::intel_gpu_plugin, "KernelsCache::build_batch"); - auto& cl_build_engine = dynamic_cast(build_engine); + auto& cl_build_device = dynamic_cast(*_device); bool dump_sources = batch.dump_custom_program; std::string dump_sources_dir = ""; @@ -325,10 +348,10 @@ void kernels_cache::build_batch(const engine& build_engine, const batch_program& // Run compilation if (precompiled_kernels.empty()) { - cl::Program program(cl_build_engine.get_cl_context(), batch.source); + cl::Program program(cl_build_device.get_context(), batch.source); { OV_ITT_SCOPED_TASK(ov::intel_gpu::itt::domains::intel_gpu_plugin, "KernelsCache::BuildProgram::RunCompilation"); - if (program.build({cl_build_engine.get_cl_device()}, batch.options.c_str()) != CL_SUCCESS) + if (program.build({cl_build_device.get_device()}, batch.options.c_str()) != CL_SUCCESS) throw std::runtime_error("Failed in building program."); } @@ -344,7 +367,7 @@ void kernels_cache::build_batch(const engine& build_engine, const batch_program& #ifdef ENABLE_ONEDNN_FOR_GPU OPENVINO_ASSERT(batch.kernels_counter == 1); // Do we need full source code here (with batch headers)? - program = fuse_microkernels(cl_build_engine.get_cl_context(), cl_build_engine.get_cl_device(), program, batch.source.back()); + program = fuse_microkernels(cl_build_device.get_context(), cl_build_device.get_device(), program, batch.source.back()); #else // ENABLE_ONEDNN_FOR_GPU OPENVINO_THROW("[GPU] Can't compile kernel w/ microkernels as onednn is not available"); #endif // ENABLE_ONEDNN_FOR_GPU @@ -362,8 +385,8 @@ void kernels_cache::build_batch(const engine& build_engine, const batch_program& ov::intel_gpu::save_binary(cached_bin_name, getProgramBinaries(program)); } } else { - cl::Program program(cl_build_engine.get_cl_context(), {cl_build_engine.get_cl_device()}, precompiled_kernels); - if (program.build({cl_build_engine.get_cl_device()}, batch.options.c_str()) != CL_SUCCESS) + cl::Program program(cl_build_device.get_context(), {cl_build_device.get_device()}, precompiled_kernels); + if (program.build({cl_build_device.get_device()}, batch.options.c_str()) != CL_SUCCESS) throw std::runtime_error("Failed in building program with a precompiled kernel."); program.createKernels(&kernels); @@ -375,9 +398,8 @@ void kernels_cache::build_batch(const engine& build_engine, const batch_program& const auto& entry_point = k.getInfo(); const auto& iter = batch.entry_point_to_id.find(entry_point); if (iter != batch.entry_point_to_id.end()) { - cl_kernel kern = k.get(); - cl_context context = cl_build_engine.get_cl_context().get(); - kernel::ptr kernel = kernels_factory::create(_engine, context, kern, entry_point); + kernel::ptr kernel = std::make_shared(ocl::ocl_kernel_type(k, cl_build_device.get_usm_helper()), entry_point); + auto& params = iter->second.first; auto kernel_part_idx = iter->second.second; if (compiled_kernels.find(params) != compiled_kernels.end()) { @@ -437,7 +459,7 @@ kernel::ptr kernels_cache::get_kernel_from_cached_kernels(std::string id) const return res->second->clone(_reuse_kernels); } -std::vector kernels_cache::get_kernels(kernel_impl_params params) const { +std::vector kernels_cache::get_kernels(const kernel_impl_params& params) const { OPENVINO_ASSERT((_pending_compilation == false), "Kernel cache is not compiled, call build_all() first!"); std::string current_node_id; @@ -448,11 +470,13 @@ std::vector kernels_cache::get_kernels(kernel_impl_params params) c OPENVINO_ASSERT(_kernels.end() != res, "Kernel for {" + current_node_id + "} is not found in the kernel cache!"); OPENVINO_ASSERT(res->second.size() != 0, "Number of kernels should not be zero for " + current_node_id); + auto& engine = params.get_program().get_engine(); + std::vector kernels(res->second.size()); for (auto& k : res->second) { auto& kernel_ptr = k.first; auto kernel_part_idx = k.second; - kernels[kernel_part_idx] = kernel_ptr->clone(_reuse_kernels); + kernels[kernel_part_idx] = engine.prepare_kernel(kernel_ptr->clone(_reuse_kernels)); } return kernels; } @@ -461,7 +485,7 @@ bool kernels_cache::validate_simple_kernel_execution(kernel::ptr krl) { auto casted = downcast(krl.get()); auto kernel = casted->get_handle(); try { - auto casted_dev = dynamic_cast(_engine.get_device().get()); + auto casted_dev = dynamic_cast(_device.get()); auto device = casted_dev->get_device(); cl::Context ctx(device); @@ -496,7 +520,6 @@ void kernels_cache::build_all() { if (!_pending_compilation) return; - ocl::ocl_engine& _build_engine = downcast(_engine); std::vector batches; { std::lock_guard lock(_mutex); @@ -518,9 +541,9 @@ void kernels_cache::build_all() { std::vector tasks; for (size_t idx = 0; idx < batches.size(); idx++) { auto& batch = batches[idx]; - tasks.push_back([this, &_build_engine, &batch, &exception] { + tasks.push_back([this, &batch, &exception] { try { - build_batch(_build_engine, batch, _kernels); + build_batch(batch, _kernels); } catch (...) { exception = std::current_exception(); } @@ -534,7 +557,7 @@ void kernels_cache::build_all() { } } else { for (size_t idx = 0; idx < batches.size(); idx++) { - build_batch(_build_engine, batches[idx], _kernels); + build_batch(batches[idx], _kernels); } } @@ -620,8 +643,6 @@ void kernels_cache::add_to_cached_kernels(const std::vector& kernel } void kernels_cache::save(BinaryOutputBuffer& ob) const { - OPENVINO_ASSERT(_engine.type() == engine_types::ocl || _engine.type() == engine_types::sycl, "[GPU] Not supported engine type"); - ob << _cached_binaries.size(); for (auto& cached_binary : _cached_binaries) { ob << cached_binary.second; @@ -630,8 +651,6 @@ void kernels_cache::save(BinaryOutputBuffer& ob) const { } void kernels_cache::load(BinaryInputBuffer& ib) { - OPENVINO_ASSERT(_engine.type() == engine_types::ocl || _engine.type() == engine_types::sycl, "[GPU] Not supported engine type"); - std::unordered_map> precompiled_kernels; size_t num_cached_binaries; @@ -642,8 +661,7 @@ void kernels_cache::load(BinaryInputBuffer& ib) { ib >> precompiled_kernels[id]; } - std::unique_ptr build_engine = - cldnn::make_unique(_engine.get_device(), runtime_types::ocl); + const auto& build_device = downcast(*_device); try { std::lock_guard lock(_mutex); @@ -651,8 +669,8 @@ void kernels_cache::load(BinaryInputBuffer& ib) { for (auto& precompiled_kernel : precompiled_kernels) { cl::vector kernels; - cl::Program program(build_engine->get_cl_context(), {build_engine->get_cl_device()}, {precompiled_kernel.second}); - program.build({build_engine->get_cl_device()}); + cl::Program program(build_device.get_context(), {build_device.get_device()}, {precompiled_kernel.second}); + program.build({build_device.get_device()}); program.createKernels(&kernels); for (auto& k : kernels) { @@ -660,10 +678,7 @@ void kernels_cache::load(BinaryInputBuffer& ib) { std::string cached_kernel_id = entry_point + "@" + std::to_string(precompiled_kernel.first); const auto& iter = _cached_kernels.find(cached_kernel_id); if (iter == _cached_kernels.end()) { - cl_kernel cl_kernel = k.get(); - cl_context cl_context = build_engine->get_cl_context().get(); - kernel::ptr kernel = kernels_factory::create(_engine, cl_context, cl_kernel, entry_point); - _cached_kernels[cached_kernel_id] = kernel; + _cached_kernels[cached_kernel_id] = std::make_shared(ocl::ocl_kernel_type(k, build_device.get_usm_helper()), entry_point); } } } @@ -690,8 +705,6 @@ kernels_cache::compiled_kernels kernels_cache::compile(const kernel_impl_params& t_kernels_code.insert({params, {kernel_sources, params, dump_custom_program}}); } - ocl::ocl_engine& _build_engine = downcast(_engine); - // Create batches std::vector batches; get_program_source(t_kernels_code, &batches); @@ -699,7 +712,7 @@ kernels_cache::compiled_kernels kernels_cache::compile(const kernel_impl_params& compiled_kernels output_kernels; // Build batches for (size_t idx = 0; idx < batches.size(); ++idx) { - build_batch(_build_engine, batches[idx], output_kernels); + build_batch(batches[idx], output_kernels); } OPENVINO_ASSERT(output_kernels.size() == 1, "Only the kernels of the single primitive should be compiled."); diff --git a/src/plugins/intel_gpu/src/runtime/kernels_cache.hpp b/src/plugins/intel_gpu/src/graph/impls/ocl/kernels_cache.hpp similarity index 93% rename from src/plugins/intel_gpu/src/runtime/kernels_cache.hpp rename to src/plugins/intel_gpu/src/graph/impls/ocl/kernels_cache.hpp index f505dcbb94da2b..b08b087c55854a 100644 --- a/src/plugins/intel_gpu/src/runtime/kernels_cache.hpp +++ b/src/plugins/intel_gpu/src/graph/impls/ocl/kernels_cache.hpp @@ -5,7 +5,7 @@ #pragma once #include "intel_gpu/graph/serialization/binary_buffer.hpp" -#include "intel_gpu/runtime/engine.hpp" +#include "intel_gpu/runtime/device.hpp" #include "intel_gpu/runtime/kernel.hpp" #include "intel_gpu/runtime/execution_config.hpp" #include "intel_gpu/graph/kernel_impl_params.hpp" @@ -16,11 +16,9 @@ #include #include #include -#include -#include "openvino/runtime/threading/cpu_streams_executor.hpp" -#include "kernels_factory.hpp" -#include "ocl/ocl_engine.hpp" +#include "openvino/runtime/threading/itask_executor.hpp" + namespace cldnn { @@ -89,7 +87,7 @@ class kernels_cache { private: static std::mutex _mutex; - engine& _engine; + const device::ptr _device; std::shared_ptr _task_executor; ExecutionConfig _config; uint32_t _prog_id = 0; @@ -101,7 +99,7 @@ class kernels_cache { std::map batch_headers; std::unordered_map _kernel_batch_hash; void get_program_source(const kernels_code& kernels_source_code, std::vector*) const; - void build_batch(const engine& build_engine, const batch_program& batch, compiled_kernels& compiled_kernels); + void build_batch(const batch_program& batch, compiled_kernels& compiled_kernels); std::string get_cache_path() const; bool is_cache_enabled() const; @@ -116,7 +114,7 @@ class kernels_cache { std::shared_ptr task_executor = nullptr, const std::map& batch_headers = {}); kernel::ptr get_kernel_from_cached_kernels(std::string id) const; - std::vector get_kernels(kernel_impl_params params) const; + std::vector get_kernels(const kernel_impl_params& params) const; void set_kernels_reuse(bool reuse_kernels) { _reuse_kernels = reuse_kernels; } bool get_kernels_reuse() const { return _reuse_kernels; } diff --git a/src/plugins/intel_gpu/src/graph/impls/onednn/utils.cpp b/src/plugins/intel_gpu/src/graph/impls/onednn/utils.cpp index 4776417b3146fc..b8ff112cead147 100644 --- a/src/plugins/intel_gpu/src/graph/impls/onednn/utils.cpp +++ b/src/plugins/intel_gpu/src/graph/impls/onednn/utils.cpp @@ -447,6 +447,7 @@ dnnl::algorithm convert_activation_func(cldnn::activation_func func) { case cldnn::activation_func::relu: return dnnl::algorithm::eltwise_relu; case cldnn::activation_func::relu_negative_slope: return dnnl::algorithm::eltwise_relu; case cldnn::activation_func::gelu: return dnnl::algorithm::eltwise_gelu_erf; + case cldnn::activation_func::gelu_tanh: return dnnl::algorithm::eltwise_gelu_tanh; case cldnn::activation_func::elu: return dnnl::algorithm::eltwise_elu; case cldnn::activation_func::mish: return dnnl::algorithm::eltwise_mish; case cldnn::activation_func::swish: return dnnl::algorithm::eltwise_swish; diff --git a/src/plugins/intel_gpu/src/graph/include/primitive_inst.h b/src/plugins/intel_gpu/src/graph/include/primitive_inst.h index df418e0c920903..33571db8496642 100644 --- a/src/plugins/intel_gpu/src/graph/include/primitive_inst.h +++ b/src/plugins/intel_gpu/src/graph/include/primitive_inst.h @@ -21,7 +21,7 @@ #include "intel_gpu/graph/serialization/layout_serializer.hpp" #include "intel_gpu/graph/serialization/vector_serializer.hpp" #include "intel_gpu/runtime/itt.hpp" -#include "runtime/kernels_cache.hpp" +#include "impls/ocl/kernels_cache.hpp" // TODO: add generic interface for weights_reorder_params and get rid of this dependency #include "impls/ocl/kernel_selector_helper.h" diff --git a/src/plugins/intel_gpu/src/graph/network.cpp b/src/plugins/intel_gpu/src/graph/network.cpp index e457ff95433644..59f3647f987c3c 100644 --- a/src/plugins/intel_gpu/src/graph/network.cpp +++ b/src/plugins/intel_gpu/src/graph/network.cpp @@ -38,12 +38,8 @@ #include "kv_cache_inst.h" #include "program_helpers.h" #include "to_string_utils.h" -#include "kernels_cache.hpp" #include "program_dump_graph.h" -// TODO: Remove once we have an abstraction for kernels_cache -#include "kernel_base.h" - #include #include #include diff --git a/src/plugins/intel_gpu/src/graph/primitive_inst.cpp b/src/plugins/intel_gpu/src/graph/primitive_inst.cpp index 8f05de556433f0..b0f7c4db565728 100644 --- a/src/plugins/intel_gpu/src/graph/primitive_inst.cpp +++ b/src/plugins/intel_gpu/src/graph/primitive_inst.cpp @@ -49,7 +49,6 @@ #include "json_object.h" #include -#include #include #include #include diff --git a/src/plugins/intel_gpu/src/graph/program.cpp b/src/plugins/intel_gpu/src/graph/program.cpp index f673e4c81c8d13..03cc8df8b4338c 100644 --- a/src/plugins/intel_gpu/src/graph/program.cpp +++ b/src/plugins/intel_gpu/src/graph/program.cpp @@ -71,7 +71,7 @@ #include "to_string_utils.h" // TODO: Remove once we have interface for kernels cache -#include "runtime/kernels_cache.hpp" +#include "impls/ocl/kernels_cache.hpp" // TODO: implement self-registration for impls #include "impls/ocl/register.hpp" diff --git a/src/plugins/intel_gpu/src/runtime/device.cpp b/src/plugins/intel_gpu/src/runtime/device.cpp index 01f6f586234501..fa027ebe9e2e33 100644 --- a/src/plugins/intel_gpu/src/runtime/device.cpp +++ b/src/plugins/intel_gpu/src/runtime/device.cpp @@ -3,6 +3,7 @@ // #include "intel_gpu/runtime/device.hpp" +#include "intel_gpu/runtime/debug_configuration.hpp" namespace cldnn { @@ -63,4 +64,15 @@ float device::get_gops(cldnn::data_types dt) const { return freqGHz * opsPerComputeBlock * computeBlockIPC * numEUs; } +bool device::use_unified_shared_memory() const { + GPU_DEBUG_GET_INSTANCE(debug_config); + GPU_DEBUG_IF(debug_config->disable_usm) { + return false; + } + if (get_mem_caps().supports_usm()) { + return true; + } + return false; +} + } // namespace cldnn diff --git a/src/plugins/intel_gpu/src/runtime/kernels_factory.cpp b/src/plugins/intel_gpu/src/runtime/kernels_factory.cpp deleted file mode 100644 index 448afa863609f3..00000000000000 --- a/src/plugins/intel_gpu/src/runtime/kernels_factory.cpp +++ /dev/null @@ -1,21 +0,0 @@ -// Copyright (C) 2018-2024 Intel Corporation -// SPDX-License-Identifier: Apache-2.0 -// - -#include "kernels_factory.hpp" -#include "ocl/ocl_kernels_factory.hpp" - -namespace cldnn { -namespace kernels_factory { - -std::shared_ptr create(engine& engine, cl_context context, cl_kernel kernel, std::string entry_point) { - switch (engine.type()) { - case engine_types::sycl: - case engine_types::ocl: - return ocl::create_ocl_kernel(engine, context, kernel, entry_point); - default: throw std::runtime_error("Unsupported engine type in kernels_factory::create"); - } -} - -} // namespace kernels_factory -} // namespace cldnn diff --git a/src/plugins/intel_gpu/src/runtime/kernels_factory.hpp b/src/plugins/intel_gpu/src/runtime/kernels_factory.hpp deleted file mode 100644 index 0ba1cf6a568e90..00000000000000 --- a/src/plugins/intel_gpu/src/runtime/kernels_factory.hpp +++ /dev/null @@ -1,22 +0,0 @@ -// Copyright (C) 2018-2024 Intel Corporation -// SPDX-License-Identifier: Apache-2.0 -// - -#pragma once - -#include "intel_gpu/runtime/kernel.hpp" -#include "intel_gpu/runtime/engine.hpp" -#include "ocl/ocl_common.hpp" - -#include - -namespace cldnn { - -namespace kernels_factory { - -// Creates instance of kernel for selected engine type. -// For ocl engine it creates a copy of kernel object -std::shared_ptr create(engine& engine, cl_context context, cl_kernel kernel, kernel_id kernel_id); - -} // namespace kernels_factory -} // namespace cldnn diff --git a/src/plugins/intel_gpu/src/runtime/ocl/ocl_device.cpp b/src/plugins/intel_gpu/src/runtime/ocl/ocl_device.cpp index 74d9b033c64ca2..be8b48b157b421 100644 --- a/src/plugins/intel_gpu/src/runtime/ocl/ocl_device.cpp +++ b/src/plugins/intel_gpu/src/runtime/ocl/ocl_device.cpp @@ -369,7 +369,9 @@ ocl_device::ocl_device(const cl::Device dev, const cl::Context& ctx, const cl::P , _device(dev) , _platform(platform) , _info(init_device_info(dev, ctx)) -, _mem_caps(init_memory_caps(dev, _info)) { } +, _mem_caps(init_memory_caps(dev, _info)) +, _usm_helper(new cl::UsmHelper(_context, _device, use_unified_shared_memory())) { +} bool ocl_device::is_same(const device::ptr other) { auto casted = downcast(other.get()); diff --git a/src/plugins/intel_gpu/src/runtime/ocl/ocl_device.hpp b/src/plugins/intel_gpu/src/runtime/ocl/ocl_device.hpp index 24102b91a192b2..ac6081fc480943 100644 --- a/src/plugins/intel_gpu/src/runtime/ocl/ocl_device.hpp +++ b/src/plugins/intel_gpu/src/runtime/ocl/ocl_device.hpp @@ -21,6 +21,7 @@ struct ocl_device : public device { cl::Device& get_device() { return _device; } const cl::Context& get_context() const { return _context; } const cl::Platform& get_platform() const { return _platform; } + const cl::UsmHelper& get_usm_helper() const { return *_usm_helper; } bool is_same(const device::ptr other) override; @@ -32,6 +33,7 @@ struct ocl_device : public device { cl::Platform _platform; device_info _info; memory_capabilities _mem_caps; + std::unique_ptr _usm_helper; }; } // namespace ocl diff --git a/src/plugins/intel_gpu/src/runtime/ocl/ocl_engine.cpp b/src/plugins/intel_gpu/src/runtime/ocl/ocl_engine.cpp index 4de85d27c06668..df1cad281d636c 100644 --- a/src/plugins/intel_gpu/src/runtime/ocl/ocl_engine.cpp +++ b/src/plugins/intel_gpu/src/runtime/ocl/ocl_engine.cpp @@ -3,6 +3,8 @@ // #include "ocl_engine.hpp" +#include "intel_gpu/runtime/utils.hpp" +#include "ocl/ocl_kernel.hpp" #include "ocl_common.hpp" #include "ocl_memory.hpp" #include "ocl_stream.hpp" @@ -51,7 +53,6 @@ ocl_engine::ocl_engine(const device::ptr dev, runtime_types runtime_type) OPENVINO_ASSERT(casted, "[GPU] Invalid device type passed to ocl engine"); casted->get_device().getInfo(CL_DEVICE_EXTENSIONS, &_extensions); - _usm_helper.reset(new cl::UsmHelper(get_cl_context(), get_cl_device(), use_unified_shared_memory())); _service_stream.reset(new ocl_stream(*this, ExecutionConfig())); } @@ -117,7 +118,9 @@ const cl::Device& ocl_engine::get_cl_device() const { } const cl::UsmHelper& ocl_engine::get_usm_helper() const { - return *_usm_helper; + auto cl_device = std::dynamic_pointer_cast(_device); + OPENVINO_ASSERT(cl_device, "[GPU] Invalid device type for ocl_engine"); + return cl_device->get_usm_helper(); } allocation_type ocl_engine::detect_usm_allocation_type(const void* memory) const { @@ -299,6 +302,11 @@ void* ocl_engine::get_user_context() const { return static_cast(cl_device.get_context().get()); } +kernel::ptr ocl_engine::prepare_kernel(const kernel::ptr kernel) const { + OPENVINO_ASSERT(downcast(kernel.get()) != nullptr); + return kernel; +} + bool ocl_engine::extension_supported(std::string extension) const { return _extensions.find(extension) != std::string::npos; } diff --git a/src/plugins/intel_gpu/src/runtime/ocl/ocl_engine.hpp b/src/plugins/intel_gpu/src/runtime/ocl/ocl_engine.hpp index ee76fcca82a2d2..2f6541bf0e7e00 100644 --- a/src/plugins/intel_gpu/src/runtime/ocl/ocl_engine.hpp +++ b/src/plugins/intel_gpu/src/runtime/ocl/ocl_engine.hpp @@ -45,6 +45,8 @@ class ocl_engine : public engine { stream_ptr create_stream(const ExecutionConfig& config, void *handle) const override; stream& get_service_stream() const override; + kernel::ptr prepare_kernel(const kernel::ptr kernel) const override; + #ifdef ENABLE_ONEDNN_FOR_GPU void create_onednn_engine(const ExecutionConfig& config) override; // Returns onednn engine object which shares device and context with current engine @@ -56,7 +58,6 @@ class ocl_engine : public engine { private: std::string _extensions; std::unique_ptr _service_stream; - std::unique_ptr _usm_helper; #ifdef ENABLE_ONEDNN_FOR_GPU std::mutex onednn_mutex; diff --git a/src/plugins/intel_gpu/src/runtime/ocl/ocl_kernels_factory.cpp b/src/plugins/intel_gpu/src/runtime/ocl/ocl_kernels_factory.cpp deleted file mode 100644 index 926070075ca594..00000000000000 --- a/src/plugins/intel_gpu/src/runtime/ocl/ocl_kernels_factory.cpp +++ /dev/null @@ -1,23 +0,0 @@ -// Copyright (C) 2018-2024 Intel Corporation -// SPDX-License-Identifier: Apache-2.0 -// - -#include "ocl_kernel.hpp" -#include "ocl_engine.hpp" -#include "ocl_kernels_factory.hpp" - -#include -#include - -namespace cldnn { -namespace ocl { - -std::shared_ptr create_ocl_kernel(engine& engine, cl_context /* context */, cl_kernel kernel, std::string entry_point) { - // Retain kernel to keep it valid - cl::Kernel k(kernel, true); - ocl_engine& cl_engine = dynamic_cast(engine); - return std::make_shared(ocl::ocl_kernel_type(k, cl_engine.get_usm_helper()), entry_point); -} - -} // namespace ocl -} // namespace cldnn diff --git a/src/plugins/intel_gpu/src/runtime/ocl/ocl_kernels_factory.hpp b/src/plugins/intel_gpu/src/runtime/ocl/ocl_kernels_factory.hpp deleted file mode 100644 index 474381b3a3ae54..00000000000000 --- a/src/plugins/intel_gpu/src/runtime/ocl/ocl_kernels_factory.hpp +++ /dev/null @@ -1,16 +0,0 @@ -// Copyright (C) 2018-2024 Intel Corporation -// SPDX-License-Identifier: Apache-2.0 -// - -#include "kernels_factory.hpp" - -#include -#include - -namespace cldnn { -namespace ocl { - -std::shared_ptr create_ocl_kernel(engine& engine, cl_context /* context */, cl_kernel kernel, std::string entry_point); - -} // namespace ocl -} // namespace cldnn diff --git a/src/plugins/intel_gpu/src/runtime/ocl/ocl_stream.cpp b/src/plugins/intel_gpu/src/runtime/ocl/ocl_stream.cpp index be734208c7a877..dba2bf4132ace6 100644 --- a/src/plugins/intel_gpu/src/runtime/ocl/ocl_stream.cpp +++ b/src/plugins/intel_gpu/src/runtime/ocl/ocl_stream.cpp @@ -1,22 +1,17 @@ -// Copyright (C) 2019-2022 Intel Corporation +// Copyright (C) 2019-2024 Intel Corporation // SPDX-License-Identifier: Apache-2.0 // #include "ocl_stream.hpp" +#include "intel_gpu/runtime/stream.hpp" #include "ocl_event.hpp" #include "ocl_user_event.hpp" #include "ocl_command_queues_builder.hpp" -#include "intel_gpu/plugin/common_utils.hpp" #include "intel_gpu/runtime/debug_configuration.hpp" #include "ocl_kernel.hpp" #include "ocl_common.hpp" #include -#include -#include - -#include -#include #include #include #include @@ -190,28 +185,19 @@ void set_arguments_impl(ocl_kernel_type& kernel, } } -sync_methods get_expected_sync_method(const ExecutionConfig& config) { - auto profiling = config.get_property(ov::enable_profiling); - auto queue_type = config.get_property(ov::intel_gpu::queue_type); - return profiling ? sync_methods::events : queue_type == QueueTypes::out_of_order ? sync_methods::barriers - : sync_methods::none; -} - } // namespace ocl_stream::ocl_stream(const ocl_engine &engine, const ExecutionConfig& config) - : stream(config.get_property(ov::intel_gpu::queue_type)) - , _engine(engine) - , sync_method(get_expected_sync_method(config)) { + : stream(config.get_property(ov::intel_gpu::queue_type), stream::get_expected_sync_method(config)) + , _engine(engine) { auto context = engine.get_cl_context(); auto device = engine.get_cl_device(); ocl::command_queues_builder queue_builder; queue_builder.set_profiling(config.get_property(ov::enable_profiling)); - queue_builder.set_out_of_order(queue_type == QueueTypes::out_of_order); + queue_builder.set_out_of_order(m_queue_type == QueueTypes::out_of_order); - if (sync_method == sync_methods::none && queue_type == QueueTypes::out_of_order) { - throw std::runtime_error("[CLDNN] Unexpected sync method (none) is specified for out_of_order queue"); - } + OPENVINO_ASSERT(m_sync_method != SyncMethods::none || m_queue_type == QueueTypes::in_order, + "[GPU] Unexpected sync method (none) is specified for out_of_order queue"); bool priorty_extensions = engine.extension_supported("cl_khr_priority_hints") && engine.extension_supported("cl_khr_create_command_queue"); queue_builder.set_priority_mode(config.get_property(ov::intel_gpu::hint::queue_priority), priorty_extensions); @@ -226,16 +212,15 @@ ocl_stream::ocl_stream(const ocl_engine &engine, const ExecutionConfig& config) } ocl_stream::ocl_stream(const ocl_engine &engine, const ExecutionConfig& config, void *handle) - : stream(ocl_stream::detect_queue_type(handle)) - , _engine(engine) - , sync_method(get_expected_sync_method(config)) { + : stream(ocl_stream::detect_queue_type(handle), stream::get_expected_sync_method(config)) + , _engine(engine) { auto casted_handle = static_cast(handle); _command_queue = ocl_queue_type(casted_handle, true); } #ifdef ENABLE_ONEDNN_FOR_GPU dnnl::stream& ocl_stream::get_onednn_stream() { - OPENVINO_ASSERT(queue_type == QueueTypes::in_order, "[GPU] Can't create onednn stream handle as onednn doesn't support out-of-order queue"); + OPENVINO_ASSERT(m_queue_type == QueueTypes::in_order, "[GPU] Can't create onednn stream handle as onednn doesn't support out-of-order queue"); OPENVINO_ASSERT(_engine.get_device_info().vendor_id == INTEL_VENDOR_ID, "[GPU] Can't create onednn stream handle as for non-Intel devices"); if (!_onednn_stream) { _onednn_stream = std::make_shared(dnnl::ocl_interop::make_stream(_engine.get_onednn_engine(), _command_queue.get())); @@ -284,7 +269,7 @@ event::ptr ocl_stream::enqueue_kernel(kernel& kernel, auto local = toNDRange(args_desc.workGroups.local); std::vector dep_events; std::vector* dep_events_ptr = nullptr; - if (sync_method == sync_methods::events) { + if (m_sync_method == SyncMethods::events) { for (auto& dep : deps) { if (auto ocl_base_ev = std::dynamic_pointer_cast(dep)) { if (ocl_base_ev->get().get() != nullptr) @@ -292,13 +277,13 @@ event::ptr ocl_stream::enqueue_kernel(kernel& kernel, } } dep_events_ptr = &dep_events; - } else if (sync_method == sync_methods::barriers) { + } else if (m_sync_method == SyncMethods::barriers) { sync_events(deps, is_output); } cl::Event ret_ev; - bool set_output_event = sync_method == sync_methods::events || is_output; + bool set_output_event = m_sync_method == SyncMethods::events || is_output; try { _command_queue.enqueueNDRangeKernel(kern, cl::NullRange, global, local, dep_events_ptr, set_output_event ? &ret_ev : nullptr); @@ -330,7 +315,7 @@ event::ptr ocl_stream::enqueue_marker(std::vector const& deps, bool return std::make_shared(ret_ev); } - if (sync_method == sync_methods::events) { + if (m_sync_method == SyncMethods::events) { cl::Event ret_ev; std::vector dep_events; for (auto& dep : deps) { @@ -349,7 +334,7 @@ event::ptr ocl_stream::enqueue_marker(std::vector const& deps, bool } return std::make_shared(ret_ev, ++_queue_counter); - } else if (sync_method == sync_methods::barriers) { + } else if (m_sync_method == SyncMethods::barriers) { sync_events(deps, is_output); return std::make_shared(_last_barrier_ev, _last_barrier); } else { diff --git a/src/plugins/intel_gpu/src/runtime/ocl/ocl_stream.hpp b/src/plugins/intel_gpu/src/runtime/ocl/ocl_stream.hpp index c02a1517486d53..b9c51ccb046508 100644 --- a/src/plugins/intel_gpu/src/runtime/ocl/ocl_stream.hpp +++ b/src/plugins/intel_gpu/src/runtime/ocl/ocl_stream.hpp @@ -10,55 +10,24 @@ #include "ocl_engine.hpp" #include -#include -#include -#include -#include -#include #include namespace cldnn { namespace ocl { -// Possible sync methods for kernels in stream -enum class sync_methods { - /* Build dependency graph using events. Each kernel creates proper cl_event which is set as dependency of users - At this moment it requires multiple retain/release calls for cl_event after each enqueueNDRange - which is less performant comparing to the barriers version - */ - events = 0, - /* Enqueue barriers between dependent kernels. For example consider the following dimond dependency graph: - kernel_0 - / \ - kernel_1 kernel_2 - \ / - kernel_3 - In that case we do the following: - 1. Enqueue kernel_0 - 2. Enqueue barrier (ensures kernel_0 is completed) - 3. Enqueue kernel_1 - 4. Enqueue kernel_2 (doesn't depend on kernel_1) - 5. Enqueue barrier (ensures kernel_1 and kernel_2 are completed) - 6. Enqueue kernel_3 - */ - barriers = 1, - /* No explicit syncronization is needed. Applicable for in-order queue only */ - none = 2 -}; class ocl_stream : public stream { public: const ocl_queue_type& get_cl_queue() const { return _command_queue; } - explicit ocl_stream(const ocl_engine& engine, const ExecutionConfig& config); + ocl_stream(const ocl_engine& engine, const ExecutionConfig& config); ocl_stream(const ocl_engine &engine, const ExecutionConfig& config, void *handle); ocl_stream(ocl_stream&& other) - : stream(other.queue_type) + : stream(other.m_queue_type, other.m_sync_method) , _engine(other._engine) , _command_queue(other._command_queue) , _queue_counter(other._queue_counter.load()) , _last_barrier(other._last_barrier.load()) - , _last_barrier_ev(other._last_barrier_ev) - , sync_method(other.sync_method) {} + , _last_barrier_ev(other._last_barrier_ev) {} ~ocl_stream() = default; @@ -96,8 +65,6 @@ class ocl_stream : public stream { std::atomic _last_barrier{0}; cl::Event _last_barrier_ev; - sync_methods sync_method; - #ifdef ENABLE_ONEDNN_FOR_GPU std::shared_ptr _onednn_stream = nullptr; #endif diff --git a/src/plugins/intel_gpu/src/runtime/stream.cpp b/src/plugins/intel_gpu/src/runtime/stream.cpp index 169f320e40d100..5f898596f46d62 100644 --- a/src/plugins/intel_gpu/src/runtime/stream.cpp +++ b/src/plugins/intel_gpu/src/runtime/stream.cpp @@ -19,6 +19,13 @@ QueueTypes stream::detect_queue_type(engine_types engine_type, void* queue_handl } } +SyncMethods stream::get_expected_sync_method(const ExecutionConfig& config) { + auto profiling = config.get_property(ov::enable_profiling); + auto queue_type = config.get_property(ov::intel_gpu::queue_type); + return profiling ? SyncMethods::events : queue_type == QueueTypes::out_of_order ? SyncMethods::barriers + : SyncMethods::none; +} + event::ptr stream::aggregate_events(const std::vector& events, bool group, bool is_output) { if (events.size() == 1 && !is_output) return events[0]; diff --git a/src/plugins/intel_gpu/tests/unit/fusions/mvn_fusion_test.cpp b/src/plugins/intel_gpu/tests/unit/fusions/mvn_fusion_test.cpp index cda17515190f42..24aa5d31e1d76e 100644 --- a/src/plugins/intel_gpu/tests/unit/fusions/mvn_fusion_test.cpp +++ b/src/plugins/intel_gpu/tests/unit/fusions/mvn_fusion_test.cpp @@ -158,15 +158,14 @@ TEST_P(mvn_scale_quantize_i8, basic) { } INSTANTIATE_TEST_SUITE_P(fusings_gpu, mvn_scale_quantize_i8, ::testing::ValuesIn(std::vector{ - // Full fusing for fp input not supported yet, it may lead to output padding and non-optimal kernel - // mvn_test_params{ CASE_MVN_F32_1, 2, 4 }, - // mvn_test_params{ CASE_MVN_F32_2, 2, 4 }, - // mvn_test_params{ CASE_MVN_3D_F32_1, 2, 4 }, - // mvn_test_params{ CASE_MVN_3D_F32_2, 2, 4 }, - // mvn_test_params{ CASE_MVN_F16_1, 2, 4 }, - // mvn_test_params{ CASE_MVN_F16_2, 2, 4 }, - // mvn_test_params{ CASE_MVN_3D_F16_1, 2, 4 }, - // mvn_test_params{ CASE_MVN_3D_F16_2, 2, 4 }, + mvn_test_params{ CASE_MVN_F32_1, 2, 2, 4 }, + mvn_test_params{ CASE_MVN_F32_2, 2, 2, 4 }, + mvn_test_params{ CASE_MVN_3D_F32_1, 2, 2, 4 }, + mvn_test_params{ CASE_MVN_3D_F32_2, 2, 2, 4 }, + mvn_test_params{ CASE_MVN_F16_1, 2, 2, 4 }, + mvn_test_params{ CASE_MVN_F16_2, 2, 2, 4 }, + mvn_test_params{ CASE_MVN_3D_F16_1, 2, 2, 4 }, + mvn_test_params{ CASE_MVN_3D_F16_2, 2, 2, 4 }, mvn_test_params{ CASE_MVN_I8_1, 2, 2, 4 }, mvn_test_params{ CASE_MVN_I8_2, 2, 2, 4 }, mvn_test_params{ CASE_MVN_I8_3, 2, 2, 4 }, @@ -207,15 +206,14 @@ TEST_P(mvn_scale_activation_eltwise_fp32_quantize_i8, basic) { } INSTANTIATE_TEST_SUITE_P(fusings_gpu, mvn_scale_activation_eltwise_fp32_quantize_i8, ::testing::ValuesIn(std::vector{ - // Full using for fp input not supported yet, it may lead to output padding and non-optimal kernel - // mvn_test_params{ CASE_MVN_F32_1, 2, 7 }, - // mvn_test_params{ CASE_MVN_F32_2, 2, 7 }, - // mvn_test_params{ CASE_MVN_3D_F32_1, 2, 7 }, - // mvn_test_params{ CASE_MVN_3D_F32_2, 2, 7 }, - // mvn_test_params{ CASE_MVN_F16_1, 2, 7 }, - // mvn_test_params{ CASE_MVN_F16_2, 2, 7 }, - // mvn_test_params{ CASE_MVN_3D_F16_1, 2, 7 }, - // mvn_test_params{ CASE_MVN_3D_F16_2, 2, 7 }, + mvn_test_params{ CASE_MVN_F32_1, 2, 4, 6 }, + mvn_test_params{ CASE_MVN_F32_2, 2, 4, 6 }, + mvn_test_params{ CASE_MVN_3D_F32_1, 2, 4, 6 }, + mvn_test_params{ CASE_MVN_3D_F32_2, 2, 4, 6 }, + mvn_test_params{ CASE_MVN_F16_1, 2, 4, 6 }, + mvn_test_params{ CASE_MVN_F16_2, 2, 4, 6 }, + mvn_test_params{ CASE_MVN_3D_F16_1, 2, 4, 6 }, + mvn_test_params{ CASE_MVN_3D_F16_2, 2, 4, 6 }, mvn_test_params{ CASE_MVN_I8_1, 2, 4, 6 }, mvn_test_params{ CASE_MVN_I8_2, 2, 4, 6 }, mvn_test_params{ CASE_MVN_I8_3, 2, 4, 6 }, diff --git a/src/plugins/intel_gpu/tests/unit/passes/kernels_cache_test.cpp b/src/plugins/intel_gpu/tests/unit/passes/kernels_cache_test.cpp index 6ebe5d3dced041..30225132c35488 100644 --- a/src/plugins/intel_gpu/tests/unit/passes/kernels_cache_test.cpp +++ b/src/plugins/intel_gpu/tests/unit/passes/kernels_cache_test.cpp @@ -120,6 +120,8 @@ TEST(kernels_cache, sub_kernel_ordering_test) { kernel_code_list.push_back(kernel_string); } kernel_impl_params dummy_params; + auto dummy_prog = std::make_shared(engine, config); + dummy_params.prog = dummy_prog.get(); _kernels_cache->add_kernels_source(dummy_params, kernel_code_list, false); _kernels_cache->build_all(); auto _out_kernels = _kernels_cache->get_kernels(dummy_params); diff --git a/src/plugins/intel_gpu/tests/unit/passes/prepare_buffer_fusing_test.cpp b/src/plugins/intel_gpu/tests/unit/passes/prepare_buffer_fusing_test.cpp index c9ab451265f417..5adc1e691b82a7 100644 --- a/src/plugins/intel_gpu/tests/unit/passes/prepare_buffer_fusing_test.cpp +++ b/src/plugins/intel_gpu/tests/unit/passes/prepare_buffer_fusing_test.cpp @@ -1464,3 +1464,33 @@ TEST(prepare_buffer_fusing, in_place_onednn_concat_static) { } } #endif // ENABLE_ONEDNN_FOR_GPU + +TEST(prepare_buffer_fusing, inner_axis_data_offset_with_gemm_user) { + tests::random_generator rg(GET_SUITE_NAME); + + auto& engine = get_test_engine(); + + auto in_layout = layout{ ov::PartialShape{1, 6, 16, 16}, data_types::f16, format::bfyx }; + auto crop_layout = layout{ ov::PartialShape{1, 6, 8, 16}, data_types::f16, format::bfyx }; + + auto input_memory = engine.allocate_memory(in_layout); + auto input_data = rg.generate_random_1d(input_memory->count(), -1, 1); + + auto offsets1 = tensor{0, 0, 0, 0}; + auto offsets2 = tensor{0, 0, 8, 0}; + + topology topology; + topology.add(input_layout("input", in_layout)); + topology.add(crop("crop1", input_info("input"), crop_layout.get_tensor(), offsets1)); + topology.add(permute("permute", input_info("crop1"), {0, 1, 3, 2})); + topology.add(crop("crop2", input_info("input"), crop_layout.get_tensor(), offsets2)); + topology.add(gemm("gemm", {input_info("permute"), input_info("crop2")}, data_types::f16, false, false)); + + ExecutionConfig config = get_test_default_config(engine); + config.set_property(ov::intel_gpu::optimize_data(true)); + auto prog = program::build_program(engine, topology, config, false, false); + ASSERT_NE(prog, nullptr); + + auto& crop_node = prog->get_node("crop2").as(); + ASSERT_FALSE(crop_node.can_be_optimized()); +} diff --git a/src/plugins/intel_npu/README.md b/src/plugins/intel_npu/README.md index 5fc880314da1a2..b7508c68704e32 100644 --- a/src/plugins/intel_npu/README.md +++ b/src/plugins/intel_npu/README.md @@ -11,7 +11,6 @@ OpenVINO™ toolkit is officially supported and validated on the following platf | Host | NPU device | OS (64-bit) | | :--- | :--- | :--- | -| Raptor Lake (discrete NPU) | NPU 3700 | MS Windows* 11 | | Meteor Lake (integrated NPU) | NPU 3720 | Ubuntu* 22, MS Windows* 11 | | Lunar Lake (integrated NPU) | NPU 4000 | Ubuntu* 22, MS Windows* 11 | @@ -75,7 +74,7 @@ NPU plugin will use the Level Zero (L0) API to execute the precompiled model on ### Device management -There is currently no support for multiple devices (N x discrete + integrated), one single level zero device will be enumerated during level zero backend initialization. Support for multiple devices will be added in future releases. +There is currently no support for multiple devices, which means only one level-zero device will be enumerated during level-zero backend initialization. Support for multiple devices will be added in future releases. ### Inference pipeline @@ -161,17 +160,17 @@ The following properties are supported: | `ov::log::level`/
`LOG_LEVEL` | RW | Sets the log level for NPU Plugin. An environment variable is also made available to expose logs from early initialization phase: OV_NPU_LOG_LEVEL. | `LOG_NONE`/
`LOG_ERROR`/
`LOG_WARNING`/
`LOG_INFO`/
`LOG_DEBUG`/
`LOG_TRACE` | `LOG_NONE` | | `ov::cache_dir`/
`CACHE_DIR` | RW | Folder path to be used by the OpenVINO cache. | `N/A` | empty | | `ov::available_devices`/
`AVAILABLE_DEVICES` | RO | Returns the list of enumerated NPU devices.
NPU plugin does not currently support multiple devices. | `N/A`| `N/A` | -| `ov::device::id`/
`DEVICE_ID` | RW | Device identifier. Empty means auto detection. | empty/
`3700`/
`3720`/
`4000` | empty | +| `ov::device::id`/
`DEVICE_ID` | RW | Device identifier. Empty means auto detection. | empty/
`3720`/
`4000` | empty | | `ov::device::uuid`/
| RO | Returns the Universal Unique ID of the NPU device. | `N/A`| `N/A` | | `ov::device::architecture`/
`DEVICE_ARCHITECTURE` | RO | Returns the platform information. | `N/A`| `N/A` | | `ov::device::full_name`/
`FULL_DEVICE_NAME` | RO | Returns the full name of the NPU device. | `N/A`| `N/A` | | `ov::internal::exclusive_async_requests`/
`EXCLUSIVE_ASYNC_REQUESTS` | RW | Allows to use exclusive task executor for asynchronous infer requests. | `YES`/ `NO`| `NO` | -| `ov::device::type`/
`DEVICE_TYPE` | RO | Returns the type of device, discrete or integrated. | `DISCREETE` /
`INTEGRATED` | `N/A` | +| `ov::device::type`/
`DEVICE_TYPE` | RO | Returns the type of device, discrete or integrated. | `DISCRETE` /
`INTEGRATED` | `N/A` | | `ov::device::gops`/
`DEVICE_GOPS` | RO | Returns the Giga OPS per second count (GFLOPS or GIOPS) for a set of precisions supported by specified device. | `N/A`| `N/A` | | `ov::device::pci_info`/
`DEVICE_PCI_INFO` | RO | Returns the PCI bus information of device. See PCIInfo struct definition for details | `N/A`| `N/A` | -| `ov::intel_npu::device_alloc_mem_size`/
`NPU_DEVICE_ALLOC_MEM_SIZE` | RO | Size of already allocated NPU DDR memory (both for discrete/integrated NPU devices) | `N/A` | `N/A` | -| `ov::intel_npu::device_total_mem_size`/
`NPU_DEVICE_TOTAL_MEM_SIZE` | RO | Size of available NPU DDR memory (both for discrete/integrated NPU devices) | `N/A` | `N/A` | -| `ov::intel_npu::driver_version`/
`NPU_DRIVER_VERSION` | RO | NPU driver version (for both discrete/integrated NPU devices). | `N/A` | `N/A` | +| `ov::intel_npu::device_alloc_mem_size`/
`NPU_DEVICE_ALLOC_MEM_SIZE` | RO | Size of already allocated NPU DDR memory | `N/A` | `N/A` | +| `ov::intel_npu::device_total_mem_size`/
`NPU_DEVICE_TOTAL_MEM_SIZE` | RO | Size of available NPU DDR memory | `N/A` | `N/A` | +| `ov::intel_npu::driver_version`/
`NPU_DRIVER_VERSION` | RO | NPU driver version. | `N/A` | `N/A` | | `ov::intel_npu::compilation_mode_params`/
`NPU_COMPILATION_MODE_PARAMS` | RW | Set various parameters supported by the NPU compiler. (See bellow) | ``| `N/A` | | `ov::intel_npu::turbo`/
`NPU_TURBO` | RW | Set Turbo mode on/off | `YES`/ `NO`| `NO` | | `ov::intel_npu::tiles`/
`NPU_TILES` | RW | Sets the number of npu tiles to compile the model for | `[0-]` | `-1` | @@ -185,10 +184,8 @@ The following table shows the default values for the number of DPU Groups (Tiles | Performance hint | NPU Platform | Number of DPU Groups | Number of DMA Engines | | :--- | :--- | :--- | :--- | -| THROUGHPUT | 3700 | 1 | 1 | | THROUGHPUT | 3720 | 2 (all of them) | 2 (all of them) | | THROUGHPUT | 4000 | 2 (out of 5/6) | 2 (all of them) | -| LATENCY | 3700 | 4 (all of them) | 1 | | LATENCY | 3720 | 2 (all of them) | 2 (all of them) | | LATENCY | 4000 | 4 (out of 5/6) | 2 (all of them) | @@ -199,7 +196,6 @@ The following table shows the optimal number of inference requests returned by t | NPU Platform | Nr. of Inference Requests
THROUGHPUT | Nr. of Inference Requests
LATENCY | | :--- | :--- | :--- | -| 3700 | 8 | 1 | | 3720 | 4 | 1 | | 4000 | 8 | 1 | diff --git a/src/plugins/intel_npu/src/plugin/npuw/partitioning/partitioning.cpp b/src/plugins/intel_npu/src/plugin/npuw/partitioning/partitioning.cpp index 130da23b3c35c5..cf82694e0601b7 100644 --- a/src/plugins/intel_npu/src/plugin/npuw/partitioning/partitioning.cpp +++ b/src/plugins/intel_npu/src/plugin/npuw/partitioning/partitioning.cpp @@ -1630,6 +1630,8 @@ void Partitioner::optimize(const std::string& func_name) { rewr.add_matcher(); rewr.add_matcher(std::ref(ctx)); rewr.add_matcher(std::ref(ctx)); + rewr.add_matcher(std::ref(ctx)); + rewr.add_matcher(std::ref(ctx)); rewr.run_on_model(f._model); ov::pass::Validate().run_on_model(f._model); diff --git a/src/plugins/intel_npu/src/plugin/npuw/partitioning/patterns/opt.cpp b/src/plugins/intel_npu/src/plugin/npuw/partitioning/patterns/opt.cpp index 7d44ae04835e1d..7fab6298bc989f 100644 --- a/src/plugins/intel_npu/src/plugin/npuw/partitioning/patterns/opt.cpp +++ b/src/plugins/intel_npu/src/plugin/npuw/partitioning/patterns/opt.cpp @@ -144,6 +144,8 @@ DQMatMulCWi::DQMatMulCWi() { register_matcher(std::make_shared(qmm, "OptDQMatMulCWi"), std::move(callback)); } +// 1 token case (generate) +// // FROM: // ???(Act) --------------------------------------------> // Param(W) -> Convert(f16|f32) -> Multiply -> Reshape -> MatMul @@ -193,23 +195,21 @@ DQMatMulGQi::DQMatMulGQi(Context::Ref ctx) { auto act_shape = matched_out_mmi.get_shape(); auto out_shape = matched_node_matmul->output(0).get_shape(); - if (ov::element::i4 == matched_qweight->get_element_type() && + if (ov::element::i4 == matched_qweight->get_element_type() && qweight_shape.size() == 3 && ov::element::f32 == matched_qcoeff->get_element_type() && qcoeff_shape.size() == 3 && - qweight_shape.size() == 3 && act_shape.size() == 3 && qcoeff_shape[0] == qweight_shape[0] && - qcoeff_shape[1] == 1 && qcoeff_shape[2] == qweight_shape[2] && !matched_matmul->get_transpose_a() && - !matched_matmul->get_transpose_b()) { + act_shape.size() == 3 && act_shape[1] == 1 && // single-token case + qcoeff_shape[0] == qweight_shape[0] && qcoeff_shape[1] == 1 && qcoeff_shape[2] == qweight_shape[2] && + !matched_matmul->get_transpose_a() && !matched_matmul->get_transpose_b()) { // Mark W closure to transpose, and transpose the respective parameter - ctx.get().permute(matched_qweight, {0, 2, 1}); - - // Mark S closure to be lowered fo f16 - ctx.get().to_f16(matched_qcoeff); - ov::Shape tw_shape = {qweight_shape[0], qweight_shape[2], qweight_shape[1]}; matched_qweight->set_partial_shape(tw_shape); matched_qweight->validate_and_infer_types(); + ctx.get().permute(matched_qweight, {0, 2, 1}); + // Mark S closure to be lowered fo f16 matched_qcoeff->set_element_type(ov::element::f16); matched_qcoeff->validate_and_infer_types(); + ctx.get().to_f16(matched_qcoeff); // Reshape the Act to group format const auto NSPLIT = qweight_shape[0]; @@ -314,7 +314,7 @@ DQMatMulGQ2i::DQMatMulGQ2i(Context::Ref ctx) { if (ov::element::i4 == matched_qweight->get_element_type() && qweight_shape.size() == 3 && ov::element::f16 == matched_qcoeff->get_element_type() && qcoeff_shape.size() == 3 && - act_shape.size() == 3 && qcoeff_shape[0] == qweight_shape[0] && qcoeff_shape[2] == 1 && + act_shape.size() == 3 && act_shape[1] == 1 && qcoeff_shape[0] == qweight_shape[0] && qcoeff_shape[2] == 1 && qcoeff_shape[1] == qweight_shape[1] && !matched_matmul->get_transpose_a() && matched_matmul->get_transpose_b()) { // Mark W closure to transpose, and transpose the respective parameter @@ -383,6 +383,237 @@ DQMatMulGQ2i::DQMatMulGQ2i(Context::Ref ctx) { register_matcher(std::make_shared(qmm, "OptDQMatMulGQ2i"), std::move(callback)); } +// N token case (prompt) +// +// FROM: +// ???(Act) --------------------------------------------> +// Param(W) -> Convert(f16|f32) -> Multiply -> Reshape -> MatMul +// Param(S) ---------------------> +// +// WHERE (example): +// Act: [ 1, N, 4096] +// W: [32,128,11008] +// S: [32, 1,11008] +// [1, N ,128] x +// TO: [1,11K,128]T = +// [N,32,128] [1,N,128] [1, N ,11K] [32,N,11K] +// ???(Act) -> Reshape > Split(/32) ->[to(f16) -> Reshape -> ]} +// Param(W*) -----------> Split(/32) ->[to(f16) ------------> MatMul v ]} 32xAdd +// Param(S) -------------Split(/32) ->[--------------------> Multiply ]} v +// to(f32) +// WHERE: +// W* : [32,11008,128] +DQMatMulGQiP::DQMatMulGQiP(Context::Ref ctx) { + auto qweight = opp::wrap_type(); + auto qcoeff = opp::wrap_type(); + auto qcvtw = opp::wrap_type({qweight}); + auto qmuls = opp::wrap_type({qcvtw, qcoeff}); + auto qreshp = opp::wrap_type({qmuls, opp::any_input()}); + auto qmmi = opp::any_input(); + auto qmm = opp::wrap_type({qmmi, qreshp}); + + // Note: Use [=] to make sure the above objects stay alive in the callback + auto callback = [=](ov::pass::pattern::Matcher& m) { + auto& node_to_output = m.get_pattern_value_map(); + + auto matched_node_qweight = node_to_output.at(qweight).get_node_shared_ptr(); + auto matched_node_qcoeff = node_to_output.at(qcoeff).get_node_shared_ptr(); + auto matched_node_matmul = node_to_output.at(qmm).get_node_shared_ptr(); + auto matched_out_mmi = node_to_output.at(qmmi); + + auto matched_qweight = std::static_pointer_cast(matched_node_qweight); + auto matched_qcoeff = std::static_pointer_cast(matched_node_qcoeff); + auto matched_matmul = std::static_pointer_cast(matched_node_matmul); + + auto qweight_shape = matched_qweight->output(0).get_shape(); + auto qcoeff_shape = matched_qcoeff->output(0).get_shape(); + auto act_shape = matched_out_mmi.get_shape(); + auto out_shape = matched_node_matmul->output(0).get_shape(); + + if (ov::element::i4 == matched_qweight->get_element_type() && qweight_shape.size() == 3 && + ov::element::f32 == matched_qcoeff->get_element_type() && qcoeff_shape.size() == 3 && + act_shape.size() == 3 && act_shape[1] > 1 && // multi-token case + qcoeff_shape[0] == qweight_shape[0] && qcoeff_shape[1] == 1 && qcoeff_shape[2] == qweight_shape[2] && + !matched_matmul->get_transpose_a() && !matched_matmul->get_transpose_b()) { + // Mark W closure to transpose, and transpose the respective parameter + ov::Shape tw_shape = {qweight_shape[0], qweight_shape[2], qweight_shape[1]}; + matched_qweight->set_partial_shape(tw_shape); + matched_qweight->validate_and_infer_types(); + ctx.get().permute(matched_qweight, {0, 2, 1}); + + // Mark S closure to be lowered fo f16 + matched_qcoeff->set_element_type(ov::element::f16); + matched_qcoeff->validate_and_infer_types(); + ctx.get().to_f16(matched_qcoeff); + + // Reshape the Act to group format + const auto NSPLIT = qweight_shape[0]; + std::vector rshp_act_v = {act_shape[1], NSPLIT, act_shape[2] / NSPLIT}; + auto rshp_act_c = std::make_shared(ov::element::i32, ov::Shape{3}, rshp_act_v); + auto rshp_act = std::make_shared(matched_out_mmi, rshp_act_c, false); + + // Split Act and W, and S tensors by NSPLIT + auto split_axis_a = std::make_shared(ov::element::i32, ov::Shape{}, 1); + auto split_a = std::make_shared(rshp_act, split_axis_a, NSPLIT); + + auto split_axis_w = std::make_shared(ov::element::i32, ov::Shape{}, 0); + auto split_w = std::make_shared(matched_qweight, split_axis_w, NSPLIT); + auto split_s = std::make_shared(matched_qcoeff, split_axis_w, NSPLIT); + + std::vector r_a_v = {1, act_shape[1], act_shape[2] / NSPLIT}; + auto r_a_c = std::make_shared(ov::element::i32, ov::Shape{3}, r_a_v); + + // Do the CW MM for every split + std::vector> to_concat; + for (std::size_t i = 0; i < NSPLIT; i++) { + auto a_f16 = std::make_shared(split_a->output(i), ov::element::f16); + auto r_f16 = std::make_shared(a_f16, r_a_c, false); + auto w_f16 = std::make_shared(split_w->output(i), ov::element::f16); + auto m_f16 = std::make_shared(r_f16, w_f16, false, true); + auto s_f16 = std::make_shared(m_f16, split_s->output(i)); + to_concat.push_back(s_f16); + } + + // Reduce via Add + std::vector> reduce; + reduce.push_back(std::make_shared(to_concat[0], to_concat[1])); + for (std::size_t i = 1; i < NSPLIT - 1; i++) { + reduce.push_back(std::make_shared(reduce[i - 1], to_concat[i + 1])); + } + + // Convert the result to f32 to maintain the graph contracts. FIXME should be avoided + auto out = std::make_shared(reduce.back(), ov::element::f32); + + // Now.. Reconnect the matmul readers to the new output (reducesum) + for (auto&& r : matched_matmul->output(0).get_target_inputs()) { + r.replace_source_output(out); + } + return true; // root has changed + } + return false; // did nothing here + }; + register_matcher(std::make_shared(qmm, "OptDQMatMulGQiP"), std::move(callback)); +} + +// N token case (prompt) +// +// FROM: +// ???(Act) -------------------------------------------------------> +// Param(W) -> Convert(f16|f32) -> Multiply -> Reshape -> Convert -> MatMul +// Param(S) ---------------------> +// +// WHERE (example): +// Act: [ 1, N,4096] +// W: [11008,32, 128] +// S: [11008,32, 1] +// [1, N ,128] x +// TO: [1,11K,128]T = +// [N,32,128] [1,N,128] [1, N ,11K] [32,N,11K] +// ???(Act) -> Reshape > Split(/32) ->[to(f16) - Reshape -> ]} +// Param(W*) -----------> Split(/32) ->[to(f16) -----------> MatMul v ]} 32xAdd +// Param(S*) -----------> Split(/32) ->[-------------------> Multiply ]} v +// to(f32) +// WHERE: +// W* : [32,11008, 128] +// S* : [32, 1,11008] +DQMatMulGQ2iP::DQMatMulGQ2iP(Context::Ref ctx) { + auto qweight = opp::wrap_type(); + auto qcoeff = opp::wrap_type(); + auto qcvtw = opp::wrap_type({qweight}); + auto qmuls = opp::wrap_type({qcvtw, qcoeff}); + auto qreshp = opp::wrap_type({qmuls, opp::any_input()}); + auto qcvtm = opp::optional({qreshp->output(0)}); + auto qmmi = opp::any_input(); + auto qmm = opp::wrap_type({qmmi, qcvtm}); + + // Note: Use [=] to make sure the above objects stay alive in the callback + auto callback = [=](ov::pass::pattern::Matcher& m) { + auto& node_to_output = m.get_pattern_value_map(); + + auto matched_node_qweight = node_to_output.at(qweight).get_node_shared_ptr(); + auto matched_node_qcoeff = node_to_output.at(qcoeff).get_node_shared_ptr(); + auto matched_node_matmul = node_to_output.at(qmm).get_node_shared_ptr(); + auto matched_out_mmi = node_to_output.at(qmmi); + + auto matched_qweight = std::static_pointer_cast(matched_node_qweight); + auto matched_qcoeff = std::static_pointer_cast(matched_node_qcoeff); + auto matched_matmul = std::static_pointer_cast(matched_node_matmul); + + auto qweight_shape = matched_qweight->output(0).get_shape(); + auto qcoeff_shape = matched_qcoeff->output(0).get_shape(); + auto act_shape = matched_out_mmi.get_shape(); + auto out_shape = matched_node_matmul->output(0).get_shape(); + + if (ov::element::i4 == matched_qweight->get_element_type() && qweight_shape.size() == 3 && + ov::element::f16 == matched_qcoeff->get_element_type() && qcoeff_shape.size() == 3 && + act_shape.size() == 3 && act_shape[1] > 1 && // multi-token case + qcoeff_shape[0] == qweight_shape[0] && qcoeff_shape[1] == qweight_shape[1] && qcoeff_shape[2] == 1 && + !matched_matmul->get_transpose_a() && matched_matmul->get_transpose_b()) { + // Mark W closure to transpose, and transpose the respective parameter + ov::Shape tw_shape = {qweight_shape[1], qweight_shape[0], qweight_shape[2]}; + matched_qweight->set_partial_shape(tw_shape); + matched_qweight->validate_and_infer_types(); + ctx.get().permute(matched_qweight, {1, 0, 2}); + + // Also transpose S, but in a different way (see diagram above) + ctx.get().permute(matched_qcoeff, {1, 2, 0}); + + ov::Shape ts_shape = {qcoeff_shape[1], qcoeff_shape[2], qcoeff_shape[0]}; + matched_qcoeff->set_partial_shape(ts_shape); + matched_qcoeff->validate_and_infer_types(); + + // Reshape the Act to group format + const auto NSPLIT = qweight_shape[1]; + std::vector rshp_act_v = {act_shape[1], NSPLIT, act_shape[2] / NSPLIT}; + auto rshp_act_c = std::make_shared(ov::element::i32, ov::Shape{3}, rshp_act_v); + auto rshp_act = std::make_shared(matched_out_mmi, rshp_act_c, false); + + // Split Act and W, and S tensors by NSPLIT + auto split_axis_a = std::make_shared(ov::element::i32, ov::Shape{}, 1); + auto split_a = std::make_shared(rshp_act, split_axis_a, NSPLIT); + + auto split_axis_w = std::make_shared(ov::element::i32, ov::Shape{}, 0); + auto split_w = std::make_shared(matched_qweight, split_axis_w, NSPLIT); + auto split_s = std::make_shared(matched_qcoeff, split_axis_w, NSPLIT); + + std::vector r_a_v = {1, act_shape[1], act_shape[2] / NSPLIT}; + auto r_a_c = std::make_shared(ov::element::i32, ov::Shape{3}, r_a_v); + + // Do the CW MM for every split + std::vector> to_concat; + for (std::size_t i = 0; i < NSPLIT; i++) { + auto a_f16 = std::make_shared(split_a->output(i), ov::element::f16); + auto r_f16 = std::make_shared(a_f16, r_a_c, false); + auto w_f16 = std::make_shared(split_w->output(i), ov::element::f16); + auto m_f16 = std::make_shared(r_f16, w_f16, false, true); + auto s_f16 = std::make_shared(m_f16, split_s->output(i)); + to_concat.push_back(s_f16); + } + + // Reduce via Add + std::vector> reduce; + reduce.push_back(std::make_shared(to_concat[0], to_concat[1])); + for (std::size_t i = 1; i < NSPLIT - 1; i++) { + reduce.push_back(std::make_shared(reduce[i - 1], to_concat[i + 1])); + } + + ov::Output out = reduce.back(); + if (matched_matmul->output(0).get_element_type() == ov::element::f32) { + // Convert the result to f32 to maintain the graph contracts, if needed + out = std::make_shared(out, ov::element::f32); + } + + // Now.. Reconnect the matmul readers to the new output (reducesum) + for (auto&& r : matched_matmul->output(0).get_target_inputs()) { + r.replace_source_output(out); + } + return true; // root has changed + } + return false; // did nothing here + }; + register_matcher(std::make_shared(qmm, "OptDQMatMulGQ2iP"), std::move(callback)); +} + // Identifies this pattern // // Multiply -----------------------------------> MatMul diff --git a/src/plugins/intel_npu/src/plugin/npuw/partitioning/patterns/opt.hpp b/src/plugins/intel_npu/src/plugin/npuw/partitioning/patterns/opt.hpp index fb867f8a344234..b51b32df23f2a2 100644 --- a/src/plugins/intel_npu/src/plugin/npuw/partitioning/patterns/opt.hpp +++ b/src/plugins/intel_npu/src/plugin/npuw/partitioning/patterns/opt.hpp @@ -61,6 +61,16 @@ class DQMatMulGQ2i : public ov::pass::MatcherPass { explicit DQMatMulGQ2i(Context::Ref ctx); }; +class DQMatMulGQiP : public ov::pass::MatcherPass { +public: + explicit DQMatMulGQiP(Context::Ref ctx); +}; + +class DQMatMulGQ2iP : public ov::pass::MatcherPass { +public: + explicit DQMatMulGQ2iP(Context::Ref ctx); +}; + class DQParMMGQ : public ov::pass::MatcherPass { public: explicit DQParMMGQ(Context::Ref ctx); diff --git a/src/plugins/intel_npu/tests/functional/README.md b/src/plugins/intel_npu/tests/functional/README.md index a749093fee4c75..0341710097d77e 100644 --- a/src/plugins/intel_npu/tests/functional/README.md +++ b/src/plugins/intel_npu/tests/functional/README.md @@ -19,4 +19,4 @@ The following environment variables can be set up for the run of test binary `ov * `IE_NPU_TESTS_IMPORT_REF` - bool type, denotes whether to read reference values from the files matching current test case (instead of calculating them) * `IE_NPU_TESTS_RAW_EXPORT` - bool type, denotes whether to use header for exported network file or not * `IE_NPU_TESTS_LONG_FILE_NAME` - bool type, denotes whether to allow longer file names for the exported artifacts. By default shorter file names are used for all operating systems -* `IE_NPU_TESTS_PLATFORM` - string type, enable compiler config option `NPU_PLATFORM` with value from the environment. Sample value - `NPU3700`. Please refer to the documentation for more information about possible values. +* `IE_NPU_TESTS_PLATFORM` - string type, enable compiler config option `NPU_PLATFORM` with value from the environment. Sample value - `NPU3720`. For more information about possible values, refer to the [NPU plugin README file](./../../../intel_npu/README.md).