Skip to content

Attempt 1 at windows build. #1

Attempt 1 at windows build.

Attempt 1 at windows build. #1

# Based on version from @dfalbel in https://github.com/r-xla/pjrt-builds

Check failure on line 1 in .github/workflows/windows_amd64_build.yaml

View workflow run for this annotation

GitHub Actions / .github/workflows/windows_amd64_build.yaml

Invalid workflow file

(Line: 12, Col: 5): Required property is missing: runs-on
on:
workflow_dispatch:
name: Build PJRT
permissions:
contents: write
jobs:
build:
name: "Build Windows (amd64) Plugin"
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
defaults:
run:
shell:
bash
# artifact_name: pjrt_cpu.dll
# target: pjrt_c_api_cpu_plugin.so
# setup: |
steps:
- uses: actions/checkout@v4
- run: |
choco install llvm -y
# Remove MSVC from PATH to force clang usage
echo "PATH=$(echo $PATH | tr ':' '\n' | grep -v 'Microsoft Visual Studio' | grep -v 'VC/Tools/MSVC' | tr '\n' ':')" >> $GITHUB_ENV
- run: |
git clone https://github.com/openxla/xla
cd xla
HASH=$(cat ../XLA_COMMIT_HASH.txt)
echo "Checking out XLA at commit: $HASH"
git checkout $HASH
- run: |
BUILDER_VERSION="$(cat BUILDER_VERSION.txt)"
MAJOR=$(grep -E '#define PJRT_API_MAJOR' "${PJRT_C_API_HEADER}" | awk '{print $3}')
MINOR=$(grep -E '#define PJRT_API_MINOR' "${PJRT_C_API_HEADER}" | awk '{print $3}')
echo "Building PJRT CPU plugin for version ${MAJOR}.${MINOR} (to be used in go-xla as v${MAJOR}.${MINOR}.${BUILDER_VERSION})"
echo "RELEASE=v${MAJOR}.${MINOR}.${BUILDER_VERSION}" >> $GITHUB_ENV
- run: |
cd xla
python configure.py --backend=cpu --os=windows --host_compiler=clang --clang_path=C:/PROGRA~1/LLVM/bin/clang.exe
cat xla_configure.bazelrc
- name: Fix Windows paths in bazelrc
run: |
cd xla
# Fix Windows paths for Bazel compatibility
# Replace "Program Files" with short name (handles both / and \ separators)
sed -i 's|Program Files|PROGRA~1|g' xla_configure.bazelrc
# Convert all backslashes to forward slashes
sed -i 's|\\|/|g' xla_configure.bazelrc
cat xla_configure.bazelrc
echo "Applying dllexport patch ---------------"
git apply ../patches/windows/export.patch
- run: |
cd xla
printf "\nStarting XLA bazel build:\n"
bazel build \
--config=clang_local \
--action_env=CC=C:/PROGRA~1/LLVM/bin/clang.exe \
--action_env=CXX=C:/PROGRA~1/LLVM/bin/clang++.exe \
--linkopt="--ld-path=C:/PROGRA~1/LLVM/bin/ld.lld.exe" \
--repo_env=BAZEL_COMPILER=C:/PROGRA~1/LLVM/bin/clang.exe \
--repo_env=USE_CLANG_CL=1 \
--copt=-march=native \
--define xnn_enable_arm_fp16_scalar=false \
--define xnn_enable_arm_fp16_vector=false \
--define xnn_enable_arm_bf16=false \
--define xnn_enable_arm_dotprod=false \
--define xnn_enable_arm_i8mm=false \
--define xnn_enable_arm_sme=false \
--define xnn_enable_arm_sme2=false \
--define xnn_enable_riscv_vector=false \
--define xnn_enable_riscv_fp16_vector=false \
--define xnn_enable_avxvnni=false \
--define xnn_enable_avxvnniint8=false \
--define xnn_enable_avx256skx=false \
--define xnn_enable_avx256vnni=false \
--define xnn_enable_avx256vnnigfni=false \
--define xnn_enable_avx512f=false \
--define xnn_enable_avx512skx=false \
--define xnn_enable_avx512vbmi=false \
--define xnn_enable_avx512vnni=false \
--define xnn_enable_avx512vnnigfni=false \
--define xnn_enable_avx512amx=false \
--define xnn_enable_avx512fp16=false \
--define xnn_enable_avx512bf16=false \
--define xnn_enable_hvx=false \
//xla/pjrt/c:pjrt_c_api_cpu_plugin.so
- name: "Package the binary"
run: |
# Create the tarball.
PJRT_C_API_HEADER="./xla/xla/pjrt/c/pjrt_c_api.h"
ZIP_NAME="pjrt_cpu_windows_amd64.zip"
BINARY_DIR="xla/bazel-bin/xla/pjrt/c"
BINARY_NAME="pjrt_c_api_cpu_plugin.so"
TARGET_NAME="pjrt_c_api_cpu_plugin.dll"
mv "xla/bazel-bin/xla/pjrt/c/${BINARY_NAME}" "${TARGET_NAME}"
7z a "$ZIP_NAME" "${TARGET_NAME}"
echo "ZIP_NAME=${ZIP_NAME}" >> $GITHUB_ENV
- name: Upload release asset
uses: softprops/action-gh-release@v2
with:
tag_name: ${{ env.RELEASE }}
files: ${{ env.ZIP_NAME }}
name: CPU
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}