Skip to content

Commit a5c4e47

Browse files
authored
Add SYCL/XPU wheel build and publish GitHub Actions workflows
2 parents fa4cdd9 + 0305370 commit a5c4e47

4 files changed

Lines changed: 198 additions & 1 deletion

File tree

.github/workflows/building_xpu.yml

Lines changed: 91 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,91 @@
1+
name: Build XPU Wheels
2+
3+
on: [workflow_call, workflow_dispatch]
4+
5+
permissions:
6+
contents: read
7+
8+
jobs:
9+
build_wheels:
10+
runs-on: ubuntu-22.04
11+
environment: production
12+
13+
strategy:
14+
fail-fast: false
15+
matrix:
16+
python-version: ['3.10', '3.11', '3.12', '3.13', '3.14']
17+
torch-version: ['2.10.0']
18+
19+
steps:
20+
- name: Checkout repository
21+
uses: actions/checkout@v4
22+
with:
23+
submodules: recursive
24+
25+
- name: Set up Python ${{ matrix.python-version }}
26+
uses: actions/setup-python@v5
27+
with:
28+
python-version: ${{ matrix.python-version }}
29+
30+
- name: Free up disk space
31+
run: |
32+
echo "Disk space before cleanup:"
33+
df -h
34+
sudo rm -rf /usr/share/dotnet
35+
echo "Disk space after cleanup:"
36+
df -h
37+
shell: bash
38+
39+
- name: Install PyTorch ${{ matrix.torch-version }}+xpu
40+
run: |
41+
pip install torch==${{ matrix.torch-version }} --index-url https://download.pytorch.org/whl/xpu
42+
python -c "import torch; print('PyTorch:', torch.__version__)"
43+
python -c "import torch; print('XPU Available:', torch.xpu.is_available() if hasattr(torch, 'xpu') else False)"
44+
shell: bash
45+
46+
- name: Install Intel oneAPI C++ Essentials
47+
run: |
48+
ONEAPI_VERSION=$(pip show intel-sycl-rt 2>/dev/null | grep ^Version | awk '{print $2}')
49+
if [ -z "${ONEAPI_VERSION}" ]; then
50+
echo "Error: intel-sycl-rt not found. Ensure PyTorch XPU was installed successfully." >&2
51+
exit 1
52+
fi
53+
echo "Detected intel-sycl-rt version: ${ONEAPI_VERSION}"
54+
bash .github/workflows/xpu/Linux.sh ${ONEAPI_VERSION}
55+
shell: bash
56+
57+
- name: Set version
58+
run: |
59+
VERSION=`sed -n 's/^__version__ = "\(.*\)"/\1/p' gsplat/version.py`
60+
TORCH_VERSION=`echo "pt${{ matrix.torch-version }}" | sed "s/..$//" | sed "s/\.//g"`
61+
echo "New version name: $VERSION+${TORCH_VERSION}xpu"
62+
sed -i "s/$VERSION/$VERSION+${TORCH_VERSION}xpu/" gsplat/version.py
63+
shell: bash
64+
65+
- name: Upgrade pip
66+
run: |
67+
pip install --upgrade setuptools
68+
pip install ninja pybind11
69+
shell: bash
70+
71+
- name: Build wheel
72+
run: |
73+
pip install wheel
74+
source /opt/intel/oneapi/setvars.sh
75+
BUILD_SYCL=1 MAX_JOBS=$(nproc) python setup.py bdist_wheel --dist-dir=dist
76+
shell: bash
77+
78+
- name: Test wheel
79+
run: |
80+
cd dist
81+
ls -lah
82+
pip install *.whl
83+
python -c "import gsplat; print('gsplat:', gsplat.__version__)"
84+
cd ..
85+
shell: bash
86+
87+
- uses: actions/upload-artifact@v4
88+
with:
89+
# Include unique matrix values to avoid name collisions.
90+
name: xpu_wheels_python${{ matrix.python-version }}-ubuntu-22.04-${{ matrix.torch-version }}
91+
path: dist/*.whl

.github/workflows/publish_xpu.yml

Lines changed: 88 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,88 @@
1+
# Build and Release XPU Wheels
2+
3+
name: Build and Release XPU Wheels
4+
5+
on:
6+
release:
7+
types: [created]
8+
workflow_dispatch:
9+
10+
permissions:
11+
contents: write
12+
13+
jobs:
14+
# Build the XPU wheels using the reusable building workflow
15+
build_xpu_wheels:
16+
name: Call reusable XPU building workflow
17+
uses: ./.github/workflows/building_xpu.yml
18+
19+
create_release_and_upload_packages:
20+
name: Upload XPU Wheels to GitHub Release
21+
needs: [build_xpu_wheels]
22+
runs-on: ubuntu-latest
23+
strategy:
24+
fail-fast: false
25+
matrix:
26+
python-version: ['3.10', '3.11', '3.12', '3.13', '3.14']
27+
steps:
28+
- name: Checkout code
29+
uses: actions/checkout@v4
30+
with:
31+
submodules: recursive
32+
33+
- name: Download packages
34+
id: download_artifacts
35+
uses: actions/download-artifact@v4
36+
with:
37+
# The unique artifact names from building_xpu.yml all start with
38+
# "xpu_wheels_python${{ matrix.python-version }}" so this pattern
39+
# will match them all and merge them into the 'dist' directory.
40+
pattern: xpu_wheels_python${{ matrix.python-version }}*
41+
path: dist
42+
merge-multiple: true
43+
44+
- name: Upload packages to latest GitHub Release
45+
env:
46+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
47+
run: |
48+
echo "Fetching latest release info..."
49+
release_info=$(curl -s -H "Authorization: token $GITHUB_TOKEN" \
50+
https://api.github.com/repos/isl-org/gsplat/releases/latest)
51+
52+
# Extract the "upload_url" field and strip the {?name,label} part
53+
upload_url=$(echo "$release_info" | grep '"upload_url":' | cut -d '"' -f 4 | sed 's/{.*//')
54+
echo "Upload URL: $upload_url"
55+
56+
for file in ./dist/*.*; do
57+
echo "Uploading $file..."
58+
filename=$(basename "$file")
59+
encoded_filename=$(echo "$filename" | sed 's/+/%2B/g')
60+
curl -X POST \
61+
-H "Authorization: token $GITHUB_TOKEN" \
62+
-H "Content-Type: application/octet-stream" \
63+
--data-binary @"$file" \
64+
"$upload_url?name=$encoded_filename"
65+
done
66+
echo "Upload complete."
67+
68+
generate_simple_index_pages:
69+
name: Generate Simple Index Pages
70+
needs: [create_release_and_upload_packages]
71+
runs-on: ubuntu-latest
72+
steps:
73+
- name: Checkout code
74+
uses: actions/checkout@v4
75+
76+
- name: Generate Simple Index Pages
77+
run: python .github/workflows/generate_simple_index_pages.py --outdir ./whl
78+
env:
79+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
80+
81+
- name: Deploy to GitHub Pages
82+
uses: peaceiris/actions-gh-pages@v3
83+
with:
84+
github_token: ${{ secrets.GITHUB_TOKEN }}
85+
publish_dir: ./whl
86+
destination_dir: whl
87+
keep_files: false
88+
cname: docs.gsplat.studio

.github/workflows/xpu/Linux.sh

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
#!/bin/bash
2+
3+
# Install Intel oneAPI C++ Essentials for SYCL builds.
4+
# Usage: Linux.sh <VERSION>
5+
# Example: Linux.sh 2025.3.1
6+
7+
VERSION=${1:?'Usage: Linux.sh <VERSION> (e.g. Linux.sh 2025.3.1)'}
8+
9+
wget -O- https://apt.repos.intel.com/intel-gpg-keys/GPG-PUB-KEY-INTEL-SW-PRODUCTS.PUB \
10+
| gpg --dearmor \
11+
| sudo tee /usr/share/keyrings/oneapi-archive-keyring.gpg > /dev/null
12+
13+
echo "deb [signed-by=/usr/share/keyrings/oneapi-archive-keyring.gpg] https://apt.repos.intel.com/oneapi all main" \
14+
| sudo tee /etc/apt/sources.list.d/oneAPI.list
15+
16+
sudo apt-get -qq update
17+
sudo apt-get install -y intel-cpp-essentials-${VERSION}
18+
sudo apt clean

setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@
2929
except (ImportError, AttributeError):
3030
pass
3131

32-
BUILD_SYCL = has_xpu
32+
BUILD_SYCL = has_xpu or os.getenv("BUILD_SYCL", "0") == "1"
3333
BUILD_NO_CUDA = os.getenv("BUILD_NO_CUDA", "0") == "1"
3434
WITH_SYMBOLS = os.getenv("WITH_SYMBOLS", "0") == "1"
3535
LINE_INFO = os.getenv("LINE_INFO", "0") == "1"

0 commit comments

Comments
 (0)