mirror of
https://github.com/saymrwulf/pytorch.git
synced 2026-05-14 20:57:59 +00:00
[CI][IOS] Add a arm64 ios job for Metal (#46646)
Summary: Pull Request resolved: https://github.com/pytorch/pytorch/pull/46646 Test Plan: Imported from OSS Reviewed By: seemethere, linbinyu Differential Revision: D24459597 Pulled By: xta0 fbshipit-source-id: e93a3a26897614c66768804c71658928cd26ede7
This commit is contained in:
parent
344abd56f9
commit
bf1ea14fbc
5 changed files with 34 additions and 6 deletions
|
|
@ -1,16 +1,16 @@
|
|||
from cimodel.data.simple.util.versions import MultiPartVersion
|
||||
|
||||
import cimodel.lib.miniutils as miniutils
|
||||
|
||||
XCODE_VERSION = MultiPartVersion([12, 0, 0])
|
||||
|
||||
|
||||
class ArchVariant:
|
||||
def __init__(self, name, is_custom=False):
|
||||
def __init__(self, name, custom_build_name=""):
|
||||
self.name = name
|
||||
self.is_custom = is_custom
|
||||
self.custom_build_name = custom_build_name
|
||||
|
||||
def render(self):
|
||||
extra_parts = ["custom"] if self.is_custom else []
|
||||
extra_parts = [self.custom_build_name] if len(self.custom_build_name) > 0 else []
|
||||
return "_".join([self.name] + extra_parts)
|
||||
|
||||
|
||||
|
|
@ -63,7 +63,8 @@ class IOSJob:
|
|||
WORKFLOW_DATA = [
|
||||
IOSJob(XCODE_VERSION, ArchVariant("x86_64"), is_org_member_context=False),
|
||||
IOSJob(XCODE_VERSION, ArchVariant("arm64")),
|
||||
IOSJob(XCODE_VERSION, ArchVariant("arm64", True), extra_props={"op_list": "mobilenetv2.yaml"}),
|
||||
IOSJob(XCODE_VERSION, ArchVariant("arm64", "metal"), extra_props={"use_metal": miniutils.quote(str(int(True)))}),
|
||||
IOSJob(XCODE_VERSION, ArchVariant("arm64", "custom"), extra_props={"op_list": "mobilenetv2.yaml"}),
|
||||
]
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -302,11 +302,15 @@ pytorch_ios_params: &pytorch_ios_params
|
|||
op_list:
|
||||
type: string
|
||||
default: ""
|
||||
use_metal:
|
||||
type: string
|
||||
default: "0"
|
||||
environment:
|
||||
BUILD_ENVIRONMENT: << parameters.build_environment >>
|
||||
IOS_ARCH: << parameters.ios_arch >>
|
||||
IOS_PLATFORM: << parameters.ios_platform >>
|
||||
SELECTED_OP_LIST: << parameters.op_list >>
|
||||
USE_PYTORCH_METAL: << parameters.use_metal >>
|
||||
|
||||
pytorch_windows_params: &pytorch_windows_params
|
||||
parameters:
|
||||
|
|
@ -1584,6 +1588,7 @@ jobs:
|
|||
chmod a+x ${PROJ_ROOT}/scripts/build_ios.sh
|
||||
echo "IOS_ARCH: ${IOS_ARCH}"
|
||||
echo "IOS_PLATFORM: ${IOS_PLATFORM}"
|
||||
echo "USE_PYTORCH_METAL": "${USE_METAL}"
|
||||
|
||||
#check the custom build flag
|
||||
echo "SELECTED_OP_LIST: ${SELECTED_OP_LIST}"
|
||||
|
|
@ -1592,6 +1597,9 @@ jobs:
|
|||
fi
|
||||
export IOS_ARCH=${IOS_ARCH}
|
||||
export IOS_PLATFORM=${IOS_PLATFORM}
|
||||
if [ ${IOS_PLATFORM} != "SIMULATOR" ]; then
|
||||
export USE_PYTORCH_METAL=${USE_METAL}
|
||||
fi
|
||||
unbuffer ${PROJ_ROOT}/scripts/build_ios.sh 2>&1 | ts
|
||||
- run:
|
||||
name: Run Build Test
|
||||
|
|
@ -6983,6 +6991,13 @@ workflows:
|
|||
ios_arch: arm64
|
||||
ios_platform: OS
|
||||
name: pytorch_ios_12_0_0_arm64_build
|
||||
- pytorch_ios_build:
|
||||
build_environment: pytorch-ios-12.0.0-arm64_metal_build
|
||||
context: org-member
|
||||
ios_arch: arm64
|
||||
ios_platform: OS
|
||||
name: pytorch_ios_12_0_0_arm64_metal_build
|
||||
use_metal: "1"
|
||||
- pytorch_ios_build:
|
||||
build_environment: pytorch-ios-12.0.0-arm64_custom_build
|
||||
context: org-member
|
||||
|
|
|
|||
|
|
@ -36,11 +36,15 @@ pytorch_ios_params: &pytorch_ios_params
|
|||
op_list:
|
||||
type: string
|
||||
default: ""
|
||||
use_metal:
|
||||
type: string
|
||||
default: "0"
|
||||
environment:
|
||||
BUILD_ENVIRONMENT: << parameters.build_environment >>
|
||||
IOS_ARCH: << parameters.ios_arch >>
|
||||
IOS_PLATFORM: << parameters.ios_platform >>
|
||||
SELECTED_OP_LIST: << parameters.op_list >>
|
||||
USE_PYTORCH_METAL: << parameters.use_metal >>
|
||||
|
||||
pytorch_windows_params: &pytorch_windows_params
|
||||
parameters:
|
||||
|
|
|
|||
|
|
@ -439,6 +439,7 @@
|
|||
chmod a+x ${PROJ_ROOT}/scripts/build_ios.sh
|
||||
echo "IOS_ARCH: ${IOS_ARCH}"
|
||||
echo "IOS_PLATFORM: ${IOS_PLATFORM}"
|
||||
echo "USE_PYTORCH_METAL": "${USE_METAL}"
|
||||
|
||||
#check the custom build flag
|
||||
echo "SELECTED_OP_LIST: ${SELECTED_OP_LIST}"
|
||||
|
|
@ -447,6 +448,9 @@
|
|||
fi
|
||||
export IOS_ARCH=${IOS_ARCH}
|
||||
export IOS_PLATFORM=${IOS_PLATFORM}
|
||||
if [ ${IOS_PLATFORM} != "SIMULATOR" ]; then
|
||||
export USE_PYTORCH_METAL=${USE_METAL}
|
||||
fi
|
||||
unbuffer ${PROJ_ROOT}/scripts/build_ios.sh 2>&1 | ts
|
||||
- run:
|
||||
name: Run Build Test
|
||||
|
|
|
|||
|
|
@ -92,9 +92,13 @@ CMAKE_ARGS+=("-DUSE_LEVELDB=OFF")
|
|||
CMAKE_ARGS+=("-DUSE_MPI=OFF")
|
||||
CMAKE_ARGS+=("-DUSE_NUMPY=OFF")
|
||||
CMAKE_ARGS+=("-DUSE_NNPACK=OFF")
|
||||
CMAKE_ARGS+=("-DUSE_PYTORCH_METAL=OFF")
|
||||
CMAKE_ARGS+=("-DUSE_MKLDNN=OFF")
|
||||
|
||||
# Metal
|
||||
if [ "${USE_PYTORCH_METAL:-}" == "1" ]; then
|
||||
CMAKE_ARGS+=("-DUSE_PYTORCH_METAL=ON")
|
||||
fi
|
||||
|
||||
# pthreads
|
||||
CMAKE_ARGS+=("-DCMAKE_THREAD_LIBS_INIT=-lpthread")
|
||||
CMAKE_ARGS+=("-DCMAKE_HAVE_THREADS_LIBRARY=1")
|
||||
|
|
|
|||
Loading…
Reference in a new issue