Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion .ci/scripts/test_backend_linux.sh
Original file line number Diff line number Diff line change
Expand Up @@ -39,12 +39,17 @@ if [[ "$FLOW" == *qnn* ]]; then
fi

if [[ "$FLOW" == *vulkan* ]]; then
# Setup swiftshader and Vulkan SDK which are required to build the Vulkan delegate
# Setup swiftshader and Vulkan SDK which are required to build the Vulkan delegate.
source .ci/scripts/setup-vulkan-linux-deps.sh

EXTRA_BUILD_ARGS+=" -DEXECUTORCH_BUILD_VULKAN=ON"
fi

if [[ "$FLOW" == *arm* ]]; then
# Setup ARM deps.
.ci/scripts/setup-arm-baremetal-tools.sh
fi

# We need the runner to test the built library.
PYTHON_EXECUTABLE=python CMAKE_ARGS="$EXTRA_BUILD_ARGS" .ci/scripts/setup-linux.sh --build-tool cmake --build-mode Release --editable true

Expand Down
84 changes: 84 additions & 0 deletions .github/workflows/_test_backend.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
name: Test Backend

on:
workflow_call:
inputs:
backend:
description: 'Backend to test (xnnpack, coreml, vulkan, qnn)'
required: true
type: string
flows:
description: 'JSON array of flows to test'
required: true
type: string
ref:
description: 'Git ref to checkout'
required: false
type: string
default: ${{ github.sha }}
timeout:
description: 'Job timeout in minutes'
required: false
type: number
default: 120
run-linux:
description: 'Whether to run Linux tests'
required: false
type: boolean
default: false
run-macos:
description: 'Whether to run macOS tests'
required: false
type: boolean
default: false
runner-linux:
description: 'Runner type for Linux jobs'
required: false
type: string
default: linux.4xlarge.memory

jobs:
test-backend-linux:
if: ${{ inputs.run-linux }}
strategy:
fail-fast: false
matrix:
flow: ${{ fromJSON(inputs.flows) }}
suite: [models, operators]

uses: pytorch/test-infra/.github/workflows/linux_job_v2.yml@release/2.9
with:
ref: ${{ inputs.ref }}
runner: ${{ inputs.runner-linux }}
docker-image: ci-image:executorch-ubuntu-22.04-clang12
submodules: recursive
timeout: ${{ inputs.timeout }}
upload-artifact: test-report-${{ matrix.flow }}-${{ matrix.suite }}
script: |
set -eux

source .ci/scripts/test_backend_linux.sh "${{ matrix.suite }}" "${{ matrix.flow }}" "${RUNNER_ARTIFACT_DIR}"

test-backend-macos:
if: ${{ inputs.run-macos }}
strategy:
fail-fast: false
matrix:
flow: ${{ fromJSON(inputs.flows) }}
suite: [models, operators]

uses: pytorch/test-infra/.github/workflows/macos_job.yml@release/2.9
with:
ref: ${{ inputs.ref }}
runner: macos-m1-stable
python-version: "3.12"
submodules: recursive
timeout: ${{ inputs.timeout }}
upload-artifact: test-report-${{ matrix.flow }}-${{ matrix.suite }}
script: |
set -eux

# This is needed to get the prebuilt PyTorch wheel from S3
${CONDA_RUN} --no-capture-output pip install awscli==1.37.21

source .ci/scripts/test_backend_macos.sh "${{ matrix.suite }}" "${{ matrix.flow }}" "${RUNNER_ARTIFACT_DIR}"
50 changes: 1 addition & 49 deletions .github/workflows/nightly.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ jobs:
repo-name: pytorch
branch: main
pin-folder: .ci/docker/ci_commit_pins
test-infra-ref: release/2.9
test-infra-ref: main
updatebot-token: ${{ secrets.UPDATEBOT_TOKEN }}
pytorchbot-token: ${{ secrets.GH_PYTORCHBOT_TOKEN }}

Expand All @@ -36,51 +36,3 @@ jobs:
uses: ./.github/workflows/_link_check.yml
with:
ref: ${{ github.sha }}

backend-test-linux:
uses: pytorch/test-infra/.github/workflows/linux_job_v2.yml@release/2.9
strategy:
fail-fast: false
matrix:
flow: [
qnn, qnn_16a16w, qnn_16a8w, qnn_16a4w, qnn_16a4w_block, qnn_8a8w,
vulkan, vulkan_static_int8_per_channel,
xnnpack, xnnpack_dynamic_int8_per_channel, xnnpack_static_int8_per_channel, xnnpack_static_int8_per_tensor
]
suite: [models, operators]
with:
ref: ${{ github.event_name == 'pull_request' && github.event.pull_request.head.sha || github.sha }}
runner: linux.4xlarge.memory
docker-image: ci-image:executorch-ubuntu-22.04-clang12
submodules: recursive
timeout: 120
upload-artifact: test-report-${{ matrix.flow }}-${{ matrix.suite }}
script: |
set -eux

source .ci/scripts/test_backend_linux.sh "${{ matrix.suite }}" "${{ matrix.flow }}" "${RUNNER_ARTIFACT_DIR}"

backend-test-macos:
uses: pytorch/test-infra/.github/workflows/macos_job.yml@release/2.9
permissions:
id-token: write
contents: read
strategy:
fail-fast: false
matrix:
flow: [coreml, coreml_static_int8]
suite: [models, operators]
with:
ref: ${{ github.event_name == 'pull_request' && github.event.pull_request.head.sha || github.sha }}
runner: macos-m1-stable
python-version: 3.12
submodules: recursive
timeout: 120
upload-artifact: test-report-${{ matrix.flow }}-${{ matrix.suite }}
script: |
set -eux

# This is needed to get the prebuilt PyTorch wheel from S3
${CONDA_RUN} --no-capture-output pip install awscli==1.37.21

source .ci/scripts/test_backend_macos.sh "${{ matrix.suite }}" "${{ matrix.flow }}" "${RUNNER_ARTIFACT_DIR}"
29 changes: 29 additions & 0 deletions .github/workflows/test-backend-arm.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
name: Test ARM Backend

on:
schedule:
- cron: 0 2 * * *
push:
branches:
- release/*
tags:
- ciflow/nightly/*
pull_request:
paths:
- .github/workflows/test-backend-arm.yml
- .github/workflows/_test_backend.yml
workflow_dispatch:

concurrency:
group: ${{ github.workflow }}--${{ github.event.pull_request.number || github.sha }}-${{ github.event_name == 'workflow_dispatch' }}
cancel-in-progress: true

jobs:
test-arm:
uses: ./.github/workflows/_test_backend.yml
with:
backend: arm
flows: '["arm_tosa"]'
ref: ${{ github.event_name == 'pull_request' && github.event.pull_request.head.sha || github.sha }}
timeout: 120
run-linux: true
29 changes: 29 additions & 0 deletions .github/workflows/test-backend-coreml.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
name: Test CoreML Backend

on:
schedule:
- cron: 0 2 * * *
push:
branches:
- release/*
tags:
- ciflow/nightly/*
pull_request:
paths:
- .github/workflows/test-backend-coreml.yml
- .github/workflows/_test_backend.yml
workflow_dispatch:

concurrency:
group: ${{ github.workflow }}--${{ github.event.pull_request.number || github.sha }}-${{ github.event_name == 'workflow_dispatch' }}
cancel-in-progress: true

jobs:
test-coreml:
uses: ./.github/workflows/_test_backend.yml
with:
backend: coreml
flows: '["coreml", "coreml_static_int8"]'
ref: ${{ github.event_name == 'pull_request' && github.event.pull_request.head.sha || github.sha }}
timeout: 120
run-macos: true
30 changes: 30 additions & 0 deletions .github/workflows/test-backend-qnn.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
name: Test QNN Backend

on:
schedule:
- cron: 0 2 * * *
push:
branches:
- release/*
tags:
- ciflow/nightly/*
pull_request:
paths:
- .github/workflows/test-backend-qnn.yml
- .github/workflows/_test_backend.yml
workflow_dispatch:

concurrency:
group: ${{ github.workflow }}--${{ github.event.pull_request.number || github.sha }}-${{ github.event_name == 'workflow_dispatch' }}
cancel-in-progress: true

jobs:
test-qnn:
uses: ./.github/workflows/_test_backend.yml
with:
backend: qnn
flows: '["qnn", "qnn_16a16w", "qnn_16a8w", "qnn_16a4w", "qnn_16a4w_block", "qnn_8a8w"]'
ref: ${{ github.event_name == 'pull_request' && github.event.pull_request.head.sha || github.sha }}
timeout: 120
run-linux: true
runner-linux: linux.8xlarge.memory
29 changes: 29 additions & 0 deletions .github/workflows/test-backend-vulkan.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
name: Test Vulkan Backend

on:
schedule:
- cron: 0 2 * * *
push:
branches:
- release/*
tags:
- ciflow/nightly/*
pull_request:
paths:
- .github/workflows/test-backend-vulkan.yml
- .github/workflows/_test_backend.yml
workflow_dispatch:

concurrency:
group: ${{ github.workflow }}--${{ github.event.pull_request.number || github.sha }}-${{ github.event_name == 'workflow_dispatch' }}
cancel-in-progress: true

jobs:
test-vulkan:
uses: ./.github/workflows/_test_backend.yml
with:
backend: vulkan
flows: '["vulkan", "vulkan_static_int8_per_channel"]'
ref: ${{ github.event_name == 'pull_request' && github.event.pull_request.head.sha || github.sha }}
timeout: 120
run-linux: true
29 changes: 29 additions & 0 deletions .github/workflows/test-backend-xnnpack.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
name: Test XNNPACK Backend

on:
schedule:
- cron: 0 2 * * *
push:
branches:
- release/*
tags:
- ciflow/nightly/*
pull_request:
paths:
- .github/workflows/test-backend-xnnpack.yml
- .github/workflows/_test_backend.yml
workflow_dispatch:

concurrency:
group: ${{ github.workflow }}--${{ github.event.pull_request.number || github.sha }}-${{ github.event_name == 'workflow_dispatch' }}
cancel-in-progress: true

jobs:
test-xnnpack:
uses: ./.github/workflows/_test_backend.yml
with:
backend: xnnpack
flows: '["xnnpack", "xnnpack_dynamic_int8_per_channel", "xnnpack_static_int8_per_channel", "xnnpack_static_int8_per_tensor"]'
ref: ${{ github.event_name == 'pull_request' && github.event.pull_request.head.sha || github.sha }}
timeout: 120
run-linux: true
20 changes: 19 additions & 1 deletion backends/test/suite/flow.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import logging

from dataclasses import dataclass
from dataclasses import dataclass, field
from typing import Callable

from executorch.backends.test.harness import Tester
Expand Down Expand Up @@ -35,6 +35,15 @@ class TestFlow:
is_delegated: bool = True
""" Indicates whether the flow is expected to generate CALL_DELEGATE nodes. """

skip_patterns: list[str] = field(default_factory=lambda: [])
""" Tests with names containing any substrings in this list are skipped. """

supports_serialize: bool = True
""" True if the test flow supports the Serialize stage. """

def should_skip_test(self, test_name: str) -> bool:
return any(pattern in test_name for pattern in self.skip_patterns)


def all_flows() -> dict[str, TestFlow]:
flows = []
Expand Down Expand Up @@ -109,4 +118,13 @@ def all_flows() -> dict[str, TestFlow]:
except Exception as e:
logger.info(f"Skipping QNN flow registration: {e}")

try:
from executorch.backends.test.suite.flows.arm import ARM_TOSA_FLOW

flows += [
ARM_TOSA_FLOW,
]
except Exception as e:
logger.info(f"Skipping ARM flow registration: {e}")

return {f.name: f for f in flows if f is not None}
24 changes: 24 additions & 0 deletions backends/test/suite/flows/arm.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
from executorch.backends.arm.test import common
from executorch.backends.arm.test.tester.arm_tester import ArmTester
from executorch.backends.test.suite.flow import TestFlow


def _create_arm_tester_tosa_fp(*args, **kwargs) -> ArmTester:
kwargs["compile_spec"] = common.get_tosa_compile_spec(tosa_spec="TOSA-1.0+FP")

return ArmTester(
*args,
**kwargs,
)


def _create_tosa_flow() -> TestFlow:
return TestFlow(
"arm_tosa",
backend="arm",
tester_factory=_create_arm_tester_tosa_fp,
supports_serialize=False,
)


ARM_TOSA_FLOW = _create_tosa_flow()
1 change: 1 addition & 0 deletions backends/test/suite/flows/coreml.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ def _create_coreml_flow(
CoreMLTester, minimum_deployment_target=minimum_deployment_target
),
quantize=quantize,
skip_patterns=["test_argmin", "test_argmax"],
)


Expand Down
1 change: 1 addition & 0 deletions backends/test/suite/flows/vulkan.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ def _create_vulkan_flow_base(
tester_factory=VulkanTester,
quantize=quantize_stage_factory is not None,
quantize_stage_factory=quantize_stage_factory,
skip_patterns=["float16", "float64"], # Not supported in swiftshader
)


Expand Down
Loading
Loading