Skip to content

Commit 5f1a310

Browse files
committed
Initial migration from lemonade-sdk/lemonade
1 parent bc2efc2 commit 5f1a310

File tree

21 files changed

+3809
-36
lines changed

21 files changed

+3809
-36
lines changed
Lines changed: 71 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,71 @@
1+
name: Setup RyzenAI Server
2+
description: Setup RyzenAI Server from already-downloaded artifact files for testing
3+
4+
inputs:
5+
cache-path:
6+
description: 'The LEMONADE_CACHE_DIR where RyzenAI Server should be installed (in bin/ryzenai-server subdirectory)'
7+
required: true
8+
artifact-path:
9+
description: 'Path where the ryzenai-server artifact files have been downloaded'
10+
required: false
11+
default: 'ryzenai-server-files'
12+
13+
runs:
14+
using: composite
15+
steps:
16+
- name: Setup RyzenAI Server for testing
17+
shell: PowerShell
18+
run: |
19+
Write-Host "Setting up ryzenai-server from artifact..." -ForegroundColor Cyan
20+
21+
$artifactPath = "${{ inputs.artifact-path }}"
22+
23+
# First, check what we have
24+
Write-Host "`nContents of artifact directory:" -ForegroundColor Yellow
25+
Get-ChildItem "$artifactPath" -File | ForEach-Object {
26+
$sizeMB = [math]::Round($_.Length / 1MB, 2)
27+
Write-Host " - $($_.Name) ($sizeMB MB)" -ForegroundColor Gray
28+
}
29+
30+
# Install to cache directory (where get_downloaded_bin_dir() expects it)
31+
$ryzenaiDir = Join-Path "${{ inputs.cache-path }}" "bin\ryzenai-server"
32+
33+
# Create ryzenai-server directory
34+
New-Item -ItemType Directory -Path $ryzenaiDir -Force | Out-Null
35+
36+
# Copy all files from artifact to ryzenai-server directory
37+
Write-Host "`nCopying ryzenai-server files to: $ryzenaiDir" -ForegroundColor Gray
38+
Copy-Item -Path "$artifactPath\*" -Destination $ryzenaiDir -Recurse -Force
39+
40+
# Force filesystem sync and wait
41+
Start-Sleep -Seconds 2
42+
43+
# Retry logic for verification
44+
$ryzenaiExe = Join-Path $ryzenaiDir "ryzenai-server.exe"
45+
$maxRetries = 5
46+
$retryCount = 0
47+
$found = $false
48+
49+
while (-not $found -and $retryCount -lt $maxRetries) {
50+
if (Test-Path $ryzenaiExe) {
51+
$found = $true
52+
Write-Host "[OK] ryzenai-server.exe found at: $ryzenaiExe" -ForegroundColor Green
53+
54+
# List a few files to confirm
55+
$fileCount = (Get-ChildItem $ryzenaiDir -File | Measure-Object).Count
56+
Write-Host "[OK] Total files in ryzenai-server directory: $fileCount" -ForegroundColor Green
57+
} else {
58+
$retryCount++
59+
Write-Host "Attempt ${retryCount}/${maxRetries}: ryzenai-server.exe not found yet, waiting..." -ForegroundColor Yellow
60+
Start-Sleep -Seconds 1
61+
}
62+
}
63+
64+
if (-not $found) {
65+
Write-Host "ERROR: ryzenai-server.exe not found after ${maxRetries} attempts!" -ForegroundColor Red
66+
Write-Host "Contents of ryzenai-server directory:" -ForegroundColor Yellow
67+
Get-ChildItem $ryzenaiDir | Format-Table Name, Length
68+
Write-Host "`nContents of source directory:" -ForegroundColor Yellow
69+
Get-ChildItem "$artifactPath" | Format-Table Name, Length
70+
exit 1
71+
}
Lines changed: 209 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,209 @@
1+
name: Build and Release RyzenAI Server
2+
3+
on:
4+
push:
5+
branches: ["main"]
6+
paths:
7+
- '**.cpp'
8+
- '**.h'
9+
- 'CMakeLists.txt'
10+
- '.github/workflows/**'
11+
pull_request:
12+
paths:
13+
- '**.cpp'
14+
- '**.h'
15+
- 'CMakeLists.txt'
16+
- '.github/workflows/**'
17+
workflow_dispatch:
18+
inputs:
19+
create_release:
20+
description: 'Create a GitHub release with the built artifacts'
21+
required: false
22+
default: false
23+
type: boolean
24+
25+
permissions:
26+
contents: write
27+
28+
jobs:
29+
build-ryzenai-server:
30+
name: Build RyzenAI Server
31+
runs-on: [rai-160-sdk, Windows]
32+
steps:
33+
- uses: actions/checkout@v4
34+
with:
35+
clean: true
36+
fetch-depth: 0
37+
38+
- name: Install CMake if not available
39+
shell: PowerShell
40+
run: |
41+
# Check if CMake is already installed
42+
$cmakeInstalled = Get-Command cmake -ErrorAction SilentlyContinue
43+
44+
if (-not $cmakeInstalled) {
45+
Write-Host "CMake not found, installing..." -ForegroundColor Yellow
46+
47+
# Download CMake installer
48+
$cmakeVersion = "3.28.1"
49+
$cmakeUrl = "https://github.com/Kitware/CMake/releases/download/v$cmakeVersion/cmake-$cmakeVersion-windows-x86_64.msi"
50+
$cmakeInstaller = "cmake-installer.msi"
51+
52+
Invoke-WebRequest -Uri $cmakeUrl -OutFile $cmakeInstaller
53+
54+
# Install CMake silently
55+
Start-Process msiexec.exe -ArgumentList "/i $cmakeInstaller /quiet /norestart" -Wait
56+
57+
# Add CMake to PATH for this session AND future steps
58+
$cmakePath = "C:\Program Files\CMake\bin"
59+
$env:PATH = "$cmakePath;$env:PATH"
60+
61+
# Persist to GITHUB_PATH for future steps
62+
echo $cmakePath >> $env:GITHUB_PATH
63+
64+
# Verify installation
65+
cmake --version
66+
if ($LASTEXITCODE -ne 0) {
67+
Write-Host "ERROR: CMake installation failed!" -ForegroundColor Red
68+
exit 1
69+
}
70+
71+
Write-Host "CMake installed successfully and added to PATH!" -ForegroundColor Green
72+
} else {
73+
Write-Host "CMake is already installed:" -ForegroundColor Green
74+
cmake --version
75+
}
76+
77+
- name: Build RyzenAI Server with CMake
78+
shell: PowerShell
79+
run: |
80+
$ErrorActionPreference = "Stop"
81+
82+
Write-Host "Building ryzenai-server..." -ForegroundColor Cyan
83+
84+
# Create build directory
85+
if (Test-Path "build") {
86+
Remove-Item -Recurse -Force "build"
87+
}
88+
mkdir build
89+
cd build
90+
91+
# Configure - Ryzen AI should be at C:\Program Files\RyzenAI\1.6.0
92+
cmake .. -G "Visual Studio 17 2022" -A x64
93+
if ($LASTEXITCODE -ne 0) {
94+
Write-Host "ERROR: CMake configuration failed!" -ForegroundColor Red
95+
exit $LASTEXITCODE
96+
}
97+
98+
# Build
99+
cmake --build . --config Release
100+
if ($LASTEXITCODE -ne 0) {
101+
Write-Host "ERROR: Build failed!" -ForegroundColor Red
102+
exit $LASTEXITCODE
103+
}
104+
105+
# Verify binary exists
106+
if (-not (Test-Path "bin\Release\ryzenai-server.exe")) {
107+
Write-Host "ERROR: ryzenai-server.exe not found!" -ForegroundColor Red
108+
exit 1
109+
}
110+
111+
Write-Host "ryzenai-server build successful!" -ForegroundColor Green
112+
113+
- name: Verify RyzenAI Server build
114+
shell: PowerShell
115+
run: |
116+
$ErrorActionPreference = "Stop"
117+
118+
$releaseDir = "build\bin\Release"
119+
120+
Write-Host "Verifying ryzenai-server build output..." -ForegroundColor Cyan
121+
122+
if (-not (Test-Path "$releaseDir\ryzenai-server.exe")) {
123+
Write-Host "ERROR: ryzenai-server.exe not found in $releaseDir" -ForegroundColor Red
124+
exit 1
125+
}
126+
127+
Write-Host "`nListing all files that will be uploaded:" -ForegroundColor Cyan
128+
Get-ChildItem $releaseDir -File | ForEach-Object {
129+
$sizeMB = [math]::Round($_.Length / 1MB, 2)
130+
Write-Host " - $($_.Name) ($sizeMB MB)" -ForegroundColor Gray
131+
}
132+
133+
$fileCount = (Get-ChildItem $releaseDir -File | Measure-Object).Count
134+
Write-Host "`nFound $fileCount files in release directory" -ForegroundColor Green
135+
Write-Host "Contents will be uploaded as artifact (GitHub will zip automatically)" -ForegroundColor Gray
136+
137+
- name: Upload RyzenAI Server Package
138+
uses: actions/upload-artifact@v4
139+
with:
140+
name: ryzenai-server
141+
path: |
142+
build/bin/Release/*.exe
143+
build/bin/Release/*.dll
144+
build/bin/Release/*.pdb
145+
build/bin/Release/AMD_LICENSE
146+
retention-days: 7
147+
148+
create-release:
149+
name: Create GitHub Release
150+
needs: build-ryzenai-server
151+
runs-on: ubuntu-latest
152+
if: github.ref == 'refs/heads/main' && (github.event_name == 'push' || (github.event_name == 'workflow_dispatch' && github.event.inputs.create_release == 'true'))
153+
steps:
154+
- uses: actions/checkout@v4
155+
with:
156+
fetch-depth: 0
157+
158+
- name: Get version from CMakeLists.txt
159+
id: get_version
160+
run: |
161+
VERSION=$(grep -oP 'project\(ryzenai-server VERSION \K[0-9]+\.[0-9]+\.[0-9]+' CMakeLists.txt)
162+
echo "version=$VERSION" >> $GITHUB_OUTPUT
163+
echo "Detected version: $VERSION"
164+
165+
- name: Download artifacts
166+
uses: actions/download-artifact@v4
167+
with:
168+
name: ryzenai-server
169+
path: ryzenai-server-files
170+
171+
- name: Create ryzenai-server.zip for release
172+
run: |
173+
cd ryzenai-server-files
174+
zip -r ../ryzenai-server.zip *
175+
cd ..
176+
ls -lh ryzenai-server.zip
177+
178+
- name: Create GitHub Release
179+
uses: softprops/action-gh-release@v2
180+
with:
181+
tag_name: v${{ steps.get_version.outputs.version }}
182+
name: RyzenAI Server v${{ steps.get_version.outputs.version }}
183+
body: |
184+
## RyzenAI Server v${{ steps.get_version.outputs.version }}
185+
186+
OpenAI API-compatible server for running LLMs on AMD Ryzen AI NPUs.
187+
188+
### Installation
189+
190+
Download `ryzenai-server.zip` and extract to your preferred location.
191+
192+
### Requirements
193+
194+
- Windows 11 (64-bit)
195+
- AMD Ryzen AI 300-series processor
196+
- Ryzen AI Software 1.6.0 with LLM patch
197+
198+
### Usage
199+
200+
```cmd
201+
ryzenai-server.exe -m C:\path\to\onnx\model --mode hybrid
202+
```
203+
204+
See the [README](https://github.com/lemonade-sdk/ryzenai-server#readme) for full documentation.
205+
files: ryzenai-server.zip
206+
draft: false
207+
prerelease: false
208+
env:
209+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

.gitignore

Lines changed: 32 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -1,41 +1,39 @@
1-
# Prerequisites
2-
*.d
3-
4-
# Compiled Object files
5-
*.slo
6-
*.lo
1+
# Build directories
2+
build/
3+
bin/
4+
lib/
5+
out/
6+
7+
# CMake
8+
CMakeCache.txt
9+
CMakeFiles/
10+
cmake_install.cmake
11+
*.cmake
12+
!CMakeLists.txt
13+
14+
# Visual Studio
15+
.vs/
16+
*.vcxproj
17+
*.vcxproj.filters
18+
*.vcxproj.user
19+
*.sln
20+
21+
# Downloaded dependencies
22+
external/
23+
24+
# Compiled objects
725
*.o
826
*.obj
9-
10-
# Precompiled Headers
11-
*.gch
12-
*.pch
13-
14-
# Linker files
15-
*.ilk
16-
17-
# Debugger Files
18-
*.pdb
19-
20-
# Compiled Dynamic libraries
27+
*.exe
28+
*.dll
2129
*.so
2230
*.dylib
23-
*.dll
2431

25-
# Fortran module files
26-
*.mod
27-
*.smod
32+
# IDE
33+
.vscode/
34+
.idea/
2835

29-
# Compiled Static libraries
30-
*.lai
31-
*.la
32-
*.a
33-
*.lib
34-
35-
# Executables
36-
*.exe
37-
*.out
38-
*.app
36+
# OS
37+
.DS_Store
38+
Thumbs.db
3939

40-
# debug information files
41-
*.dwo

0 commit comments

Comments
 (0)