Thanks to visit codestin.com
Credit goes to github.com

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
68 changes: 68 additions & 0 deletions .github/workflows/darwin_build_cpu_pjrt.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
name: 'Build darwin/arm64 XLA PJRT CPU Plugin'

# This allows the workflow to be triggered manually from the
# GitHub UI (Actions tab > "Build XLA PJRT CPU Plugin" > Run workflow)
on:
workflow_dispatch:

jobs:
build-and-package-macos-arm64:
name: 'Build macOS (arm64) Plugin'

# We use macos-14, which is the GitHub-hosted runner for Apple Silicon (arm64)
runs-on: macos-14

steps:
- name: 'Install Python dependencies'
run: |
# XLA build requires some common Python packages
pip3 install six numpy

- name: 'Setup Bazelisk (for Bazel)'
# This action installs and caches the correct Bazel version
# specified by the .bazelversion file in the XLA repo.
uses: bazelbuild/setup-bazelisk@v3

- name: 'Check out openxla/xla repository'
# This checks out the external XLA repo, not the repo this
# workflow lives in.
uses: actions/checkout@v4
with:
repository: 'openxla/xla'
# Check out to a specific 'xla' directory
path: 'xla'
# Ensure submodules (like LLVM) are also checked out
submodules: 'recursive'

- name: 'Build PJRT C API CPU plugin'
run: |
cd xla
# We use --config=opt for an optimized build and
# --config=macos_arm64 to target the Apple Silicon architecture
bazel build \
--config=opt \
--config=macos_arm64 \
//xla/pjrt/c:pjrt_c_api_cpu_plugin.so

- name: 'Package the binary'
run: |
# Define the path where Bazel places the output binary
# This is the stable symlink path
BINARY_DIR="xla/bazel-bin/xla/pjrt/c"
BINARY_NAME="pjrt_c_api_cpu_plugin.so"

# Create the tarball.
# The -C flag tells tar to change to BINARY_DIR first,
# so that BINARY_NAME is added to the archive at its root.
tar -czvf gopjrt_cpu_darwin_arm64.tar.gz -C ${BINARY_DIR} ${BINARY_NAME}

- name: 'Upload plugin artifact'
# This action uploads the generated file as a workflow artifact
uses: actions/upload-artifact@v4
with:
# This is the name of the artifact bundle in the GitHub UI
name: pjrt-cpu-darwin-arm64
# This is the file to upload
path: gopjrt_cpu_darwin_arm64.tar.gz
# Set a reasonable retention period for the artifact
retention-days: 3
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
name: Tests(macOS)
name: Tests(darwin)

# Triggers the workflow on push or pull request events but only for the "main" branch
on:
push:
branches: [ "main" ]
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
name: "Tests" # The name of the workflow that will appear on GitHub
name: "Tests(linux)"

permissions:
# read|write|none
actions: read
Expand Down
6 changes: 6 additions & 0 deletions docs/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
# Gopjrt Changelog

# Next

- GitHub workflows:
- Renamed to more meaningful names.
- Added `darwin_build_cpu_pjrt.yaml`: workflow to automatically build the Darwin CPU PJRT plugin.

# v0.8.4 - 2025/10/23 Adding Darwin (Mac) support for CPU PJRT plugin

- Added default "${HOME}/Library/Application Support/GoMLX/PJRT" as a default search path for PJRT plugins in MacOS.
Expand Down