Skip to content

Commit

Permalink
2024-10-30 nightly release (db38bcc)
Browse files Browse the repository at this point in the history
  • Loading branch information
pytorchbot committed Oct 30, 2024
1 parent 23327e9 commit c464a71
Show file tree
Hide file tree
Showing 35 changed files with 1,208 additions and 262 deletions.
56 changes: 11 additions & 45 deletions .github/workflows/pull.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,6 @@ jobs:
name: test-setup-linux-gcc
uses: pytorch/test-infra/.github/workflows/linux_job.yml@main
strategy:
matrix:
include:
- build-tool: cmake
fail-fast: false
with:
runner: linux.2xlarge
Expand All @@ -50,7 +47,7 @@ jobs:
CONDA_ENV=$(conda env list --json | jq -r ".envs | .[-1]")
conda activate "${CONDA_ENV}"
BUILD_TOOL=${{ matrix.build-tool }}
BUILD_TOOL="cmake"
PYTHON_EXECUTABLE=python bash .ci/scripts/setup-linux.sh "${BUILD_TOOL}"
# Build and test ExecuTorch with the add model on portable backend.
Expand Down Expand Up @@ -89,20 +86,11 @@ jobs:
strategy:
matrix:
dtype: [fp32]
build-tool: [buck2, cmake]
mode: [portable, xnnpack+custom, xnnpack+custom+qe]
include:
- dtype: bf16
build-tool: cmake
mode: portable
- dtype: bf16
build-tool: buck2
mode: portable
- dtype: bf16
build-tool: cmake
mode: custom
- dtype: bf16
build-tool: buck2
mode: custom
fail-fast: false
with:
Expand All @@ -117,11 +105,11 @@ jobs:
conda activate "${CONDA_ENV}"
DTYPE=${{ matrix.dtype }}
BUILD_TOOL=${{ matrix.build-tool }}
BUILD_TOOL="cmake"
MODE=${{ matrix.mode }}
# Setup executorch
PYTHON_EXECUTABLE=python bash .ci/scripts/setup-linux.sh buck2
PYTHON_EXECUTABLE=python bash .ci/scripts/setup-linux.sh "${BUILD_TOOL}"
# Install requirements for export_llama
PYTHON_EXECUTABLE=python bash examples/models/llama/install_requirements.sh
# Test llama2
Expand All @@ -131,9 +119,6 @@ jobs:
name: test-llama-runner-linux-android
uses: pytorch/test-infra/.github/workflows/linux_job.yml@main
strategy:
matrix:
include:
- build-tool: cmake
fail-fast: false
with:
runner: linux.2xlarge
Expand All @@ -146,18 +131,14 @@ jobs:
CONDA_ENV=$(conda env list --json | jq -r ".envs | .[-1]")
conda activate "${CONDA_ENV}"
BUILD_TOOL=${{ matrix.build-tool }}
BUILD_TOOL="cmake"
PYTHON_EXECUTABLE=python \
bash .ci/scripts/build_llama_android.sh "${BUILD_TOOL}"
test-custom-ops-linux:
name: test-custom-ops-linux
uses: pytorch/test-infra/.github/workflows/linux_job.yml@main
strategy:
matrix:
include:
- build-tool: buck2
- build-tool: cmake
fail-fast: false
with:
runner: linux.2xlarge
Expand All @@ -170,7 +151,7 @@ jobs:
CONDA_ENV=$(conda env list --json | jq -r ".envs | .[-1]")
conda activate "${CONDA_ENV}"
BUILD_TOOL=${{ matrix.build-tool }}
BUILD_TOOL="cmake"
PYTHON_EXECUTABLE=python bash .ci/scripts/setup-linux.sh "${BUILD_TOOL}"
# Test custom ops
PYTHON_EXECUTABLE=python bash examples/portable/custom_ops/test_custom_ops.sh "${BUILD_TOOL}"
Expand All @@ -179,10 +160,6 @@ jobs:
name: test-selective-build-linux
uses: pytorch/test-infra/.github/workflows/linux_job.yml@main
strategy:
matrix:
include:
- build-tool: buck2
- build-tool: cmake
fail-fast: false
with:
runner: linux.2xlarge
Expand All @@ -195,7 +172,7 @@ jobs:
CONDA_ENV=$(conda env list --json | jq -r ".envs | .[-1]")
conda activate "${CONDA_ENV}"
BUILD_TOOL=${{ matrix.build-tool }}
BUILD_TOOL="cmake"
PYTHON_EXECUTABLE=python bash .ci/scripts/setup-linux.sh "${BUILD_TOOL}"
# Test selective build
PYTHON_EXECUTABLE=python bash examples/selective_build/test_selective_build.sh "${BUILD_TOOL}"
Expand Down Expand Up @@ -235,9 +212,6 @@ jobs:
name: test-quantized-aot-lib-linux
uses: pytorch/test-infra/.github/workflows/linux_job.yml@main
strategy:
matrix:
include:
- build-tool: cmake
fail-fast: false
with:
runner: linux.2xlarge
Expand All @@ -250,17 +224,14 @@ jobs:
CONDA_ENV=$(conda env list --json | jq -r ".envs | .[-1]")
conda activate "${CONDA_ENV}"
BUILD_TOOL=${{ matrix.build-tool }}
BUILD_TOOL="cmake"
PYTHON_EXECUTABLE=python bash .ci/scripts/setup-linux.sh "${BUILD_TOOL}"
PYTHON_EXECUTABLE=python bash examples/xnnpack/quantization/test_quantize.sh "${BUILD_TOOL}" mv2
test-pybind-build-linux:
name: test-pybind-build-linux
uses: pytorch/test-infra/.github/workflows/linux_job.yml@main
strategy:
matrix:
include:
- build-tool: cmake
fail-fast: false
with:
runner: linux.2xlarge
Expand All @@ -274,7 +245,7 @@ jobs:
conda activate "${CONDA_ENV}"
# build module for executorch.extension.pybindings.portable_lib
BUILD_TOOL=${{ matrix.build-tool }}
BUILD_TOOL="cmake"
PYTHON_EXECUTABLE=python \
EXECUTORCH_BUILD_XNNPACK=ON \
EXECUTORCH_BUILD_PYBIND=ON \
Expand Down Expand Up @@ -357,10 +328,6 @@ jobs:

unittest-arm:
uses: pytorch/test-infra/.github/workflows/linux_job.yml@main
strategy:
matrix:
include:
- build-tool: buck2
with:
runner: linux.2xlarge
docker-image: executorch-ubuntu-22.04-arm-sdk
Expand All @@ -374,7 +341,7 @@ jobs:
CONDA_ENV=$(conda env list --json | jq -r ".envs | .[-1]")
conda activate "${CONDA_ENV}"
BUILD_TOOL=${{ matrix.build-tool }}
BUILD_TOOL="cmake"
# Setup MacOS dependencies as there is no Docker support on MacOS atm
PYTHON_EXECUTABLE=python \
Expand All @@ -396,7 +363,6 @@ jobs:
strategy:
matrix:
dtype: [fp32]
build-tool: [cmake]
mode: [qnn]
fail-fast: false
with:
Expand All @@ -411,14 +377,14 @@ jobs:
conda activate "${CONDA_ENV}"
DTYPE=${{ matrix.dtype }}
BUILD_TOOL=${{ matrix.build-tool }}
BUILD_TOOL="cmake"
MODE=${{ matrix.mode }}
PYTHON_EXECUTABLE=python bash .ci/scripts/setup-qnn-deps.sh
PYTHON_EXECUTABLE=python bash .ci/scripts/build-qnn-sdk.sh
# Setup executorch
PYTHON_EXECUTABLE=python bash .ci/scripts/setup-linux.sh buck2
PYTHON_EXECUTABLE=python bash .ci/scripts/setup-linux.sh "${BUILD_TOOL}"
# Install requirements for export_llama
PYTHON_EXECUTABLE=python bash examples/models/llama/install_requirements.sh
# Test llama2
Expand Down
1 change: 1 addition & 0 deletions backends/arm/arm_partitioner.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ def is_node_supported(self, submodules, node: torch.fx.Node) -> bool:
exir_ops.edge.aten.relu.default,
exir_ops.edge.aten.rsqrt.default,
exir_ops.edge.aten._softmax.default,
exir_ops.edge.aten.select_copy.int,
exir_ops.edge.aten._log_softmax.default,
exir_ops.edge.aten.slice_copy.Tensor,
exir_ops.edge.aten.sub.Tensor,
Expand Down
1 change: 1 addition & 0 deletions backends/arm/operators/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
op_relu,
op_repeat,
op_rsqrt,
op_select,
op_sigmoid,
op_slice,
op_squeeze,
Expand Down
69 changes: 69 additions & 0 deletions backends/arm/operators/op_select.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
# Copyright 2024 Arm Limited and/or its affiliates.
#
# This source code is licensed under the BSD-style license found in the
# LICENSE file in the root directory of this source tree.

from typing import List

import serializer.tosa_serializer as ts
from executorch.backends.arm.operators.node_visitor import (
NodeVisitor,
register_node_visitor,
)

from executorch.backends.arm.tosa_mapping import TosaArg

from executorch.backends.arm.tosa_utils import build_reshape, tosa_shape
from serializer.tosa_serializer import TosaOp
from torch.fx import Node


@register_node_visitor
class SelectVisitor(NodeVisitor):
target = "aten.select_copy.int"

def __init__(self, *args):
super().__init__(*args)

def define_node(
self,
node: Node,
tosa_graph: ts.TosaSerializer,
inputs: List[TosaArg],
output: TosaArg,
is_quant_node: bool,
) -> None:

assert len(inputs) == 3
input_node, dim, index = inputs
shape = input_node.shape
rank = len(shape)

dim = dim.number % rank if dim.number < 0 else dim.number
index = index.number % rank if index.number < 0 else index.number

# For aten.select_copy, the output will be rank[input_shape - 1]
# For TOSA rank(in) == rank(out).
# Add an intermediate with the same rank
expanded_shape = tuple(1 if i == dim else shape[i] for i in range(rank))
expanded_shape = tosa_shape(expanded_shape, input_node.dim_order)

output_reshaped = tosa_graph.addIntermediate(
expanded_shape, ts.DType.INT8 if is_quant_node else output.dtype
)

attr_slice = ts.TosaSerializerAttribute()

start_attr = [index if i == dim else 0 for i in input_node.dim_order]
size_attr = [
1 if i == dim else input_node.shape[i] for i in input_node.dim_order
]

attr_slice.SliceAttribute(start_attr, size_attr)

tosa_graph.addOperator(
TosaOp.Op().SLICE, [input_node.name], [output_reshaped.name], attr_slice
)

# Reshape back to original rank of output.
build_reshape(tosa_graph, output_reshaped.name, output.shape, output.name)
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,8 @@
# torch.ops.aten.view_as_real.default,
# torch.ops.aten.view_as_real_copy.default,
torch.ops.aten.view_copy.default,
torch.ops.aten.select.int,
torch.ops.aten.select_copy.int,
torch.ops.aten.slice.Tensor,
torch.ops.aten.slice_copy.Tensor,
# 'concat' should be handled separately as it has a sequence of inputs and
Expand Down
Loading

0 comments on commit c464a71

Please sign in to comment.