forked from openvinotoolkit/openvino
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge remote-tracking branch 'upstream/master' into partial_value_opt…
…imization Signed-off-by: Evgeniia Nugmanova <[email protected]>
- Loading branch information
Showing
45 changed files
with
2,305 additions
and
180 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,133 @@ | ||
name: JAX Layer Tests | ||
|
||
on: | ||
workflow_call: | ||
inputs: | ||
runner: | ||
description: 'Machine on which the tests would run' | ||
type: string | ||
required: true | ||
container: | ||
description: 'JSON to be converted to the value of the "container" configuration for the job' | ||
type: string | ||
required: false | ||
default: '{"image": null}' | ||
affected-components: | ||
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_LINUX: /mount/caches/pip/linux | ||
PIP_CACHE_PATH_WIN: "C:\\mount\\caches\\pip\\win" | ||
|
||
jobs: | ||
JAX_Layer_Tests: | ||
name: JAX Layer Tests | ||
timeout-minutes: 40 | ||
runs-on: ${{ inputs.runner }} | ||
container: ${{ fromJSON(inputs.container) }} | ||
defaults: | ||
run: | ||
shell: ${{ contains(inputs.runner, 'win') && 'pwsh' || 'bash' }} | ||
env: | ||
DEBIAN_FRONTEND: noninteractive # to prevent apt-get from waiting user input | ||
OPENVINO_REPO: ${{ github.workspace }}/openvino | ||
INSTALL_DIR: ${{ github.workspace }}/install | ||
INSTALL_TEST_DIR: ${{ github.workspace }}/install/tests | ||
INSTALL_WHEELS_DIR: ${{ github.workspace }}/install/wheels | ||
LAYER_TESTS_INSTALL_DIR: ${{ github.workspace }}/install/tests/layer_tests | ||
steps: | ||
- name: Download OpenVINO artifacts (tarballs) | ||
uses: actions/download-artifact@fa0a91b85d4f404e444e00e005971372dc801d16 # v4.1.8 | ||
with: | ||
pattern: openvino_[tests]* | ||
path: ${{ env.INSTALL_DIR }} | ||
merge-multiple: true | ||
|
||
- name: Download OpenVINO artifacts (wheels) | ||
uses: actions/download-artifact@fa0a91b85d4f404e444e00e005971372dc801d16 # v4.1.8 | ||
with: | ||
pattern: openvino_[wheels]* | ||
path: ${{ env.INSTALL_WHEELS_DIR }} | ||
merge-multiple: true | ||
|
||
# Needed as ${{ github.workspace }} is not working correctly when using Docker | ||
- name: Setup Variables | ||
if: runner.os != 'Windows' | ||
run: | | ||
echo "OPENVINO_REPO=$GITHUB_WORKSPACE/openvino" >> "$GITHUB_ENV" | ||
echo "INSTALL_DIR=$GITHUB_WORKSPACE/install" >> "$GITHUB_ENV" | ||
echo "INSTALL_TEST_DIR=$GITHUB_WORKSPACE/install/tests" >> "$GITHUB_ENV" | ||
echo "INSTALL_WHEELS_DIR=$GITHUB_WORKSPACE/install/wheels" >> "$GITHUB_ENV" | ||
echo "LAYER_TESTS_INSTALL_DIR=$GITHUB_WORKSPACE/install/tests/layer_tests" >> "$GITHUB_ENV" | ||
- name: Install OpenVINO dependencies (mac) | ||
if: runner.os == 'macOS' | ||
run: brew install pigz | ||
|
||
- name: Extract OpenVINO packages (Linux, macOS) | ||
if: runner.os != 'Windows' | ||
run: | | ||
pigz -dc openvino_tests.tar.gz | tar -xf - -C ${INSTALL_DIR} | ||
working-directory: ${{ env.INSTALL_DIR }} | ||
|
||
- name: Extract OpenVINO artifacts (Windows) | ||
if: runner.os == 'Windows' | ||
run: | | ||
Expand-Archive openvino_tests.zip -DestinationPath ${{ env.INSTALL_DIR }} | ||
working-directory: ${{ env.INSTALL_DIR }} | ||
|
||
- name: Fetch setup_python and install wheels actions | ||
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 | ||
timeout-minutes: 15 | ||
with: | ||
sparse-checkout: | | ||
.github/actions/setup_python/action.yml | ||
.github/actions/install_ov_wheels/action.yml | ||
sparse-checkout-cone-mode: false | ||
path: 'openvino' | ||
|
||
- name: Setup Python ${{ inputs.python-version }} | ||
uses: ./openvino/.github/actions/setup_python | ||
with: | ||
version: ${{ inputs.python-version }} | ||
pip-cache-path: ${{ runner.os == 'Linux' && env.PIP_CACHE_PATH_LINUX || env.PIP_CACHE_PATH_WIN }} | ||
should-setup-pip-paths: ${{ runner.os != 'macOS' }} | ||
self-hosted-runner: ${{ runner.os != 'macOS' }} | ||
|
||
- name: Install OpenVINO Python wheels | ||
uses: ./openvino/.github/actions/install_ov_wheels | ||
with: | ||
wheels-dir-path: ${{ env.INSTALL_WHEELS_DIR }} | ||
wheels-to-install: 'openvino' | ||
|
||
- name: Install JAX Layer tests dependencies | ||
run: | | ||
# jax test requirements | ||
python3 -m pip install -r ${{ env.INSTALL_TEST_DIR }}/requirements_jax | ||
- name: JAX Layer Tests | ||
if: ${{ fromJSON(inputs.affected-components).JAX_FE.test && runner.arch != 'ARM64' }} # Ticket: 126287, 142196 | ||
run: python3 -m pytest ${{ env.LAYER_TESTS_INSTALL_DIR }}/jax_tests ${PARALLEL} -m precommit_jax_fe --junitxml=${{ env.INSTALL_TEST_DIR }}/TEST-jax.xml | ||
env: | ||
TEST_DEVICE: CPU | ||
TEST_PRECISION: FP16 | ||
JAX_TRACE_MODE: JAXPR | ||
PARALLEL: ${{ runner.os == 'Windows' && ' ' || '-n logical'}} | ||
|
||
- name: Upload Test Results | ||
uses: actions/upload-artifact@b4b15b8c7c6ac21ea08fcf65892d2ee8f75cf882 # v4.4.3 | ||
if: ${{ !cancelled() }} | ||
with: | ||
name: test-results-python-jax-layers | ||
path: | | ||
${{ env.INSTALL_TEST_DIR }}/TEST*.html | ||
${{ env.INSTALL_TEST_DIR }}/TEST*.xml | ||
if-no-files-found: 'warn' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
60 changes: 60 additions & 0 deletions
60
src/common/transformations/include/transformations/common_optimizations/sdpa_fusion.hpp
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
// Copyright (C) 2024 Intel Corporation | ||
// SPDX-License-Identifier: Apache-2.0 | ||
// | ||
|
||
#pragma once | ||
|
||
#include "openvino/pass/matcher_pass.hpp" | ||
#include "transformations_visibility.hpp" | ||
|
||
namespace ov { | ||
namespace pass { | ||
|
||
/// This pass transforms the following sub-graph to a single Scaled Dot Product Attention operation. | ||
/// Before: | ||
/// ┌───────┐ ┌───────┐ ┌───────┐ | ||
/// │ Q │ │ K │ │ V │ | ||
/// └───┬───┘ └───┬───┘ └───┬───┘ | ||
/// │ │ │ | ||
/// │ │ │ | ||
/// ┌───┴───┐ ┌─────┴──────┐ │ | ||
/// │ MatMul│<──│ Transpose │ │ | ||
/// └───┬───┘ | (Optional) │ │ | ||
/// │ └────────────┘ │ | ||
/// ┌───┴───┐ ┌─────────────┐ │ | ||
/// │ Add │<───│AttentionMask│ │ | ||
/// └───┬───┘ | (Optional) │ │ | ||
/// │ └─────────────┘ │ | ||
/// ┌───┴───┐ │ | ||
/// │Softmax│ │ | ||
/// └───┬───┘ │ | ||
/// │ │ | ||
/// ┌───┴───┐ │ | ||
/// │ MatMul│<─────────────────────┘ | ||
/// └───┬───┘ | ||
/// ┌───┴───┐ | ||
/// │ Output│ | ||
/// └───────┘ | ||
/// | ||
/// After: | ||
/// ┌───────┐ ┌───────┐ ┌───────┐ ┌─────────────┐ | ||
/// │ Q │ │ K │ │ V │ │AttentionMask│ | ||
/// └───┬───┘ └───┬───┘ └───┬───┘ └──────┬──────┘ | ||
/// │ │ │ │ | ||
/// │ │ │ │ | ||
/// ┌───┴────────────┴────────────┴───────────────┴─┐ | ||
/// │ ScaledDotProductAttention │ | ||
/// └────────────────────┬──────────────────────────┘ | ||
/// │ | ||
/// │ | ||
/// ┌────┴────┐ | ||
/// │ Output │ | ||
/// └─────────┘ | ||
class TRANSFORMATIONS_API SDPAFusion : public ov::pass::MatcherPass { | ||
public: | ||
OPENVINO_MATCHER_PASS_RTTI("SDPAFusion", "0"); | ||
SDPAFusion(); | ||
}; | ||
|
||
} // namespace pass | ||
} // namespace ov |
Oops, something went wrong.