From 0ae44841dc164c9abd7a731bbfd35b95644cd19c Mon Sep 17 00:00:00 2001 From: Roman Kazantsev Date: Thu, 3 Oct 2024 15:44:09 +0400 Subject: [PATCH 1/2] [PT FE][GHA] Run PT FE layer tests on Ubuntu 24.04 with Python 3.12 and NumPy 2.X (#26886) **Details:** Run PT FE layer tests on Ubuntu 24.04 with Python 3.12 and NumPy 2.X Also, this PR contains fixes: - WA sporadic bug on Windows in case parallel run - support PT FE and TF FE layer tests on MacOS x86 - leftovers from code-review **Tickets:** 154003, 153800 --------- Signed-off-by: Kazantsev, Roman --- .github/workflows/job_pytorch_layer_tests.yml | 39 +++++++------------ .../workflows/job_tensorflow_layer_tests.yml | 15 ++++--- .github/workflows/linux_arm64.yml | 6 +-- .github/workflows/mac.yml | 6 +-- .github/workflows/mac_arm64.yml | 6 +-- .github/workflows/ubuntu_22.yml | 6 +-- .github/workflows/ubuntu_24.yml | 10 +++++ .github/workflows/windows_vs2019_release.yml | 6 +-- .../pytorch_tests/test_bitwise_ops.py | 6 ++- tests/requirements_pytorch | 26 +++++++------ tests/requirements_tensorflow | 3 +- 11 files changed, 68 insertions(+), 61 deletions(-) diff --git a/.github/workflows/job_pytorch_layer_tests.yml b/.github/workflows/job_pytorch_layer_tests.yml index 88b41f983f7094..50942cf331ab72 100644 --- a/.github/workflows/job_pytorch_layer_tests.yml +++ b/.github/workflows/job_pytorch_layer_tests.yml @@ -7,10 +7,6 @@ on: description: 'Machine on which the tests would run' type: string required: true - shell: - description: "shell to override the default shell settings in the runner's operating system." - type: string - required: true container: description: 'JSON to be converted to the value of the "container" configuration for the job' type: string @@ -20,12 +16,15 @@ on: description: 'Components that are affected by changes in the commit defined by the Smart CI Action' type: string required: true + python-version: + description: 'Python version to setup. E.g., "3.11"' + type: string + required: true permissions: read-all env: PIP_CACHE_PATH: /mount/caches/pip/linux - PYTHON_VERSION: '3.11' jobs: PyTorch_Layer_Tests: @@ -35,7 +34,7 @@ jobs: container: ${{ fromJSON(inputs.container) }} defaults: run: - shell: ${{ inputs.shell }} + shell: ${{ contains(inputs.runner, 'win') && 'pwsh' || 'bash' }} env: DEBIAN_FRONTEND: noninteractive # to prevent apt-get from waiting user input OPENVINO_REPO: ${{ github.workspace }}/openvino @@ -55,12 +54,6 @@ jobs: name: openvino_tests path: ${{ env.INSTALL_TEST_DIR }} - - name: Download OpenVINO tokenizers extension - uses: actions/download-artifact@fa0a91b85d4f404e444e00e005971372dc801d16 # v4.1.8 - with: - name: openvino_tokenizers_wheel - path: ${{ env.INSTALL_DIR }} - # Needed as ${{ github.workspace }} is not working correctly when using Docker - name: Setup Variables if: runner.os != 'Windows' @@ -98,10 +91,10 @@ jobs: sparse-checkout-cone-mode: false path: 'openvino' - - name: Setup Python ${{ env.PYTHON_VERSION }} + - name: Setup Python ${{ inputs.python-version }} uses: ./openvino/.github/actions/setup_python with: - version: ${{ env.PYTHON_VERSION }} + version: ${{ inputs.python-version }} pip-cache-path: ${{ runner.os == 'Linux' && env.PIP_CACHE_PATH || '' }} should-setup-pip-paths: ${{ runner.os == 'Linux' }} self-hosted-runner: ${{ runner.os == 'Linux' }} @@ -112,9 +105,6 @@ jobs: # Install the core OV wheel python3 -m pip install ${INSTALL_DIR}/tools/openvino-*.whl - # Install the core OV Tokenizers wheel - python3 -m pip install ${INSTALL_DIR}/openvino_tokenizers-*.whl - - name: Install OpenVINO Python wheels (Windows) if: runner.os == 'Windows' run: | @@ -122,10 +112,6 @@ jobs: $ovCoreWheelPath=Get-ChildItem -Path ${{ env.INSTALL_DIR }}\tools -Filter openvino-*.whl | % { $_.FullName } python3 -m pip install "$ovCoreWheelPath" - # Find and install the core OV Tokenizers wheel - $ovCoreWheelPath=Get-ChildItem -Path ${{ env.INSTALL_DIR }} -Filter openvino_tokenizers-*.whl | % { $_.FullName } - python3 -m pip install "$ovCoreWheelPath" - - name: Install Pytorch Layer tests dependencies run: | # pytorch test requirements @@ -133,22 +119,25 @@ jobs: - name: PyTorch Layer Tests if: ${{ fromJSON(inputs.affected-components).PyTorch_FE.test && runner.arch != 'ARM64' }} # Ticket: 126287, 142196 - run: python3 -m pytest ${{ env.LAYER_TESTS_INSTALL_DIR }}/pytorch_tests -n logical -m precommit --junitxml=${{ env.INSTALL_TEST_DIR }}/TEST-pytorch.xml + # due to CVS-152795, parallel run is not possible on Windows + run: python3 -m pytest ${{ env.LAYER_TESTS_INSTALL_DIR }}/pytorch_tests ${PARALLEL} -m precommit --junitxml=${{ env.INSTALL_TEST_DIR }}/TEST-pytorch.xml env: TEST_DEVICE: CPU TEST_PRECISION: FP32 + PARALLEL: ${{ runner.os == 'Windows' && ' ' || '-n logical'}} - name: PyTorch torch.export Layer Tests - if: ${{ fromJSON(inputs.affected-components).PyTorch_FE.test && runner.arch != 'ARM64' }} # Ticket: 126287 + if: ${{ fromJSON(inputs.affected-components).PyTorch_FE.test && runner.arch != 'ARM64' && runner.os != 'Windows' }} # Ticket: 126287 run: | - python3 -m pytest ${{ env.LAYER_TESTS_INSTALL_DIR }}/pytorch_tests -n logical -m precommit_torch_export --junitxml=${{ env.INSTALL_TEST_DIR }}/TEST-pytorch.xml + python3 -m pytest ${{ env.LAYER_TESTS_INSTALL_DIR }}/pytorch_tests ${PARALLEL} -m precommit_torch_export --junitxml=${{ env.INSTALL_TEST_DIR }}/TEST-pytorch.xml env: TEST_DEVICE: CPU TEST_PRECISION: FP32 PYTORCH_TRACING_MODE: EXPORT + PARALLEL: ${{ runner.os == 'Windows' && ' ' || '-n logical'}} - name: PyTorch torch.compile TORCHFX Layer Tests - if: ${{ fromJSON(inputs.affected-components).PyTorch_FE.test && runner.os != 'macOS' && runner.arch != 'ARM64' }} # Ticket: 126287 + if: ${{ fromJSON(inputs.affected-components).PyTorch_FE.test && runner.os != 'macOS' && runner.arch != 'ARM64' && runner.os != 'Windows' }} # Ticket: 126287 run: | python3 -m pytest ${{ env.LAYER_TESTS_INSTALL_DIR }}/pytorch_tests -m precommit_fx_backend --junitxml=${{ env.INSTALL_TEST_DIR }}/TEST-pytorch.xml env: diff --git a/.github/workflows/job_tensorflow_layer_tests.yml b/.github/workflows/job_tensorflow_layer_tests.yml index 0801010b86bde3..e8d7b51e14c02f 100644 --- a/.github/workflows/job_tensorflow_layer_tests.yml +++ b/.github/workflows/job_tensorflow_layer_tests.yml @@ -7,10 +7,6 @@ on: description: 'Machine on which the tests would run' type: string required: true - shell: - description: "shell to override the default shell settings in the runner's operating system." - type: string - required: true container: description: 'JSON to be converted to the value of the "container" configuration for the job' type: string @@ -20,12 +16,15 @@ on: description: 'Components that are affected by changes in the commit defined by the Smart CI Action' type: string required: true + python-version: + description: 'Python version to setup. E.g., "3.11"' + type: string + required: true permissions: read-all env: PIP_CACHE_PATH: /mount/caches/pip/linux - PYTHON_VERSION: '3.11' jobs: TensorFlow_Layer_Tests: @@ -35,7 +34,7 @@ jobs: container: ${{ fromJSON(inputs.container) }} defaults: run: - shell: ${{ inputs.shell }} + shell: ${{ contains(inputs.runner, 'win') && 'pwsh' || 'bash' }} env: DEBIAN_FRONTEND: noninteractive # to prevent apt-get from waiting user input OPENVINO_REPO: ${{ github.workspace }}/openvino @@ -98,10 +97,10 @@ jobs: sparse-checkout-cone-mode: false path: 'openvino' - - name: Setup Python ${{ env.PYTHON_VERSION }} + - name: Setup Python ${{ inputs.python-version }} uses: ./openvino/.github/actions/setup_python with: - version: ${{ env.PYTHON_VERSION }} + version: ${{ inputs.python-version }} pip-cache-path: ${{ runner.os == 'Linux' && env.PIP_CACHE_PATH || '' }} should-setup-pip-paths: ${{ runner.os == 'Linux' }} self-hosted-runner: ${{ runner.os == 'Linux' }} diff --git a/.github/workflows/linux_arm64.yml b/.github/workflows/linux_arm64.yml index 3506ca49846f45..e4e608f3aca6d4 100644 --- a/.github/workflows/linux_arm64.yml +++ b/.github/workflows/linux_arm64.yml @@ -173,19 +173,19 @@ jobs: uses: ./.github/workflows/job_tensorflow_layer_tests.yml with: runner: 'aks-linux-16-cores-arm' - shell: bash container: '{"image": "${{ fromJSON(needs.docker.outputs.images).ov_test.ubuntu_20_04_arm64 }}", "volumes": ["/mount:/mount"]}' affected-components: ${{ needs.smart_ci.outputs.affected_components }} + python-version: '3.11' Pytorch_Layer_Tests: name: Pytorch Layer Tests - needs: [ Build, Docker, Smart_CI, Openvino_tokenizers ] + needs: [ Build, Docker, Smart_CI ] uses: ./.github/workflows/job_pytorch_layer_tests.yml with: runner: 'aks-linux-16-cores-arm' - shell: bash container: '{"image": "${{ fromJSON(needs.docker.outputs.images).ov_test.ubuntu_20_04_arm64 }}", "volumes": ["/mount:/mount"]}' affected-components: ${{ needs.smart_ci.outputs.affected_components }} + python-version: '3.11' CPU_Functional_Tests: name: CPU functional tests diff --git a/.github/workflows/mac.yml b/.github/workflows/mac.yml index da3224fa483ad1..20db9de1776015 100644 --- a/.github/workflows/mac.yml +++ b/.github/workflows/mac.yml @@ -276,17 +276,17 @@ jobs: uses: ./.github/workflows/job_tensorflow_layer_tests.yml with: runner: 'macos-13' - shell: bash affected-components: ${{ needs.smart_ci.outputs.affected_components }} + python-version: '3.11' Pytorch_Layer_Tests: name: Pytorch Layer Tests - needs: [ Build, Smart_CI, Openvino_tokenizers ] + needs: [ Build, Smart_CI ] uses: ./.github/workflows/job_pytorch_layer_tests.yml with: runner: 'macos-13' - shell: bash affected-components: ${{ needs.smart_ci.outputs.affected_components }} + python-version: '3.11' CPU_Functional_Tests: name: CPU functional tests diff --git a/.github/workflows/mac_arm64.yml b/.github/workflows/mac_arm64.yml index 331afc7266cd6a..a38179f71fb60c 100644 --- a/.github/workflows/mac_arm64.yml +++ b/.github/workflows/mac_arm64.yml @@ -275,17 +275,17 @@ jobs: uses: ./.github/workflows/job_tensorflow_layer_tests.yml with: runner: 'macos-13-xlarge' - shell: bash affected-components: ${{ needs.smart_ci.outputs.affected_components }} + python-version: '3.11' Pytorch_Layer_Tests: name: Pytorch Layer Tests - needs: [ Build, Smart_CI, Openvino_tokenizers ] + needs: [ Build, Smart_CI ] uses: ./.github/workflows/job_pytorch_layer_tests.yml with: runner: 'macos-13-xlarge' - shell: bash affected-components: ${{ needs.smart_ci.outputs.affected_components }} + python-version: '3.11' CPU_Functional_Tests: name: CPU functional tests diff --git a/.github/workflows/ubuntu_22.yml b/.github/workflows/ubuntu_22.yml index 8f461391f20a9f..2c20e5136cfc4e 100644 --- a/.github/workflows/ubuntu_22.yml +++ b/.github/workflows/ubuntu_22.yml @@ -305,19 +305,19 @@ jobs: uses: ./.github/workflows/job_tensorflow_layer_tests.yml with: runner: 'aks-linux-4-cores-16gb' - shell: bash container: '{"image": "${{ fromJSON(needs.docker.outputs.images).ov_test.ubuntu_22_04_x64 }}", "volumes": ["/mount:/mount"]}' affected-components: ${{ needs.smart_ci.outputs.affected_components }} + python-version: '3.11' Pytorch_Layer_Tests: name: Pytorch Layer Tests - needs: [ Docker, Build, Smart_CI, Openvino_tokenizers ] + needs: [ Docker, Build, Smart_CI ] uses: ./.github/workflows/job_pytorch_layer_tests.yml with: runner: 'aks-linux-4-cores-16gb' - shell: bash container: '{"image": "${{ fromJSON(needs.docker.outputs.images).ov_test.ubuntu_22_04_x64 }}", "volumes": ["/mount:/mount"]}' affected-components: ${{ needs.smart_ci.outputs.affected_components }} + python-version: '3.11' CPU_Functional_Tests: name: CPU functional tests diff --git a/.github/workflows/ubuntu_24.yml b/.github/workflows/ubuntu_24.yml index 6409b417a0731b..295a4dd0e2c61a 100644 --- a/.github/workflows/ubuntu_24.yml +++ b/.github/workflows/ubuntu_24.yml @@ -133,6 +133,16 @@ jobs: affected-components: ${{ needs.smart_ci.outputs.affected_components }} python-version: '3.12' + Pytorch_Layer_Tests: + name: Pytorch Layer Tests + needs: [ Docker, Build, Smart_CI ] + uses: ./.github/workflows/job_pytorch_layer_tests.yml + with: + runner: 'aks-linux-4-cores-16gb' + container: '{"image": "${{ fromJSON(needs.docker.outputs.images).ov_test.ubuntu_24_04_x64 }}", "volumes": ["/mount:/mount"]}' + affected-components: ${{ needs.smart_ci.outputs.affected_components }} + python-version: '3.12' + Overall_Status: name: ci/gha_overall_status_ubuntu_24 needs: [Smart_CI, Build, Debian_Packages, Samples, Python_Unit_Tests] diff --git a/.github/workflows/windows_vs2019_release.yml b/.github/workflows/windows_vs2019_release.yml index 39cf2161525513..122fcc3c1c5021 100644 --- a/.github/workflows/windows_vs2019_release.yml +++ b/.github/workflows/windows_vs2019_release.yml @@ -404,17 +404,17 @@ jobs: uses: ./.github/workflows/job_tensorflow_layer_tests.yml with: runner: 'aks-win-8-cores-16gb' - shell: pwsh affected-components: ${{ needs.smart_ci.outputs.affected_components }} + python-version: '3.11' Pytorch_Layer_Tests: name: Pytorch Layer Tests - needs: [ Build, Smart_CI, Openvino_tokenizers ] + needs: [ Build, Smart_CI ] uses: ./.github/workflows/job_pytorch_layer_tests.yml with: runner: 'aks-win-8-cores-16gb' - shell: pwsh affected-components: ${{ needs.smart_ci.outputs.affected_components }} + python-version: '3.11' CXX_Unit_Tests: name: C++ unit tests diff --git a/tests/layer_tests/pytorch_tests/test_bitwise_ops.py b/tests/layer_tests/pytorch_tests/test_bitwise_ops.py index 1cf458500bcc71..e55a86f279de21 100644 --- a/tests/layer_tests/pytorch_tests/test_bitwise_ops.py +++ b/tests/layer_tests/pytorch_tests/test_bitwise_ops.py @@ -4,6 +4,8 @@ import numpy as np import pytest import torch +from packaging import version + from pytorch_layer_test_class import PytorchLayerTest, skip_if_export @@ -69,10 +71,12 @@ def forward_not_out(self, tensor_a, out): ) @pytest.mark.parametrize("out", [False, skip_if_export(True)]) def test_bitwise_mixed_dtypes( - self, op_type, out, lhs_dtype, rhs_dtype, lhs_shape, rhs_shape, ie_device, precision, ir_version + self, op_type, out, lhs_dtype, rhs_dtype, lhs_shape, rhs_shape, ie_device, precision, ir_version ): if ie_device == "GPU" and (lhs_dtype != "bool" or rhs_dtype != "bool"): pytest.xfail(reason="bitwise ops are not supported on GPU") + if out and version.parse(np.__version__) >= version.parse("2.0.0"): + pytest.xfail(reason="CVS-154082: incorrect handling out type") self._test( *self.create_model(op_type, out), ie_device, diff --git a/tests/requirements_pytorch b/tests/requirements_pytorch index b82e0c76409057..0d5ac61903b104 100644 --- a/tests/requirements_pytorch +++ b/tests/requirements_pytorch @@ -1,10 +1,14 @@ +# test ovc with NumPy 2.x on Ubuntu 24 with default Python 3.12 +# test against NumPy 1.x with older Python versions # optimum still requires numpy<2.0.0 -numpy==1.26.4 +numpy==1.26.4; python_version < "3.12" +numpy==2.1.1; python_version >= "3.12" torch==2.4.1; platform_system != "Darwin" or platform_machine != "x86_64" -torch==2.2.0; platform_system == "Darwin" and platform_machine == "x86_64" +torch==2.2.2; platform_system == "Darwin" and platform_machine == "x86_64" --extra-index-url https://download.pytorch.org/whl/cpu -torchvision==0.19.1 +torchvision==0.19.1; platform_system != "Darwin" or platform_machine != "x86_64" +torchvision==0.17.2; platform_system == "Darwin" and platform_machine == "x86_64" # transformers 4.45.1 is available # but optimum still requires <4.45.0 transformers==4.44.2 @@ -13,22 +17,22 @@ pytest-html==4.1.1 pytest-xdist[psutil]==3.6.1 defusedxml==0.7.1 -auto-gptq==0.7.1; platform_system == "Linux" and platform_machine == "x86_64" +auto-gptq==0.7.1; platform_system == "Linux" and platform_machine == "x86_64" and python_version < "3.12" av==13.0.0 -basicsr==1.4.2 +basicsr==1.4.2; python_version < "3.12" datasets==3.0.1 easyocr==1.7.2 -facexlib==0.3.0 -librosa==0.10.2 -optimum==1.22.0 +facexlib==0.3.0; python_version < "3.12" +librosa==0.10.2; python_version < "3.12" +optimum==1.22.0; python_version < "3.12" packaging==24.1 pandas==2.2.3 protobuf==5.28.2 -pyctcdecode==0.5.0 +pyctcdecode==0.5.0; python_version < "3.12" sacremoses==0.1.1 sentencepiece==0.2.0 soundfile==0.12.1 -super-image==0.1.7 +super-image==0.1.7; python_version < "3.12" timm==1.0.8 torchaudio==2.4.1 wheel==0.44.0 @@ -36,7 +40,7 @@ PyYAML==6.0.2 kornia==0.7.3 # use latest released version once it's available -git+https://github.com/huggingface/optimum-intel.git@main +git+https://github.com/huggingface/optimum-intel.git@main; python_version < "3.12" # set 'export HF_HUB_ENABLE_HF_TRANSFER=1' to benefits from hf_transfer hf_transfer==0.1.8 diff --git a/tests/requirements_tensorflow b/tests/requirements_tensorflow index 9d025397ed1fbd..6042eb8a46a9c3 100644 --- a/tests/requirements_tensorflow +++ b/tests/requirements_tensorflow @@ -4,7 +4,8 @@ pytest==7.0.1 pytest-xdist[psutil]==3.6.1 pytest-html==4.1.1 transformers==4.45.1 -tensorflow==2.17.0 +tensorflow==2.17.0; platform_system != "Darwin" or platform_machine != "x86_64" +tensorflow==2.16.2; platform_system == "Darwin" and platform_machine == "x86_64" # tensorflow-text is not available for both Windows and ARM platforms tensorflow-text==2.17.0; platform_system == "Linux" and platform_machine == "x86_64" tensorflow-hub==0.16.1 From 1b892bfb00fcbccec8db96f66a86e3b1e01f6262 Mon Sep 17 00:00:00 2001 From: Pavel Durandin Date: Thu, 3 Oct 2024 13:43:02 +0400 Subject: [PATCH 2/2] [GPU] Fix double jit constants (#26893) ### Details: - Fix double constant definition --- .../fully_connected/fully_connected_kernel_bf_tiled.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/plugins/intel_gpu/src/kernel_selector/kernels/fully_connected/fully_connected_kernel_bf_tiled.cpp b/src/plugins/intel_gpu/src/kernel_selector/kernels/fully_connected/fully_connected_kernel_bf_tiled.cpp index 24641f3eb6aab0..c4115d74f54a92 100644 --- a/src/plugins/intel_gpu/src/kernel_selector/kernels/fully_connected/fully_connected_kernel_bf_tiled.cpp +++ b/src/plugins/intel_gpu/src/kernel_selector/kernels/fully_connected/fully_connected_kernel_bf_tiled.cpp @@ -534,6 +534,7 @@ JitConstants FullyConnected_bf_tiled::GetJitConstants(const fully_connected_para size_t tile_k_ofm_packed = tile_k_ofm; size_t quantize_grp_size = get_dynamic_quantize_group_size(params); + bool add_decompress_scale_post_op = false; WeightsType weights_dt = params.weights.GetDType(); if (weights_dt == WeightsType::UINT4 || weights_dt == WeightsType::INT4) { tile_k_ofm_packed /= 2; @@ -542,7 +543,7 @@ JitConstants FullyConnected_bf_tiled::GetJitConstants(const fully_connected_para const size_t scale_group_size = params.weights.IFM().v / params.decompression_scale.Feature().v; // Do not use SCALE_POST_OP for SLM kernel, since it demonstrates worse performance if (scale_group_size % simd == 0 && !dispatchData.use_slm) - jit.AddConstant(MakeJitConstant("DECOMPRESSION_SCALE_POST_OP", 1)); + add_decompress_scale_post_op = true; } if (params.weights.GetLayout() == WeightsLayout::os_is_yx_osv32_isv2) { jit.AddConstant(MakeJitConstant("W_IDX", "fi * TILE_K + kii")); @@ -619,6 +620,8 @@ JitConstants FullyConnected_bf_tiled::GetJitConstants(const fully_connected_para jit.AddConstant(MakeJitConstant("DQ_TYPE", "char")); jit.AddConstant(MakeJitConstant("QUANTIZE_GROUP_SIZE", quantize_grp_size)); } else { + if (add_decompress_scale_post_op) + jit.AddConstant(MakeJitConstant("DECOMPRESSION_SCALE_POST_OP", 1)); jit.AddConstant(MakeJitConstant("DYNAMIC_QUANTIZE", 0)); jit.AddConstant(MakeJitConstant("QUANTIZE_GROUP_SIZE", min_quantize_grp_size)); }