Poll workflow to trigger toolbox build automatically on llama.cpp master changes
This commit is contained in:
@@ -1,77 +1,105 @@
|
|||||||
name: Poll llama.cpp and Trigger Docker Build
|
name: Poll llama.cpp & Trigger Build
|
||||||
|
|
||||||
on:
|
on:
|
||||||
schedule:
|
schedule:
|
||||||
- cron: '*/30 * * * *' # Every 30 minutes
|
- cron: '0 0,12 * * *'
|
||||||
workflow_dispatch:
|
workflow_dispatch:
|
||||||
|
|
||||||
|
permissions:
|
||||||
|
contents: read
|
||||||
|
actions: write
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
poll-and-trigger:
|
poll-and-trigger:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout (needed for artifact access)
|
- uses: actions/checkout@v4
|
||||||
uses: actions/checkout@v4
|
|
||||||
|
|
||||||
- name: Get latest commit from llama.cpp/main
|
- id: fetch
|
||||||
id: fetch
|
shell: bash
|
||||||
run: |
|
run: |
|
||||||
echo "🔍 Fetching latest commit SHA from llama.cpp..."
|
set -euo pipefail
|
||||||
LATEST_SHA=$(curl -s https://api.github.com/repos/ggml-org/llama.cpp/commits/main | jq -r .sha)
|
REPO_URL="https://github.com/ggml-org/llama.cpp.git"
|
||||||
|
DEFAULT_REF=$(git ls-remote --symref "$REPO_URL" HEAD | awk '/^ref:/ {print $2}')
|
||||||
|
echo "📌 Default branch: ${DEFAULT_REF#refs/heads/}"
|
||||||
|
LATEST_SHA=$(git ls-remote "$REPO_URL" "$DEFAULT_REF" | cut -f1)
|
||||||
|
if [[ -z "$LATEST_SHA" ]]; then echo "❌ No SHA found"; exit 1; fi
|
||||||
echo "✅ Latest SHA: $LATEST_SHA"
|
echo "✅ Latest SHA: $LATEST_SHA"
|
||||||
echo "latest_sha=$LATEST_SHA" >> $GITHUB_OUTPUT
|
echo "latest_sha=$LATEST_SHA" >> "$GITHUB_OUTPUT"
|
||||||
|
|
||||||
- name: Download last known SHA artifact
|
- id: previous
|
||||||
uses: actions/download-artifact@v4
|
shell: bash
|
||||||
with:
|
env:
|
||||||
name: last-llama-sha
|
GH_REPO: ${{ github.repository }}
|
||||||
continue-on-error: true
|
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||||
|
|
||||||
- name: Read last known SHA
|
|
||||||
id: last
|
|
||||||
run: |
|
run: |
|
||||||
if [[ -f .last_commit_sha ]]; then
|
set -euo pipefail
|
||||||
LAST_SHA=$(cat .last_commit_sha)
|
echo "🔎 Checking for prior artifact 'last-llama-sha'…"
|
||||||
echo "📦 Found previous SHA: $LAST_SHA"
|
ART_ID=$(curl -fsSL -H "Authorization: Bearer $GH_TOKEN" \
|
||||||
echo "last_sha=$LAST_SHA" >> $GITHUB_OUTPUT
|
"https://api.github.com/repos/${GH_REPO}/actions/artifacts?per_page=100" \
|
||||||
|
| jq -r '.artifacts | map(select(.name=="last-llama-sha" and .expired==false)) | sort_by(.created_at) | reverse | .[0].id // empty')
|
||||||
|
if [[ -n "$ART_ID" ]]; then
|
||||||
|
echo "📦 Found artifact id: $ART_ID (downloading)"
|
||||||
|
curl -fsSL -H "Authorization: Bearer $GH_TOKEN" -L \
|
||||||
|
"https://api.github.com/repos/${GH_REPO}/actions/artifacts/${ART_ID}/zip" -o artifact.zip
|
||||||
|
unzip -l artifact.zip || true
|
||||||
|
unzip -p artifact.zip last_commit_sha > last_commit_sha || true
|
||||||
else
|
else
|
||||||
echo "⚠️ No previous SHA found (first run or artifact missing)"
|
echo "ℹ️ No prior artifact found"
|
||||||
echo "last_sha=" >> $GITHUB_OUTPUT
|
fi
|
||||||
|
PREV_SHA=""
|
||||||
|
if [[ -f last_commit_sha ]]; then PREV_SHA=$(cat last_commit_sha); fi
|
||||||
|
echo "🕓 Previous SHA: $PREV_SHA"
|
||||||
|
echo "previous_sha=$PREV_SHA" >> "$GITHUB_OUTPUT"
|
||||||
|
|
||||||
|
- id: compare
|
||||||
|
shell: bash
|
||||||
|
run: |
|
||||||
|
set -euo pipefail
|
||||||
|
echo "🧮 Comparing SHAs…"
|
||||||
|
echo "prev: ${{ steps.previous.outputs.previous_sha }}"
|
||||||
|
echo "curr: ${{ steps.fetch.outputs.latest_sha }}"
|
||||||
|
if [[ "${{ steps.fetch.outputs.latest_sha }}" != "${{ steps.previous.outputs.previous_sha }}" ]]; then
|
||||||
|
echo "🔁 New commit detected"
|
||||||
|
echo "changed=true" >> "$GITHUB_OUTPUT"
|
||||||
|
else
|
||||||
|
echo "✅ No change"
|
||||||
|
echo "changed=false" >> "$GITHUB_OUTPUT"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
- name: Compare SHAs
|
- name: Trigger build_and_publish.yml on main
|
||||||
id: compare
|
|
||||||
run: |
|
|
||||||
echo "🧮 Comparing SHAs..."
|
|
||||||
echo "Previous: ${{ steps.last.outputs.last_sha }}"
|
|
||||||
echo "Current: ${{ steps.fetch.outputs.latest_sha }}"
|
|
||||||
if [[ "${{ steps.fetch.outputs.latest_sha }}" != "${{ steps.last.outputs.last_sha }}" ]]; then
|
|
||||||
echo "🔁 Detected new commit. Triggering build workflow."
|
|
||||||
echo "changed=true" >> $GITHUB_OUTPUT
|
|
||||||
else
|
|
||||||
echo "✅ No changes detected. Skipping trigger."
|
|
||||||
echo "changed=false" >> $GITHUB_OUTPUT
|
|
||||||
fi
|
|
||||||
|
|
||||||
- name: Trigger Build & Publish Workflow
|
|
||||||
if: steps.compare.outputs.changed == 'true'
|
if: steps.compare.outputs.changed == 'true'
|
||||||
env:
|
env:
|
||||||
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||||
|
shell: bash
|
||||||
run: |
|
run: |
|
||||||
echo "🚀 Sending workflow_dispatch event to trigger Docker build..."
|
set -euo pipefail
|
||||||
curl -X POST https://api.github.com/repos/${{ github.repository }}/actions/workflows/build-publish-strix.yml/dispatches \
|
WF="build_and_publish.yml"
|
||||||
-H "Accept: application/vnd.github+json" \
|
REF="main"
|
||||||
-H "Authorization: Bearer $GH_TOKEN" \
|
echo "🚀 Dispatching $WF on $REF…"
|
||||||
-d '{"ref":"main","inputs":{"backends":"all"}}'
|
CODE=$(curl -s -o /tmp/resp -w "%{http_code}" \
|
||||||
|
-X POST \
|
||||||
|
-H "Accept: application/vnd.github+json" \
|
||||||
|
-H "Authorization: Bearer $GH_TOKEN" \
|
||||||
|
-d "{\"ref\":\"$REF\",\"inputs\":{\"backends\":\"all\"}}" \
|
||||||
|
"https://api.github.com/repos/${{ github.repository }}/actions/workflows/$WF/dispatches")
|
||||||
|
echo "HTTP $CODE"
|
||||||
|
if [[ "$CODE" != "204" ]]; then echo "Response:"; cat /tmp/resp; exit 1; fi
|
||||||
|
|
||||||
- name: Save latest SHA to file
|
|
||||||
|
- name: Save new SHA
|
||||||
if: steps.compare.outputs.changed == 'true'
|
if: steps.compare.outputs.changed == 'true'
|
||||||
run: echo "${{ steps.fetch.outputs.latest_sha }}" > .last_commit_sha
|
shell: bash
|
||||||
|
run: |
|
||||||
|
set -euo pipefail
|
||||||
|
printf "%s" "${{ steps.fetch.outputs.latest_sha }}" > last_commit_sha
|
||||||
|
echo "💾 Saved $(wc -c < last_commit_sha) bytes to $(pwd)/last_commit_sha"
|
||||||
|
ls -la last_commit_sha
|
||||||
|
|
||||||
- name: Upload updated SHA artifact
|
- name: Upload last-SHA artifact
|
||||||
if: steps.compare.outputs.changed == 'true'
|
if: steps.compare.outputs.changed == 'true'
|
||||||
uses: actions/upload-artifact@v4
|
uses: actions/upload-artifact@v4
|
||||||
with:
|
with:
|
||||||
name: last-llama-sha
|
name: last-llama-sha
|
||||||
path: .last_commit_sha
|
path: last_commit_sha
|
||||||
retention-days: 2
|
retention-days: 7
|
||||||
|
|||||||
@@ -239,17 +239,19 @@ This should work on any Strix Halo. For a complete list of available hardware, s
|
|||||||
|
|
||||||
### 6.2 Kernel Parameters (tested on Fedora 42)
|
### 6.2 Kernel Parameters (tested on Fedora 42)
|
||||||
|
|
||||||
Add these boot parameters to enable unified memory and optimal performance:
|
Add these these boot parameters to enable unified memory and optimal performance:
|
||||||
|
|
||||||
```
|
```
|
||||||
amd_iommu=off amdgpu.gttsize=131072 ttm.pages_limit=335544321
|
amd_iommu=off amdgpu.gttsize=131072 ttm.pages_limit=33554432
|
||||||
```
|
|
||||||
|
|
||||||
| Parameter | Purpose |
|
```
|
||||||
| --------------------------- | ------------------------------------------------ |
|
| Parameter | Purpose |
|
||||||
| `amd_iommu=off` | Disables IOMMU for lower latency |
|
| --------------------------- | ----------------------------------------------------------------------------------------- |
|
||||||
| `amdgpu.gttsize=131072` | Enables unified GPU/system memory (up to 128 GB) |
|
| `amd_iommu=off` | Disables IOMMU for lower latency |
|
||||||
| `ttm.pages_limit=335544321` | Allows large pinned memory allocations |
|
| `amdgpu.gttsize=131072` | Enables unified GPU/system memory (up to 128 GiB); 131072 MiB ÷ 1024 = 128 GiB |
|
||||||
|
| `ttm.pages_limit=33554432` | Allows large pinned memory allocations; 33554432 × 4 KiB = 134217728 KiB ÷ 1024² = 128 GiB |
|
||||||
|
|
||||||
|
Source: https://www.reddit.com/r/LocalLLaMA/comments/1m9wcdc/comment/n5gf53d/?context=3&utm_source=share&utm_medium=web3x&utm_name=web3xcss&utm_term=1&utm_content=share_button.
|
||||||
|
|
||||||
**Apply the changes:**
|
**Apply the changes:**
|
||||||
|
|
||||||
@@ -277,3 +279,4 @@ Follow this guide by TechnigmaAI for a working configuration on Ubuntu 24.04:
|
|||||||
* Most comprehesive repostiry of test builds for Strix Halo by lhl -> [https://github.com/lhl/strix-halo-testing/tree/main](https://github.com/lhl/strix-halo-testing/tree/main)
|
* Most comprehesive repostiry of test builds for Strix Halo by lhl -> [https://github.com/lhl/strix-halo-testing/tree/main](https://github.com/lhl/strix-halo-testing/tree/main)
|
||||||
* Ubuntu 24.04 configuration
|
* Ubuntu 24.04 configuration
|
||||||
[https://github.com/technigmaai/technigmaai-wiki/wiki/AMD-Ryzen-AI-Max--395:-GTT--Memory-Step%E2%80%90by%E2%80%90Step-Instructions-(Ubuntu-24.04)](https://github.com/technigmaai/technigmaai-wiki/wiki/AMD-Ryzen-AI-Max--395:-GTT--Memory-Step%E2%80%90by%E2%80%90Step-Instructions-%28Ubuntu-24.04%29)
|
[https://github.com/technigmaai/technigmaai-wiki/wiki/AMD-Ryzen-AI-Max--395:-GTT--Memory-Step%E2%80%90by%E2%80%90Step-Instructions-(Ubuntu-24.04)](https://github.com/technigmaai/technigmaai-wiki/wiki/AMD-Ryzen-AI-Max--395:-GTT--Memory-Step%E2%80%90by%E2%80%90Step-Instructions-%28Ubuntu-24.04%29)
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user