Skip to content
Open
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
96 changes: 96 additions & 0 deletions .github/actions/test-llamacpp-build/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -235,3 +235,99 @@ runs:
exit 1
fi

- name: Test curl support - model URL download (Windows)
if: inputs.os_type == 'Windows'
shell: powershell
run: |
$llamaCliPath = "llama-binaries\llama-cli.exe"
$modelUrl = "https://huggingface.co/unsloth/Qwen3-0.6B-GGUF/resolve/main/Qwen3-0.6B-Q4_0.gguf"

Write-Host "Testing curl support by downloading model directly via --model-url..."
Write-Host "Command: $llamaCliPath -mu `"$modelUrl`" -ngl 99 -p `"Hello`" -n 5 -st"

# Run the command with model URL
try {
$process = Start-Process -FilePath $llamaCliPath -ArgumentList @("-mu", "`"$modelUrl`"", "-ngl", "99", "-p", "`"Hello`"", "-n", "5", "-st") -NoNewWindow -Wait -PassThru -RedirectStandardOutput "curl_stdout.txt" -RedirectStandardError "curl_stderr.txt"

$process.WaitForExit()

$stdout = Get-Content "curl_stdout.txt" -Raw -ErrorAction SilentlyContinue
$stderr = Get-Content "curl_stderr.txt" -Raw -ErrorAction SilentlyContinue
$output = $stdout + $stderr

Write-Host "=== CURL TEST OUTPUT ==="
Write-Host $output
Write-Host "=== END OUTPUT ==="
Write-Host "Process exit code: $($process.ExitCode)"

Remove-Item "curl_stdout.txt" -ErrorAction SilentlyContinue
Remove-Item "curl_stderr.txt" -ErrorAction SilentlyContinue
}
catch {
Write-Error "Failed to run curl test: $_"
exit 1
}

# Check for curl-related errors
if ($output -match "built without libcurl") {
Write-Host "❌ CURL TEST FAILED - llama.cpp was built without curl support"
exit 1
}

if ($process.ExitCode -ne 0) {
Write-Host "❌ CURL TEST FAILED - Process exited with code: $($process.ExitCode)"
exit 1
}

# Check for successful model download indicators
$foundDownload = $output -match "downloading" -or $output -match "model_load" -or $output -match "offloaded"

if ($foundDownload) {
Write-Host "✅ CURL TEST PASSED - Model URL download functionality works"
} else {
Write-Host "⚠️ CURL TEST WARNING - Could not verify download, but no errors detected"
}

- name: Test curl support - model URL download (Linux)
if: inputs.os_type == 'Linux'
shell: bash
run: |
llama_cli_path="./llama-binaries/llama-cli"
model_url="https://huggingface.co/unsloth/Qwen3-0.6B-GGUF/resolve/main/Qwen3-0.6B-Q4_0.gguf"
output_file="curl_test_output.txt"

echo "Testing curl support by downloading model directly via --model-url..."
echo "Command: $llama_cli_path -mu \"$model_url\" -ngl 99 -p \"Hello\" -n 5 -st"

# Run the command with model URL
set +e
"$llama_cli_path" -mu "$model_url" -ngl 99 -p "Hello" -n 5 -st > "$output_file" 2>&1
exit_code=$?
set -e

echo "=== CURL TEST OUTPUT ==="
cat "$output_file"
echo "=== END OUTPUT ==="
echo "Process exit code: $exit_code"

# Check for curl-related errors
if grep -q "built without libcurl" "$output_file"; then
echo "❌ CURL TEST FAILED - llama.cpp was built without curl support"
rm -f "$output_file"
exit 1
fi

if [ $exit_code -ne 0 ]; then
echo "❌ CURL TEST FAILED - Process exited with code: $exit_code"
rm -f "$output_file"
exit 1
fi

# Check for successful model download indicators
if grep -qE "(downloading|model_load|offloaded)" "$output_file"; then
echo "✅ CURL TEST PASSED - Model URL download functionality works"
else
echo "⚠️ CURL TEST WARNING - Could not verify download, but no errors detected"
fi

rm -f "$output_file"
65 changes: 60 additions & 5 deletions .github/workflows/build-llamacpp-rocm.yml
Original file line number Diff line number Diff line change
Expand Up @@ -167,6 +167,24 @@ jobs:
perl --version

Write-Host "Manual installation of build dependencies completed"

- name: Install curl development libraries via vcpkg
run: |
Write-Host "Installing curl via vcpkg..."

# vcpkg is pre-installed on GitHub Windows runners
$vcpkgRoot = "C:\vcpkg"

# Install curl with OpenSSL support for HTTPS
& "$vcpkgRoot\vcpkg.exe" install "curl[openssl]:x64-windows"

# Integrate vcpkg with CMake
& "$vcpkgRoot\vcpkg.exe" integrate install

# Store vcpkg root for CMake
echo "VCPKG_ROOT=$vcpkgRoot" >> $env:GITHUB_ENV

Write-Host "curl with OpenSSL installed successfully via vcpkg"

- name: Download ROCm nightly tarball
run: |
Expand Down Expand Up @@ -299,11 +317,12 @@ jobs:
mkdir build
cd build

REM Configure the project
REM Configure the project with vcpkg toolchain for curl support
cmake .. -G Ninja ^
-DCMAKE_C_COMPILER="C:\opt\rocm\lib\llvm\bin\clang.exe" ^
-DCMAKE_CXX_COMPILER="C:\opt\rocm\lib\llvm\bin\clang++.exe" ^
-DCMAKE_CXX_FLAGS="-IC:\opt\rocm\include" ^
-DCMAKE_TOOLCHAIN_FILE="C:\vcpkg\scripts\buildsystems\vcpkg.cmake" ^
-DCMAKE_CROSSCOMPILING=ON ^
-DCMAKE_BUILD_TYPE=Release ^
-DGPU_TARGETS="%mapped_target%" ^
Expand All @@ -312,17 +331,18 @@ jobs:
-DGGML_HIP=ON ^
-DGGML_OPENMP=OFF ^
-DGGML_CUDA_FORCE_CUBLAS=OFF ^
-DLLAMA_CURL=ON ^
-DLLAMA_OPENSSL=ON ^
-DGGML_RPC=ON ^
-DGGML_HIP_ROCWMMA_FATTN=OFF ^
-DLLAMA_CURL=OFF ^
-DGGML_NATIVE=OFF ^
-DGGML_STATIC=OFF ^
-DCMAKE_SYSTEM_NAME=Windows

REM Build the project
cmake --build . -j %NUMBER_OF_PROCESSORS%

- name: Copy ROCm core DLLs to build directory
- name: Copy ROCm core DLLs and curl to build directory
run: |
$rocmVersion = if ($env:DETECTED_ROCM_VERSION) { $env:DETECTED_ROCM_VERSION } else { $env:ROCM_VERSION }
$buildBinPath = "llama.cpp\build\bin"
Expand All @@ -345,6 +365,40 @@ jobs:
"hipblas.dll"
)

# Also copy curl and OpenSSL DLLs from vcpkg
Write-Host "Copying curl and OpenSSL DLLs from vcpkg..."
$vcpkgBinPath = "C:\vcpkg\installed\x64-windows\bin"
if (Test-Path $vcpkgBinPath) {
# Copy specific DLLs by exact name
$curlDlls = @("libcurl.dll", "zlib1.dll")
foreach ($dll in $curlDlls) {
$sourcePath = Join-Path $vcpkgBinPath $dll
if (Test-Path $sourcePath) {
Copy-Item $sourcePath $buildBinPath
Write-Host "Copied: $dll (from vcpkg)"
} else {
Write-Host "Warning: $dll not found in vcpkg"
}
}

# Copy OpenSSL DLLs using pattern matching (handles different OpenSSL versions)
$opensslPatterns = @("libcrypto*.dll", "libssl*.dll")
foreach ($pattern in $opensslPatterns) {
$matchingFiles = Get-ChildItem -Path $vcpkgBinPath -Name $pattern -ErrorAction SilentlyContinue
if ($matchingFiles) {
foreach ($file in $matchingFiles) {
$sourcePath = Join-Path $vcpkgBinPath $file
Copy-Item $sourcePath $buildBinPath
Write-Host "Copied: $file (from vcpkg - OpenSSL)"
}
} else {
Write-Host "Warning: No files found matching pattern: $pattern in vcpkg"
}
}
} else {
Write-Host "Warning: vcpkg bin directory not found at: $vcpkgBinPath"
}

foreach ($pattern in $filesToCopy) {
$matchingFiles = Get-ChildItem -Path $rocmBinPath -Name $pattern -ErrorAction SilentlyContinue
if ($matchingFiles) {
Expand Down Expand Up @@ -528,12 +582,13 @@ jobs:
run: |
echo "Installing build dependencies..."
sudo apt update
sudo apt install -y cmake ninja-build unzip curl
sudo apt install -y cmake ninja-build unzip curl libcurl4-openssl-dev

# Verify installations
echo "Verifying installations..."
cmake --version
ninja --version
pkg-config --modversion libcurl || echo "pkg-config for libcurl not available, but headers should be installed"
echo "Build dependencies installation completed"

- name: Download and extract ROCm directly to /opt/rocm
Expand Down Expand Up @@ -721,9 +776,9 @@ jobs:
-DGGML_HIP=ON \
-DGGML_OPENMP=OFF \
-DGGML_CUDA_FORCE_CUBLAS=OFF \
-DLLAMA_CURL=ON \
-DGGML_RPC=ON \
-DGGML_HIP_ROCWMMA_FATTN=OFF \
-DLLAMA_CURL=OFF \
-DGGML_NATIVE=OFF \
-DGGML_STATIC=OFF \
-DCMAKE_SYSTEM_NAME=Linux
Expand Down