Skip to content

Add SYCL backend support #391

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 33 commits into from
Feb 18, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
33 commits
Select commit Hold shift + click to select a range
1194c9e
Added cmakelists debug prints.
xsxszab Feb 10, 2025
e675943
test update
xsxszab Feb 10, 2025
78c8ba7
temp update.
xsxszab Feb 14, 2025
1e5b0de
Updated Cmakelist.
xsxszab Feb 14, 2025
996c03a
Fixed cmakelist bug.
xsxszab Feb 14, 2025
702232e
Updated cmakelists.txt .
xsxszab Feb 14, 2025
45b4b22
Updated cmakelists and readme, added sycl build scripts.
xsxszab Feb 14, 2025
24b9742
Removed unnecessary compilation for llama.cpp.
xsxszab Feb 15, 2025
f6c5f93
Updated flags.
xsxszab Feb 15, 2025
63c00ff
Merge branch 'main' into yfei/support_sycl
xsxszab Feb 16, 2025
72a99db
Workflow update
xsxszab Feb 17, 2025
6f4d86e
Updates workflow.
xsxszab Feb 17, 2025
f9ff193
test update
xsxszab Feb 17, 2025
fa9a481
test update
xsxszab Feb 17, 2025
51a37f0
test update
xsxszab Feb 17, 2025
082db12
test update, try curl
xsxszab Feb 17, 2025
ef4038b
test update
xsxszab Feb 17, 2025
7c79156
bug fix
xsxszab Feb 17, 2025
9cca927
Disables aar workflow.
xsxszab Feb 17, 2025
ddbfac7
Updates workflow.
xsxszab Feb 17, 2025
5d48830
Updated stable diffusion CUDA flags.
xsxszab Feb 17, 2025
7308391
Updates Github Actions workflow.
xsxszab Feb 17, 2025
01c6a9b
SYCL workflow now works.
xsxszab Feb 17, 2025
32ad75a
Adds SYCL Linux prebuild workflow.
xsxszab Feb 17, 2025
6d2c54f
Updates SYCL linux workflow and readme.
xsxszab Feb 17, 2025
7254272
Fixes bash scripts.
xsxszab Feb 17, 2025
b332945
Temporarily disables sycl linux workflow.
xsxszab Feb 17, 2025
f391658
Updates CMakeLists.
xsxszab Feb 17, 2025
7a97128
Fixes and refactors CMakeLists.
xsxszab Feb 17, 2025
3345382
Updates CMakeLists to address OOM issue during CI; Removes SYCL Linux…
xsxszab Feb 18, 2025
de5c6e9
Adds comments to CMakeLists.
xsxszab Feb 18, 2025
0832da8
Temporarily add push trigger condition to enable github action.
xsxszab Feb 18, 2025
fb61dd4
Enhances code comments.
xsxszab Feb 18, 2025
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
14 changes: 8 additions & 6 deletions .github/workflows/build-aar.yml
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
name: Build Android AAR

on:
push:
branches:
- main
- android-sdk
pull_request:
workflow_dispatch:
# AAR pre-build task temporarily disabled
# push:
# branches:
# - main
# - android-sdk
# pull_request:

jobs:
build:
Expand Down Expand Up @@ -101,4 +103,4 @@ jobs:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: release-artifacts/com-nexa-${{ github.ref_name }}-${{ github.run_number }}.aar
asset_name: com-nexa-${{ github.ref_name }}-${{ github.run_number }}.aar
asset_content_type: application/java-archive
asset_content_type: application/java-archive
50 changes: 0 additions & 50 deletions .github/workflows/build-wheels-cpu.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,48 +6,6 @@ permissions:
contents: write

jobs:
# build_wheels_linux:
# name: Build wheels on ${{ matrix.os }}
# runs-on: ${{ matrix.os }}
# strategy:
# matrix:
# os: [ubuntu-20.04]

# steps:
# - uses: actions/checkout@v4
# with:
# submodules: "recursive"

# # Used to host cibuildwheel
# - uses: actions/setup-python@v5
# with:
# python-version: "3.8"
# cache: "pip"

# - name: Install dependencies
# run: |
# python -m pip install --upgrade pip
# # python -m pip install -e .
# python -m pip install build wheel

# - name: Build wheels
# uses: pypa/[email protected]
# env:
# # disable repair
# CIBW_REPAIR_WHEEL_COMMAND: ""
# CIBW_BUILD_FRONTEND: "build"
# CIBW_SKIP: "*musllinux*"
# CIBW_BUILD: "cp37-* cp38-* cp39-* cp310-* cp311-* cp312-*"
# CMAKE_BUILD_PARALLEL_LEVEL: 4
# with:
# package-dir: .
# output-dir: wheelhouse

# - uses: actions/upload-artifact@v4
# with:
# name: wheels-${{ matrix.os }}
# path: ./wheelhouse/*.whl

build_wheels_win:
name: Build wheels on ${{ matrix.os }}
runs-on: ${{ matrix.os }}
Expand Down Expand Up @@ -100,14 +58,6 @@ jobs:
with:
submodules: "recursive"

# - name: Set up QEMU
# uses: docker/setup-qemu-action@v3
# with:
# platforms: linux/arm64

# - name: Check nproc value
# run: echo "Number of processors $(nproc)"

- name: Build wheels
uses: pypa/[email protected]
env:
Expand Down
13 changes: 2 additions & 11 deletions .github/workflows/build-wheels-cuda-linux.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -71,15 +71,6 @@ jobs:
$cudaVersion = $env:CUDAVER
mamba install -y 'cuda' -c nvidia/label/cuda-$cudaVersion
python -m pip install build wheel

# - name: Debug GLIBC Issues
# run: |
# echo "Check GCC"
# gcc --version
# which gcc

# echo "## Checking if libdl and librt are available"
# ldconfig -p | grep -E "libdl|librt" || echo "Missing libdl or librt!"

- name: Build Wheel
run: |
Expand All @@ -93,7 +84,7 @@ jobs:
$env:VERBOSE = '1'

$env:CMAKE_BUILD_PARALLEL_LEVEL = $(nproc)
$env:CMAKE_ARGS = '-DSD_CUBLAS=ON -DGGML_CUDA=ON -DGGML_CUBLAS=ON -DCMAKE_CUDA_ARCHITECTURES=all'
$env:CMAKE_ARGS = '-DSD_CUDA=ON -DGGML_CUDA=ON -DCMAKE_CUDA_ARCHITECTURES=all'
$env:CMAKE_ARGS = $env:CMAKE_ARGS + ' -DGGML_CUDA_FORCE_MMQ=ON -DGGML_AVX2=OFF -DGGML_FMA=OFF -DGGML_F16C=OFF'

python -m build --wheel
Expand All @@ -106,4 +97,4 @@ jobs:
# Set tag_name to <tag>-cu<cuda_version>
tag_name: ${{ github.ref_name }}-cu${{ env.CUDA_VERSION }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
2 changes: 1 addition & 1 deletion .github/workflows/build-wheels-cuda-win.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ jobs:
}
$env:VERBOSE = '1'

$env:CMAKE_ARGS = '-DSD_CUBLAS=ON -DGGML_CUDA=ON -DGGML_CUBLAS=ON -DCMAKE_CUDA_ARCHITECTURES=all'
$env:CMAKE_ARGS = '-DSD_CUDA=ON -DGGML_CUDA=ON -DCMAKE_CUDA_ARCHITECTURES=all'
$env:CMAKE_ARGS = $env:CMAKE_ARGS + ' -DGGML_CUDA_FORCE_MMQ=ON -DGGML_AVX2=OFF -DGGML_FMA=OFF -DGGML_F16C=OFF'
$env:CMAKE_ARGS = $env:CMAKE_ARGS + ' -DCMAKE_SYSTEM_VERSION=10.0.18362.0 -DCMAKE_VS_WINDOWS_TARGET_PLATFORM_VERSION=10.0.18362.0'
$env:CMAKE_BUILD_PARALLEL_LEVEL = $(nproc)
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/build-wheels-rocm-linux.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -86,4 +86,4 @@ jobs:
# Set tag_name to <tag>-rocm<rocm_version>
tag_name: ${{ github.ref_name }}-rocm${{ env.ROCM_VERSION }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
100 changes: 100 additions & 0 deletions .github/workflows/build-wheels-sycl-win.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,100 @@
name: Build Wheels (SYCL) (Windows)
on:
workflow_dispatch:

permissions:
contents: write

jobs:
define_matrix:
name: Define Build Matrix
runs-on: sdk-windows-8-core
outputs:
matrix: ${{ steps.set-matrix.outputs.matrix }}
defaults:
run:
shell: pwsh
steps:
- name: Define Job Output
id: set-matrix
run: |
$matrix = @{
'os' = @('sdk-windows-8-core')
'pyver' = @("3.8", "3.9", "3.10", "3.11", "3.12")
'releasetag' = @("basic")
}
$matrixOut = ConvertTo-Json $matrix -Compress
Write-Output ('matrix=' + $matrixOut) >> $env:GITHUB_OUTPUT

build_wheels:
name: Build Wheel ${{ matrix.os }} Python ${{ matrix.pyver }}
needs: define_matrix
runs-on: ${{ matrix.os }}
strategy:
matrix: ${{ fromJSON(needs.define_matrix.outputs.matrix) }}
defaults:
run:
shell: pwsh
env:
WINDOWS_BASEKIT_URL: https://registrationcenter-download.intel.com/akdlm/IRC_NAS/b380d914-366b-4b77-a74a-05e3c38b3514/intel-oneapi-base-toolkit-2025.0.0.882_offline.exe
WINDOWS_DPCPP_MKL: intel.oneapi.win.cpp-dpcpp-common:intel.oneapi.win.mkl.devel:intel.oneapi.win.dnnl:intel.oneapi.win.tbb.devel
steps:
- name: Add MSBuild to PATH
if: runner.os == 'Windows'
uses: microsoft/setup-msbuild@v2
with:
vs-version: "[16.11,16.12)"
msbuild-architecture: x64

- name: Checkout Repository
uses: actions/checkout@v4
with:
submodules: "recursive"

- name: Setup Python
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.pyver }}
architecture: 'x64'
cache: "pip"

- name: Install Ninja Build System
run: |
choco install ninja -y
# choco install wget -y

- name: Install SYCL dependencies
run: |
scripts/install-oneapi.bat "${{ env.WINDOWS_BASEKIT_URL }}" "${{ env.WINDOWS_DPCPP_MKL }}"

- name: Install Python Dependencies
run: |
python -m pip install --upgrade pip
python -m pip install build wheel setuptools cmake
python -m pip install scikit-build

- name: Build Wheel
run: |
# Add choco bin path to PATH, necessary for using Ninja
$env:PATH="C:\ProgramData\chocolatey\bin;$env:PATH"

# On Windows, SYCL must be built with Ninja and icx compiler
# $env:CMAKE_ARGS="-DGGML_SYCL=ON -DCMAKE_C_COMPILER=cl -DCMAKE_CXX_COMPILER=icx"

# Build the wheel
# python -m build --wheel
scripts/workflow-win-build-sycl.bat

- name: Upload Wheel Artifact
uses: actions/upload-artifact@v4
with:
path: dist/*.whl
name: llama-sycl-wheel-python${{ matrix.pyver }}.whl

- name: Create GitHub Release
uses: softprops/action-gh-release@v2
with:
files: dist/*
tag_name: ${{ github.ref_name }}-sycl
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
2 changes: 1 addition & 1 deletion .github/workflows/build-wheels-vulkan-win.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -90,4 +90,4 @@ jobs:
files: dist/*
tag_name: ${{ github.ref_name }}-vulkan
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
2 changes: 1 addition & 1 deletion .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -60,4 +60,4 @@ jobs:
- name: Run tests
run: |
python -m pytest tests
shell: bash
shell: bash
Loading