diff --git a/.github/workflows/build-wheels-windows.yml b/.github/workflows/build-wheels-windows.yml index a269aea2604..6034974fc35 100644 --- a/.github/workflows/build-wheels-windows.yml +++ b/.github/workflows/build-wheels-windows.yml @@ -1,3 +1,78 @@ +# name: Build Windows Wheels + +# on: +# pull_request: +# push: +# branches: +# - nightly +# - main +# - release/* +# tags: +# # NOTE: Binary build pipelines should only get triggered on release candidate builds +# # Release candidate tags look like: v1.11.0-rc1 +# - v[0-9]+.[0-9]+.[0-9]+-rc[0-9]+ +# workflow_dispatch: + +# permissions: +# id-token: write +# contents: read + + +# jobs: +# build_x64: +# strategy: +# matrix: +# python-version: ["3.12"] +# include: +# - repository: pytorch/vision +# smoke-test-script: test/smoke_test.py +# package-name: torchvision +# iswinarm64: true +# name: ${{ matrix.repository }}-test-x64 +# uses: alinpahontu2912/test-infra/.github/workflows/build_wheels_windows.yml@x64windows_test +# with: +# repository: ${{ matrix.repository }} +# ref: "" +# test-infra-repository: alinpahontu2912/test-infra +# test-infra-ref: x64windows_test +# package-name: ${{ matrix.package-name }} +# smoke-test-script: ${{ matrix.smoke-test-script }} + +# generate-matrix: +# uses: alinpahontu2912/test-infra/.github/workflows/generate_binary_build_matrix.yml@main +# with: +# package-type: wheel +# os: windows +# test-infra-repository: alinpahontu2912/test-infra +# test-infra-ref: x64windows_test +# with-xpu: enable + +# build: +# needs: generate-matrix +# strategy: +# fail-fast: false +# matrix: +# include: +# - repository: pytorch/vision +# pre-script: packaging/pre_build_script.sh +# env-script: packaging/windows/internal/vc_env_helper.bat +# post-script: "python packaging/wheel/relocate.py" +# smoke-test-script: test/smoke_test.py +# package-name: torchvision +# name: ${{ matrix.repository }} +# uses: alinpahontu2912/test-infra/.github/workflows/build_wheels_windows.yml@x64windows_test +# with: +# repository: ${{ matrix.repository }} +# ref: "" +# test-infra-repository: alinpahontu2912/test-infra +# test-infra-ref: x64windows_test +# build-matrix: ${{ needs.generate-matrix.outputs.matrix }} +# pre-script: ${{ matrix.pre-script }} +# env-script: ${{ matrix.env-script }} +# post-script: ${{ matrix.post-script }} +# package-name: ${{ matrix.package-name }} +# smoke-test-script: ${{ matrix.smoke-test-script }} +# trigger-event: ${{ github.event_name }} name: Build Windows Wheels on: @@ -51,4 +126,4 @@ jobs: post-script: ${{ matrix.post-script }} package-name: ${{ matrix.package-name }} smoke-test-script: ${{ matrix.smoke-test-script }} - trigger-event: ${{ github.event_name }} + trigger-event: ${{ github.event_name }} \ No newline at end of file diff --git a/.github/workflows/build_wheel_windows_arm64.yml b/.github/workflows/build_wheel_windows_arm64.yml new file mode 100644 index 00000000000..67ef54f4bfe --- /dev/null +++ b/.github/workflows/build_wheel_windows_arm64.yml @@ -0,0 +1,51 @@ +name: Build Windows Arm64 Torchvision Wheel + +on: + pull_request: null + push: + branches: + - nightly + - main + - release/* + tags: + - v[0-9]+.[0-9]+.[0-9]+-rc[0-9]+ + workflow_dispatch: + inputs: + build_type: + description: Build type + required: true + type: choice + options: + - Release + # - Debug not available + default: Release + repository_name: + description: Torchvision repository (username/repo) + required: false + type: string + default: pytorch/vision + repository_branch: + description: Repository branch + required: false + type: string + default: main + +permissions: + id-token: write + contents: read + +jobs: + trigger-test-infra: + strategy: + matrix: + python_version: ["3.12"] # only one for now + runs-on: "windows-11-arm64" + + steps: + - name: Trigger Test Infra workflow + uses: alinpahontu2912/test-infra/.github/workflows/build_wheels_windows_arm64.yml@winarm64_wheels + with: + python_version: ${{ matrix.python_version }} + build_type: ${{ inputs.build_type }} + repository_name: ${{ inputs.repository_name }} + repository_branch: ${{ inputs.repository_branch }} diff --git a/.github/workflows/build_wheel_windows_x64_test.yml b/.github/workflows/build_wheel_windows_x64_test.yml new file mode 100644 index 00000000000..a89c5cd2b30 --- /dev/null +++ b/.github/workflows/build_wheel_windows_x64_test.yml @@ -0,0 +1,55 @@ +name: Build Windows Wheels X64 Test + +on: + pull_request: + push: + branches: + - nightly + - main + - release/* + tags: + # NOTE: Binary build pipelines should only get triggered on release candidate builds + # Release candidate tags look like: v1.11.0-rc1 + - v[0-9]+.[0-9]+.[0-9]+-rc[0-9]+ + workflow_dispatch: + +permissions: + id-token: write + contents: read + + +jobs: + generate-matrix: + uses: alinpahontu2912/test-infra/.github/workflows/generate_binary_build_matrix.yml@main + with: + package-type: wheel + os: windows-arm64 + test-infra-repository: alinpahontu2912/test-infra + test-infra-ref: x64windows_test + with-xpu: enable + + + build: + needs: generate-matrix + strategy: + fail-fast: false + matrix: + include: + - repository: pytorch/vision + smoke-test-script: test/smoke_test.py + pre-script: packaging/pre_build_script_arm64.sh + package-name: torchvision + architecture: "arm64" + name: ${{ matrix.repository }} + uses: alinpahontu2912/test-infra/.github/workflows/build_wheels_windows.yml@x64windows_test + with: + repository: ${{ matrix.repository }} + ref: "" + test-infra-repository: alinpahontu2912/test-infra + test-infra-ref: x64windows_test + pre-script: ${{ matrix.pre-script }} + build-matrix: ${{ needs.generate-matrix.outputs.matrix }} + package-name: ${{ matrix.package-name }} + smoke-test-script: ${{ matrix.smoke-test-script }} + trigger-event: ${{ github.event_name }} + architecture: ${{ matrix.architecture }} diff --git a/packaging/pre_build_script_arm64.sh b/packaging/pre_build_script_arm64.sh index f7841aa21e5..17c83912f8c 100644 --- a/packaging/pre_build_script_arm64.sh +++ b/packaging/pre_build_script_arm64.sh @@ -6,13 +6,12 @@ echo "Building vision dependencies and wheel started." export SRC_PATH="$GITHUB_WORKSPACE/$SRC_DIR" export CMAKE_BUILD_TYPE="$BUILD_TYPE" export VCVARSALL_PATH="$DEPENDENCIES_DIR/VSBuildTools/VC/Auxiliary/Build/vcvarsall.bat" -export CONDA_PREFIX="$DEPENDENCIES_DIR" -export PATH="$PATH:$CONDA_PREFIX/Library/bin" -export DISTUTILS_USE_SDK=1 -export TRIPLET_FILE="triplets/arm64-windows.cmake" +export TRIPLET_FILE="triplets/x64-windows.cmake" export PYTORCH_VERSION="$PYTORCH_VERSION" export CHANNEL="$CHANNEL" +echo "channel: $CHANNEL" + # Dependencies mkdir -p "$DOWNLOADS_DIR" mkdir -p "$DEPENDENCIES_DIR" @@ -25,45 +24,59 @@ git clone https://github.com/microsoft/vcpkg.git cd vcpkg || exit ./bootstrap-vcpkg.sh -# Set vcpkg to only build release packages +# # Set vcpkg to only build release packages echo "set(VCPKG_BUILD_TYPE release)" >> "$TRIPLET_FILE" # Install dependencies using vcpkg -./vcpkg install libjpeg-turbo:arm64-windows --x-install-root="$DEPENDENCIES_DIR" -./vcpkg install libwebp:arm64-windows --x-install-root="$DEPENDENCIES_DIR" -./vcpkg install libpng[tools]:arm64-windows --x-install-root="$DEPENDENCIES_DIR" +./vcpkg install libjpeg-turbo:x64-windows --x-install-root="$DEPENDENCIES_DIR" +./vcpkg install libwebp:x64-windows --x-install-root="$DEPENDENCIES_DIR" +./vcpkg install libpng[tools]:x64-windows --x-install-root="$DEPENDENCIES_DIR" # Copy files using cp -cp "$DEPENDENCIES_DIR/arm64-windows/lib/libpng16.lib" "$DEPENDENCIES_DIR/arm64-windows/lib/libpng.lib" -cp "$DEPENDENCIES_DIR/arm64-windows/bin/libpng16.dll" "$DEPENDENCIES_DIR/arm64-windows/bin/libpng.dll" -cp "$DEPENDENCIES_DIR/arm64-windows/bin/libpng16.pdb" "$DEPENDENCIES_DIR/arm64-windows/bin/libpng.pdb" +cp "$DEPENDENCIES_DIR/x64-windows/lib/libpng16.lib" "$DEPENDENCIES_DIR/x64-windows/lib/libpng.lib" +cp "$DEPENDENCIES_DIR/x64-windows/bin/libpng16.dll" "$DEPENDENCIES_DIR/x64-windows/bin/libpng.dll" +cp "$DEPENDENCIES_DIR/x64-windows/bin/libpng16.pdb" "$DEPENDENCIES_DIR/x64-windows/bin/libpng.pdb" mkdir -p "$DEPENDENCIES_DIR/Library/" -cp -r "$DEPENDENCIES_DIR/arm64-windows/"* "$DEPENDENCIES_DIR/Library/" +cp -r "$DEPENDENCIES_DIR/x64-windows/"* "$DEPENDENCIES_DIR/Library/" + cp -r "$DEPENDENCIES_DIR/Library/tools/libpng/"* "$DEPENDENCIES_DIR/Library/bin/" cp -r "$DEPENDENCIES_DIR/Library/bin/"* "$SRC_PATH/torchvision" # Source directory cd "$SRC_PATH" || exit +ls -la "$SRC_PATH" + # Create virtual environment python -m pip install --upgrade pip python -m venv .venv echo "*" > .venv/.gitignore source .venv/Scripts/activate +which python + +pip list + +ls -l "$SRC_PATH/.venv/" + +ls -la "$SRC_PATH" + # Install dependencies pip install numpy==2.2.3 if [ "$CHANNEL" = "release" ]; then echo "Installing latest stable version of PyTorch." - # TODO: update when arm64 torch available on pypi - pip3 install --pre torch --index-url https://download.pytorch.org/whl/torch/ + + pip3 install torch elif [ "$CHANNEL" = "test" ]; then echo "Installing PyTorch version $PYTORCH_VERSION." - pip3 install --pre torch=="$PYTORCH_VERSION" --index-url https://download.pytorch.org/whl/test + pip3 install torch=="$PYTORCH_VERSION" + else echo "CHANNEL is not set, installing PyTorch from nightly." pip3 install --pre torch --index-url https://download.pytorch.org/whl/nightly/cpu fi +pip list + echo "Dependencies install finished successfully."