Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
80 commits
Select commit Hold shift + click to select a range
f4bd736
Windows asm/ABI and runtime fixes
hoffmang9 Feb 7, 2026
e7f37d7
CMake: Windows + perf experiment options
hoffmang9 Feb 7, 2026
003ecf3
CI: perf experiments and Windows benchmarking
hoffmang9 Feb 7, 2026
b1d9057
ci: streamline test workflow
hoffmang9 Feb 7, 2026
71121ab
build: remove perf-only CMake toggles
hoffmang9 Feb 7, 2026
679a387
core: gate AVX logging behind env flag
hoffmang9 Feb 7, 2026
70c50ac
asm: document Windows ABI restore
hoffmang9 Feb 7, 2026
e89c805
docs: remove Windows perf notes
hoffmang9 Feb 7, 2026
980b697
Nit note in README and clean up some language in test.yaml
hoffmang9 Feb 7, 2026
d04e5fb
Fix step name
hoffmang9 Feb 7, 2026
ad87252
various workflow clean ups and fix AVX512 flag
hoffmang9 Feb 9, 2026
5a7ee42
fix windows runners in test.yaml
hoffmang9 Feb 9, 2026
880d11f
more cmake instruction issues
hoffmang9 Feb 9, 2026
f3a5229
harden finding boost on Mac intel
hoffmang9 Feb 9, 2026
d713c5e
now cmake isn't always there...
hoffmang9 Feb 9, 2026
8fc91e6
more install cmake
hoffmang9 Feb 9, 2026
313c353
fix ASAN, remove TSAN for windows runners
hoffmang9 Feb 9, 2026
a9c401f
initiate windows dev env on ASAN runner
hoffmang9 Feb 9, 2026
e4d821e
more ASAN windows issues - harden brew handling in cibuildwheel
hoffmang9 Feb 9, 2026
7df51ce
giving up on ASAN
hoffmang9 Feb 9, 2026
f0e2ce6
Add required linker flag for Windows asm - fix unchecked vector access
hoffmang9 Feb 9, 2026
dc36ee8
potentially fix bug in the 2weso test
hoffmang9 Feb 9, 2026
a72c490
consolidate 2weso fail-hunting phases 40-43
hoffmang9 Feb 11, 2026
78092a2
2weso fail hunting 44
hoffmang9 Feb 11, 2026
5f9df6c
2weso fail hunting 45
hoffmang9 Feb 11, 2026
3a5dae4
2weso fail hunting 46
hoffmang9 Feb 11, 2026
5b74a88
cleanup: strip 2weso debug scaffolding after Windows root-cause isola…
hoffmang9 Feb 11, 2026
b364b60
ci - add an asm path to the c++ test path, fix HW headers
hoffmang9 Feb 11, 2026
651ee88
ci - bring windows back around to main ubuntu/macos testing
hoffmang9 Feb 11, 2026
34223d3
address cursor review issues
hoffmang9 Feb 11, 2026
ba2c55c
everything on windows should take the asm path
hoffmang9 Feb 11, 2026
e5db303
something about the windows asm path is broken
hoffmang9 Feb 11, 2026
f9b2efa
and we are off again searching for the asm issue
hoffmang9 Feb 11, 2026
14bf670
cache all the things and chase the asm issue
hoffmang9 Feb 11, 2026
52e9b56
look closer at the ubuntu vs windows asm changes
hoffmang9 Feb 11, 2026
bde8394
Consolidate Windows asm investigation commits 1-17.
hoffmang9 Feb 11, 2026
0e07a15
Fix Windows asm CI and align optimized test coverage (#304)
hoffmang9 Feb 12, 2026
9e88b65
cleanup: finalize Windows asm follow-ups and include hygiene
hoffmang9 Feb 12, 2026
3f22222
fix windows avx512 add table rip-relative access
hoffmang9 Feb 12, 2026
73f2585
Remove unused max_test_iteration in 2weso_test.
hoffmang9 Feb 12, 2026
5645703
fix gcd_unsigned compare against end_index
hoffmang9 Feb 12, 2026
afcd784
Harden callback state synchronization and update build/runtime tuning…
hoffmang9 Feb 12, 2026
c3e10d2
Guard POSIX-only emulator hardware targets on Windows.
hoffmang9 Feb 12, 2026
16b5466
Initialize FastAlgorithmCallback forms_capacity.
hoffmang9 Feb 12, 2026
96abd39
Harden macOS/Windows gcd_unsigned dispatch bounds check.
hoffmang9 Feb 12, 2026
f5a7eef
Define CHIAOSX for macOS CMake asm generation.
hoffmang9 Feb 12, 2026
01e8da9
Refine Windows asm argument handling and remove unused SEH include.
hoffmang9 Feb 12, 2026
24de3c8
ci(hw): add cross-platform HW workflow and FT4222 installers.
hoffmang9 Feb 12, 2026
0a6a595
build(hw): refactor HW target wiring for cross-platform CMake and Make.
hoffmang9 Feb 12, 2026
9228710
core: reduce two-weso hot-path contention and fix Windows weak-symbol…
hoffmang9 Feb 12, 2026
79ec9d8
hw-runtime: harden emulator and driver portability paths.
hoffmang9 Feb 12, 2026
059b441
hw-tools: stabilize client, proof, and test integration on Windows.
hoffmang9 Feb 12, 2026
0a1e1cf
core: apply low-level portability cleanup for allocation and bqfc cod…
hoffmang9 Feb 12, 2026
b040ec1
hw-client: fix bytes log format specifiers.
hoffmang9 Feb 12, 2026
4e0745e
hw-client: initialize sock with kInvalidSocket.
hoffmang9 Feb 12, 2026
4475f5e
Merge origin/main into hw-vdf-macos-arm64.
hoffmang9 Feb 13, 2026
7220cac
hw-build: fix HW smoke regressions after main merge.
hoffmang9 Feb 13, 2026
6be75ad
hw-proof: align Prover GetForm ABI across prover stacks.
hoffmang9 Feb 13, 2026
7497450
callback: restore one-weso bounds guard in iteration callback.
hoffmang9 Feb 13, 2026
4ab97b0
hw-build: align Windows HW runner with other smoke checks.
hoffmang9 Feb 13, 2026
61e9df8
hw-client: make hw_vdf_client option parsing Windows-safe.
hoffmang9 Feb 13, 2026
43e7d7d
hw-client: use Windows-compatible signal handlers in hw_vdf_client.
hoffmang9 Feb 13, 2026
e7441db
callback: harden one-weso capacity calculation.
hoffmang9 Feb 13, 2026
173222e
callback: publish two-weso switch state with release semantics.
hoffmang9 Feb 13, 2026
54e60ef
parameters: gate AVX runtime flags on OS state.
hoffmang9 Feb 13, 2026
c5414c4
parameters: keep AVX force flags OS-state safe.
hoffmang9 Feb 13, 2026
c0e4db7
callback: atomically snapshot two-weso switch metadata
hoffmang9 Feb 13, 2026
a3abd4e
hw-client: balance Winsock startup/cleanup on early exits
hoffmang9 Feb 13, 2026
443ff5e
callback: lock two-weso transition publication
hoffmang9 Feb 13, 2026
8638d3a
hw-client: parse positional args independently from flags
hoffmang9 Feb 13, 2026
dbe773c
hw-client: reject invalid positional ports
hoffmang9 Feb 13, 2026
6fc4528
hw-client: harden Winsock cleanup with RAII
hoffmang9 Feb 13, 2026
54f7b8b
callback: harden two-weso transition snapshot semantics
hoffmang9 Feb 13, 2026
06db65d
Fix "One Definition Rule" Violation for Prover::GetForm
xearl4 Feb 16, 2026
3fc72ee
prover: align GetForm return semantics across stacks
hoffmang9 Feb 16, 2026
ab7b7c7
asm: add Linux track_asm addressing A/B benchmark path
hoffmang9 Feb 17, 2026
4a87a5e
ci: fix Linux benchmark clean target and shorten Ubuntu 2weso
hoffmang9 Feb 17, 2026
8d0d0d3
ci+asm: revert temporary addressing experiment and restore Linux abso…
hoffmang9 Feb 17, 2026
76b8207
merge main and adopt canonical prover headers for hw builds
hoffmang9 Feb 17, 2026
e42cabd
hw-client: link prover_runtime in makefile hw targets
hoffmang9 Feb 17, 2026
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
163 changes: 154 additions & 9 deletions .github/workflows/hw-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ permissions:

jobs:
build-hw:
name: Build HW VDF Client
name: Build HW VDF Client (Ubuntu)
runs-on: [ubuntu-22.04]
steps:
- name: Checkout code
Expand All @@ -43,21 +43,25 @@ jobs:
- name: Install deps
run: |
sudo apt-get update
sudo apt-get install -y build-essential cmake libgmp-dev libboost-system-dev
sudo apt-get install -y build-essential cmake libgmp-dev

- name: Download USB drivers
run: |
mkdir libft4222
cd libft4222
wget https://download.chia.net/vdf/libft4222-linux-1.4.4.170.tgz
tar -xvzf libft4222-linux-1.4.4.170.tgz
ln -s ${{ github.workspace }}/libft4222 ${{ github.workspace }}/src/hw/libft4222
ln -s ${{ github.workspace }}/libft4222/build-x86_64/libft4222.so.1.4.4.170 ${{ github.workspace }}/libft4222/build-x86_64/libft4222.so
run: ./scripts/get-libft4222.sh install

- name: Compile
working-directory: "${{ github.workspace }}/src"
run: make -f Makefile.vdf-client emu_hw_test hw_test emu_hw_vdf_client hw_vdf_client

- name: Smoke test
working-directory: "${{ github.workspace }}/src"
run: |
# CI runners do not have FT4222 hardware attached; only validate binaries exist.
test -x ./hw_vdf_client
test -x ./hw_test
echo "Running emu_hw_test"
./emu_hw_test 1 2000
./emu_hw_vdf_client --list

- name: Upload Artifacts
uses: actions/upload-artifact@v5
with:
Expand Down Expand Up @@ -119,3 +123,144 @@ jobs:
glue_url: ${{ secrets.GLUE_API_URL }}
glue_project: "chiavdf-hw"
glue_path: "trigger"

build-hw-macos-arm64:
name: Build HW VDF Client (macOS arm64)
runs-on: [macos-13-arm64]
steps:
- name: Checkout code
uses: actions/checkout@v6
with:
fetch-depth: 0

- uses: Chia-Network/actions/setup-python@main
name: Install Python
with:
python-version: "3.10"

- name: Set Env
uses: Chia-Network/actions/setjobenv@main
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- name: Install deps
run: |
brew ls --versions gmp >/dev/null 2>&1 || brew install gmp

- name: Download USB drivers (FT4222H)
run: ./scripts/get-libft4222.sh install

- name: Compile
working-directory: "${{ github.workspace }}/src"
run: make -f Makefile.vdf-client emu_hw_test hw_test emu_hw_vdf_client hw_vdf_client

- name: Smoke test
working-directory: "${{ github.workspace }}/src"
run: |
# CI runners do not have FT4222 hardware attached; only validate binaries exist.
test -x ./hw_vdf_client
test -x ./hw_test
echo "Running emu_hw_test"
./emu_hw_test 1 2000
./emu_hw_vdf_client --list

- name: Upload Artifacts
uses: actions/upload-artifact@v5
with:
name: hw-vdf-macos-arm64
path: |
${{ github.workspace }}/src/emu_hw_test
${{ github.workspace }}/src/hw_test
${{ github.workspace }}/src/hw_vdf_client
${{ github.workspace }}/src/emu_hw_vdf_client
${{ github.workspace }}/src/hw/libft4222/libft4222.dylib
${{ github.workspace }}/src/hw/libft4222/libft4222.1.4.4.190.dylib
${{ github.workspace }}/src/hw/libft4222/libftd2xx.dylib

build-hw-windows:
name: Build HW VDF Client (Windows)
runs-on: [windows-latest]
steps:
- name: Checkout code
uses: actions/checkout@v6
with:
fetch-depth: 1

- name: Set Env
uses: Chia-Network/actions/setjobenv@main
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- name: Checkout mpir for Windows
uses: actions/checkout@v6
with:
repository: Chia-Network/mpir_gc_x64
fetch-depth: 1
path: mpir_gc_x64

- name: Install LLVM and Ninja on Windows
shell: pwsh
run: |
$llvmBin = "C:\Program Files\LLVM\bin\clang-cl.exe"
$ninjaBin = "C:\ProgramData\chocolatey\bin\ninja.exe"
if (-not (Test-Path $llvmBin) -or -not (Test-Path $ninjaBin)) {
choco install llvm ninja -y
}
"C:\Program Files\LLVM\bin" | Out-File -Append -FilePath $env:GITHUB_PATH

- name: Set up MSVC environment (Windows SDK + CRT libs)
uses: ilammy/msvc-dev-cmd@v1
with:
arch: x64

- name: Download USB drivers (FT4222H)
run: powershell -ExecutionPolicy Bypass -File scripts/get-libft4222.ps1 install

- name: Configure hw tools
shell: pwsh
run: |
cmake -S src -B build -G Ninja -DCMAKE_BUILD_TYPE=Release -DCMAKE_TRY_COMPILE_CONFIGURATION=Release -DCMAKE_MSVC_RUNTIME_LIBRARY=MultiThreadedDLL -DCMAKE_C_COMPILER=clang-cl -DCMAKE_CXX_COMPILER=clang-cl -DCMAKE_ASM_COMPILER=clang-cl -DBUILD_PYTHON=OFF -DBUILD_CHIAVDFC=OFF -DBUILD_HW_TOOLS=ON

- name: Build hw tools
shell: pwsh
run: |
cmake --build build --target emu_hw_test
cmake --build build --target hw_test
cmake --build build --target emu_hw_vdf_client
cmake --build build --target hw_vdf_client

Comment thread
hoffmang9 marked this conversation as resolved.
- name: Smoke test
working-directory: "${{ github.workspace }}/build"
shell: pwsh
run: |
# Keep native stderr as log output; emu binaries log diagnostics there.
$PSNativeCommandUseErrorActionPreference = $false
$dllPaths = @()
if (Test-Path "$env:GITHUB_WORKSPACE\mpir_gc_x64") { $dllPaths += "$env:GITHUB_WORKSPACE\mpir_gc_x64" }
if (Test-Path "$env:GITHUB_WORKSPACE\src\hw\libft4222") { $dllPaths += "$env:GITHUB_WORKSPACE\src\hw\libft4222" }
if ($dllPaths.Count -gt 0) { $env:PATH = ($dllPaths -join ';') + ';' + $env:PATH }
if (-not (Test-Path ".\hw_test.exe")) { throw "hw_test.exe is missing" }
if (-not (Test-Path ".\hw_vdf_client.exe")) { throw "hw_vdf_client.exe is missing" }
Write-Host "hw_test.exe and hw_vdf_client.exe present"
Write-Host "Running emu_hw_test"
.\emu_hw_test.exe 1 2000
if ($LASTEXITCODE -ne 0) { throw "emu_hw_test failed with exit code $LASTEXITCODE" }
Write-Host "emu_hw_test completed"
Write-Host "Running emu_hw_vdf_client --list"
.\emu_hw_vdf_client.exe --list
if ($LASTEXITCODE -ne 0) { throw "emu_hw_vdf_client --list failed with exit code $LASTEXITCODE" }
Write-Host "emu_hw_vdf_client --list completed"

- name: Upload Artifacts
uses: actions/upload-artifact@v5
with:
name: hw-vdf-windows
path: |
${{ github.workspace }}/build/emu_hw_test.exe
${{ github.workspace }}/build/hw_test.exe
${{ github.workspace }}/build/emu_hw_vdf_client.exe
${{ github.workspace }}/build/hw_vdf_client.exe
${{ github.workspace }}/src/hw/libft4222/libft4222.dll
${{ github.workspace }}/src/hw/libft4222/ftd2xx.dll
${{ github.workspace }}/src/hw/libft4222/libft4222.lib
${{ github.workspace }}/src/hw/libft4222/ftd2xx.lib
174 changes: 174 additions & 0 deletions scripts/get-libft4222.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,174 @@
Param(
[Parameter(Mandatory = $false)]
[ValidateSet("install", "clean")]
[string]$Action = "install"
)

$ErrorActionPreference = "Stop"

$RootDir = Resolve-Path (Join-Path $PSScriptRoot "..")
$SrcDir = Join-Path $RootDir "src"
$WorkDir = Join-Path $SrcDir "libft4222"
$HwDir = Join-Path $SrcDir "hw\libft4222"

$ZipUrl = "https://download.chia.net/vdf/LibFT4222-v1.4.8.zip"
$ZipPath = Join-Path $WorkDir "LibFT4222-v1.4.8.zip"
$ExtractDir = Join-Path $WorkDir "extract"

Add-Type -AssemblyName System.IO.Compression.FileSystem

function Ensure-Dir {
param([string]$Path)
if (-not (Test-Path $Path)) {
New-Item -ItemType Directory -Path $Path | Out-Null
}
}

function Choose-Best {
param([System.IO.FileInfo[]]$Items)
if (-not $Items -or $Items.Count -eq 0) {
return $null
}
$preferred = $Items | Where-Object { $_.FullName -match "(x64|amd64|win64)" }
if ($preferred -and $preferred.Count -gt 0) {
return $preferred[0]
}
return $Items[0]
}

function Find-Header {
param(
[string]$BaseName,
[string[]]$Alternates = @()
)
$names = @($BaseName) + $Alternates
foreach ($name in $names) {
$match = Get-ChildItem -Path $ExtractDir -Recurse -File |
Where-Object { $_.Name -ieq $name } |
Select-Object -First 1
if ($match) {
return $match
}
}
return $null
}

function Test-ZipValid {
param([string]$Path)
if (-not (Test-Path $Path)) {
return $false
}
$zip = $null
try {
$zip = [System.IO.Compression.ZipFile]::OpenRead($Path)
$null = $zip.Entries.Count
return $true
} catch {
return $false
} finally {
if ($zip) {
$zip.Dispose()
}
}
Comment thread
cursor[bot] marked this conversation as resolved.
}

function Download-With-Retry {
param(
[string]$Url,
[string]$Path,
[int]$Attempts = 3
)
for ($attempt = 1; $attempt -le $Attempts; $attempt++) {
if (Test-Path $Path) {
Remove-Item $Path -Force
}
try {
Invoke-WebRequest -Uri $Url -OutFile $Path -MaximumRedirection 5
} catch {
if ($attempt -eq $Attempts) {
throw
}
Start-Sleep -Seconds (2 * $attempt)
continue
}
if (Test-ZipValid $Path) {
return
}
Write-Warning "Downloaded zip failed validation (attempt $attempt/$Attempts)."
Start-Sleep -Seconds (2 * $attempt)
}
throw "Failed to download a valid zip from $Url after $Attempts attempts."
}

function Install-LibFT4222 {
Ensure-Dir $WorkDir
if (Test-Path $ExtractDir) {
Remove-Item $ExtractDir -Recurse -Force
}

Download-With-Retry -Url $ZipUrl -Path $ZipPath -Attempts 3
Expand-Archive -Path $ZipPath -DestinationPath $ExtractDir -Force

$headers = @(
@{ Name = "libft4222.h"; Alternates = @() },
@{ Name = "ftd2xx.h"; Alternates = @() },
@{ Name = "WinTypes.h"; Alternates = @("wintypes.h") }
)
foreach ($header in $headers) {
$match = Find-Header -BaseName $header.Name -Alternates $header.Alternates
if (-not $match) {
if ($header.Name -eq "WinTypes.h") {
$stubPath = Join-Path $WorkDir $header.Name
@"
#pragma once
#ifdef _WIN32
#include <windows.h>
#endif
"@ | Set-Content -Path $stubPath -Encoding ASCII
continue
}
throw "Missing required header: $($header.Name)"
}
Copy-Item $match.FullName -Destination (Join-Path $WorkDir $header.Name) -Force
}

$libftLib = Choose-Best (Get-ChildItem -Path $ExtractDir -Recurse -Filter "libft4222*.lib")
$ftdLib = Choose-Best (Get-ChildItem -Path $ExtractDir -Recurse -Filter "ftd2xx*.lib")
$libftDll = Choose-Best (Get-ChildItem -Path $ExtractDir -Recurse -Filter "libft4222*.dll")
$ftdDll = Choose-Best (Get-ChildItem -Path $ExtractDir -Recurse -Filter "ftd2xx*.dll")

if (-not $libftLib -or -not $ftdLib) {
throw "Missing required .lib files in extracted package"
}
if (-not $libftDll -or -not $ftdDll) {
throw "Missing required .dll files in extracted package"
}

Copy-Item $libftLib.FullName -Destination (Join-Path $WorkDir "libft4222.lib") -Force
Copy-Item $ftdLib.FullName -Destination (Join-Path $WorkDir "ftd2xx.lib") -Force
Copy-Item $libftDll.FullName -Destination (Join-Path $WorkDir "libft4222.dll") -Force
Copy-Item $ftdDll.FullName -Destination (Join-Path $WorkDir "ftd2xx.dll") -Force

if (Test-Path $HwDir) {
Remove-Item $HwDir -Recurse -Force
}
Ensure-Dir $HwDir

Copy-Item (Join-Path $WorkDir "*.h") -Destination $HwDir -Force
Copy-Item (Join-Path $WorkDir "*.lib") -Destination $HwDir -Force
Copy-Item (Join-Path $WorkDir "*.dll") -Destination $HwDir -Force
}

function Clean-LibFT4222 {
if (Test-Path $WorkDir) {
Remove-Item $WorkDir -Recurse -Force
}
if (Test-Path $HwDir) {
Remove-Item $HwDir -Recurse -Force
}
}

switch ($Action) {
"install" { Install-LibFT4222 }
"clean" { Clean-LibFT4222 }
}
Loading
Loading