Skip to content

Commit 767a534

Browse files
Integrate ARM64 NUDUPL and add MASM VDF path and harden Windows CI/builds (#300)
* Windows asm/ABI and runtime fixes * CMake: Windows + perf experiment options * CI: perf experiments and Windows benchmarking * ci: streamline test workflow * build: remove perf-only CMake toggles * core: gate AVX logging behind env flag * asm: document Windows ABI restore * docs: remove Windows perf notes * Nit note in README and clean up some language in test.yaml * Fix step name * various workflow clean ups and fix AVX512 flag * fix windows runners in test.yaml * more cmake instruction issues * harden finding boost on Mac intel * now cmake isn't always there... * more install cmake * fix ASAN, remove TSAN for windows runners * initiate windows dev env on ASAN runner * more ASAN windows issues - harden brew handling in cibuildwheel * giving up on ASAN * Add required linker flag for Windows asm - fix unchecked vector access * potentially fix bug in the 2weso test * consolidate 2weso fail-hunting phases 40-43 Collapse the contiguous phase-40 through phase-43 debug commits into one checkpoint while preserving the net tree state before phase 44. Co-authored-by: Cursor <cursoragent@cursor.com> * 2weso fail hunting 44 * 2weso fail hunting 45 * 2weso fail hunting 46 * cleanup: strip 2weso debug scaffolding after Windows root-cause isolation * ci - add an asm path to the c++ test path, fix HW headers * ci - bring windows back around to main ubuntu/macos testing * address cursor review issues * everything on windows should take the asm path * something about the windows asm path is broken * and we are off again searching for the asm issue * cache all the things and chase the asm issue * look closer at the ubuntu vs windows asm changes * Consolidate Windows asm investigation commits 1-17. Squash iterative CI and asm-path probing changes into one reviewable checkpoint before the final CI fix commit. Co-authored-by: Cursor <cursoragent@cursor.com> * Fix Windows asm CI and align optimized test coverage (#304) * Instrument Windows asm failures and collect runtime evidence. Add targeted Windows probes and disassembly checks to localize crash offsets and failing asm paths. Co-authored-by: Cursor <cursoragent@cursor.com> * Fix Windows asm addressing to be ASLR-safe. Convert global and table references to RIP-relative forms for Windows asm generation paths. Co-authored-by: Cursor <cursoragent@cursor.com> * Stabilize Windows gcd_unsigned dispatch control flow. Correct dispatch indexing and use explicit compare/branch selection to avoid executing table data. Co-authored-by: Cursor <cursoragent@cursor.com> * Fix Windows CI probe exit-code handling. Ensure PowerShell helpers compare integer process exit codes so successful probes do not fail the workflow. Co-authored-by: Cursor <cursoragent@cursor.com> * Remove temporary Windows debug instrumentation. Drop crash-debug hooks and probes after validation, including the final vdf_fast cleanup. Co-authored-by: Cursor <cursoragent@cursor.com> * Align Windows optimized test coverage with other runners. Run the full optimized test set in the Windows PowerShell test step by removing ad-hoc iteration args and adding prover_test with fast mode. Co-authored-by: Cursor <cursoragent@cursor.com> * Clean up leftover no-op debug checks in fast path and tighten macOS-only branch selection in gcd_unsigned. This removes empty instrumentation cleanup blocks and keeps the dispatch path logic aligned with platform-specific behavior. Co-authored-by: Cursor <cursoragent@cursor.com> * Restore Windows jump-table dispatch path in gcd_unsigned. This reverts an accidental macOS-only condition change from the prior cleanup commit that caused 1weso_test to crash on Windows CI. Co-authored-by: Cursor <cursoragent@cursor.com> --------- Co-authored-by: Cursor <cursoragent@cursor.com> * cleanup: finalize Windows asm follow-ups and include hygiene Tighten Windows asm/runtime plumbing and related docs/tests while removing stale duplicate include clutter from vdf headers. Co-authored-by: Cursor <cursoragent@cursor.com> * fix windows avx512 add table rip-relative access Include CHIA_WINDOWS in the avx512_add_table addressing branch so Windows emits LEA+ADD RIP-relative access instead of absolute table addressing. Co-authored-by: Cursor <cursoragent@cursor.com> * Remove unused max_test_iteration in 2weso_test. Drop dead local state that was computed and immediately discarded to avoid implying a missing iteration guard. Co-authored-by: Cursor <cursoragent@cursor.com> * fix gcd_unsigned compare against end_index Use end_index instead of size in the jump-table compare to match the mapped index logic and avoid incorrect branch selection. Co-authored-by: Cursor <cursoragent@cursor.com> * Harden callback state synchronization and update build/runtime tuning docs. This captures the current branch updates, including the TwoWesolowski position-locking fix and related CMake/parameter/readme adjustments for current CI work. Co-authored-by: Cursor <cursoragent@cursor.com> * Guard POSIX-only emulator hardware targets on Windows. Prevent `emu_hw_test` and `emu_hw_vdf_client` from being defined on Windows so CMake does not try to compile sources that depend on POSIX headers. Co-authored-by: Cursor <cursoragent@cursor.com> * Initialize FastAlgorithmCallback forms_capacity. Set forms_capacity when allocating FastAlgorithmCallback forms so all WesolowskiCallback subclasses consistently initialize capacity metadata for safe bounds checks. Co-authored-by: Cursor <cursoragent@cursor.com> * Harden macOS/Windows gcd_unsigned dispatch bounds check. Add the same a_end_index range guard used on Linux before the CMP/JE chain so out-of-range values jump to the error path instead of falling through to a kernel label. Co-authored-by: Cursor <cursoragent@cursor.com> * Define CHIAOSX for macOS CMake asm generation. Match the Makefile behavior so compile_asm emits Mach-O-compatible assembly on Intel macOS instead of falling back to Linux/ELF code paths. Co-authored-by: Cursor <cursoragent@cursor.com> * Refine Windows asm argument handling and remove unused SEH include. Allow asm_function Windows stack-arg loading to be toggled for internal call sites, and drop dead <excpt.h> from threading since no SEH constructs are used. Co-authored-by: Cursor <cursoragent@cursor.com> * Preserve non-Windows asm behavior and gate fallback logging. Keep Linux absolute addressing and restore macOS/Linux jump-dispatch parity with main, while making detached-thread fallback logging debug-only. Co-authored-by: Cursor <cursoragent@cursor.com> * Reply to Opus review with dispatch, bounds, and const-correctness fixes. This replies to Opus review feedback by fixing macOS gcd_unsigned end-index dispatch, aligning bounds checks across platforms and callbacks, enabling Windows AVX512 CI coverage, and removing unused asm/cast paths. Co-authored-by: Cursor <cursoragent@cursor.com> * Avoid synchronous fallback in TwoWesolowski prover start. Make prover form retrieval value-based and throw on thread-start failure so TwoWesolowski recursion preserves parallel proof generation instead of silently serializing work. Co-authored-by: Cursor <cursoragent@cursor.com> * Gate AVX512 IFMA dispatch on OS XSAVE/XCR0 state. Require OSXSAVE and XCR0 ZMM/opmask state in init_avx_flags() before enabling AVX-512 IFMA to prevent illegal-instruction crashes on unsupported OS configurations. Co-authored-by: Cursor <cursoragent@cursor.com> --------- Co-authored-by: Cursor <cursoragent@cursor.com>
1 parent 39fe3aa commit 767a534

33 files changed

Lines changed: 1020 additions & 127 deletions

.github/workflows/rust.yml

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -124,6 +124,23 @@ jobs:
124124
if: matrix.os.name == 'macOS'
125125
run: echo "LIBRARY_PATH=$(brew --prefix)/lib:$LIBRARY_PATH" >> $GITHUB_ENV
126126

127+
- name: Install CMake on MacOS
128+
if: matrix.os.name == 'macOS'
129+
run: |
130+
brew ls --versions cmake >/dev/null 2>&1 || brew install cmake
131+
CMAKE_BIN="$(brew --prefix cmake)/bin"
132+
if [ -d "$CMAKE_BIN" ]; then
133+
echo "$CMAKE_BIN" >> "$GITHUB_PATH"
134+
export PATH="$CMAKE_BIN:$PATH"
135+
fi
136+
if ! command -v cmake >/dev/null 2>&1; then
137+
BREW_BIN="$(brew --prefix)/bin"
138+
echo "$BREW_BIN" >> "$GITHUB_PATH"
139+
export PATH="$BREW_BIN:$PATH"
140+
fi
141+
command -v cmake
142+
cmake --version
143+
127144
- name: Install MPIR on Windows
128145
if: matrix.os.name == 'Windows'
129146
run: |

.github/workflows/test.yaml

Lines changed: 194 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -14,11 +14,18 @@ jobs:
1414
test:
1515
name: Test ${{ matrix.config }} ${{ matrix.os }}
1616
runs-on: ${{ matrix.os }}
17+
env:
18+
CHIAVDF_LOG_AVX: "1"
1719
strategy:
1820
fail-fast: false
1921
matrix:
20-
os: [macos-13-intel, macos-13-arm64, ubuntu-latest]
22+
os: [macos-13-intel, macos-13-arm64, ubuntu-latest, windows-latest]
2123
config: [optimized=1, TSAN=1, ASAN=1]
24+
exclude:
25+
- os: windows-latest
26+
config: ASAN=1
27+
- os: windows-latest
28+
config: TSAN=1
2229

2330
steps:
2431
- name: Checkout code
@@ -43,12 +50,145 @@ jobs:
4350
- name: Build vdf-client on Mac
4451
if: startsWith(matrix.os, 'mac')
4552
run: |
46-
brew install boost
53+
brew ls --versions boost >/dev/null 2>&1 || brew install boost
54+
BOOST_VERSION="$(brew list --versions boost | awk '{print $2}')"
55+
BOOST_INCLUDE=""
56+
for cand in \
57+
"$(brew --prefix boost)/include" \
58+
"$(brew --prefix)/include" \
59+
"$(brew --cellar boost)/${BOOST_VERSION}/include"; do
60+
if [ -f "$cand/boost/asio.hpp" ]; then
61+
BOOST_INCLUDE="$cand"
62+
break
63+
fi
64+
done
65+
if [ -z "$BOOST_INCLUDE" ]; then
66+
echo "Could not locate boost/asio.hpp for brew boost=${BOOST_VERSION}" >&2
67+
brew --prefix boost || true
68+
brew --cellar boost || true
69+
brew info boost || true
70+
exit 1
71+
fi
4772
cd src
48-
make ${{ matrix.config }} -f Makefile.vdf-client
73+
make ${{ matrix.config }} CPPFLAGS="-I${BOOST_INCLUDE} ${CPPFLAGS:-}" -f Makefile.vdf-client
74+
75+
- name: Cache Boost on Windows
76+
if: startsWith(matrix.os, 'windows')
77+
id: cache-boost
78+
uses: actions/cache/restore@v4
79+
with:
80+
path: C:\local\boost_*
81+
key: windows-boost-msvc-14.3-v1
4982

50-
- name: Test vdf-client
51-
if: matrix.config == 'optimized=1'
83+
- name: Install LLVM and Ninja on Windows
84+
if: startsWith(matrix.os, 'windows')
85+
shell: pwsh
86+
env:
87+
BOOST_CACHE_HIT: ${{ steps.cache-boost.outputs.cache-hit }}
88+
run: |
89+
$llvmBin = "C:\Program Files\LLVM\bin\clang-cl.exe"
90+
$ninjaBin = "C:\ProgramData\chocolatey\bin\ninja.exe"
91+
if (-not (Test-Path $llvmBin) -or -not (Test-Path $ninjaBin)) {
92+
Write-Host "LLVM/Ninja not found, installing via choco"
93+
choco install llvm ninja -y
94+
} else {
95+
Write-Host "LLVM and Ninja already present, skipping choco install"
96+
}
97+
98+
$boostDir = Get-ChildItem "C:\local" -Directory -Filter "boost_*" -ErrorAction SilentlyContinue | Select-Object -First 1
99+
if (-not $boostDir) {
100+
if ("$env:BOOST_CACHE_HIT" -ne "true") {
101+
Write-Host "Boost cache miss and boost not found, installing boost-msvc-14.3"
102+
choco install boost-msvc-14.3 -y
103+
} else {
104+
Write-Host "Boost cache reported hit but boost directory missing; reinstalling boost-msvc-14.3"
105+
choco install boost-msvc-14.3 -y
106+
}
107+
$boostDir = Get-ChildItem "C:\local" -Directory -Filter "boost_*" -ErrorAction SilentlyContinue | Select-Object -First 1
108+
} else {
109+
Write-Host "Boost already present at $($boostDir.FullName), skipping choco install"
110+
}
111+
112+
"C:\Program Files\LLVM\bin" | Out-File -Append -FilePath $env:GITHUB_PATH
113+
# Enable AVX-512 IFMA codegen in CI; runtime dispatch remains CPUID-gated.
114+
"CHIA_ENABLE_AVX512_IFMA=1" | Out-File -Append -FilePath $env:GITHUB_ENV
115+
if (-not $boostDir) {
116+
throw "Boost install not found under C:\local"
117+
}
118+
"BOOST_INCLUDE_DIR=$($boostDir.FullName)" | Out-File -Append -FilePath $env:GITHUB_ENV
119+
120+
- name: Save Boost cache on Windows
121+
if: startsWith(matrix.os, 'windows') && steps.cache-boost.outputs.cache-hit != 'true'
122+
uses: actions/cache/save@v4
123+
with:
124+
path: C:\local\boost_*
125+
key: ${{ steps.cache-boost.outputs.cache-primary-key }}
126+
127+
- name: Cache mpir checkout on Windows
128+
if: startsWith(matrix.os, 'windows')
129+
id: cache-mpir
130+
uses: actions/cache@v4
131+
with:
132+
path: mpir_gc_x64
133+
key: windows-mpir-gc-x64-v1
134+
135+
- name: Checkout mpir for Windows
136+
if: startsWith(matrix.os, 'windows') && steps.cache-mpir.outputs.cache-hit != 'true'
137+
uses: actions/checkout@v6
138+
with:
139+
repository: Chia-Network/mpir_gc_x64
140+
fetch-depth: 1
141+
path: mpir_gc_x64
142+
143+
- name: Set up MSVC environment (Windows SDK + CRT libs)
144+
if: startsWith(matrix.os, 'windows')
145+
uses: ilammy/msvc-dev-cmd@v1
146+
with:
147+
arch: x64
148+
149+
- name: Build vdf-client on Windows
150+
if: startsWith(matrix.os, 'windows')
151+
shell: pwsh
152+
run: |
153+
$cmakeBuildType = "Release"
154+
$cmakeArgs = @(
155+
"-S", "src",
156+
"-B", "build",
157+
"-G", "Ninja",
158+
"-DCMAKE_BUILD_TYPE=$cmakeBuildType",
159+
"-DCMAKE_TRY_COMPILE_CONFIGURATION=Release",
160+
"-DCMAKE_MSVC_RUNTIME_LIBRARY=MultiThreadedDLL",
161+
"-DCMAKE_C_COMPILER=clang-cl",
162+
"-DCMAKE_CXX_COMPILER=clang-cl",
163+
"-DCMAKE_ASM_COMPILER=clang-cl",
164+
"-DBOOST_INCLUDE_DIR=$env:BOOST_INCLUDE_DIR",
165+
"-DBUILD_PYTHON=OFF",
166+
"-DBUILD_CHIAVDFC=OFF",
167+
"-DBUILD_VDF_CLIENT=ON",
168+
"-DBUILD_VDF_BENCH=ON",
169+
"-DBUILD_VDF_TESTS=ON",
170+
"-DBUILD_HW_TOOLS=OFF",
171+
"-DENABLE_GNU_ASM=ON"
172+
)
173+
& cmake @cmakeArgs
174+
$gnuAsmEnabled = (& cmake -N -L build | Select-String '^ENABLE_GNU_ASM:BOOL=ON$')
175+
if (-not $gnuAsmEnabled) {
176+
throw "ENABLE_GNU_ASM is not ON on Windows CI build"
177+
}
178+
cmake --build build --target vdf_client vdf_bench 1weso_test 2weso_test prover_test
179+
$asmFiles = @(
180+
"build/asm_compiled.s",
181+
"build/avx2_asm_compiled.s",
182+
"build/avx512_asm_compiled.s"
183+
)
184+
foreach ($asmFile in $asmFiles) {
185+
if (-not (Test-Path $asmFile)) {
186+
throw "Expected generated asm output not found: $asmFile"
187+
}
188+
}
189+
190+
- name: Run vdf tests (optimized)
191+
if: matrix.config == 'optimized=1' && !startsWith(matrix.os, 'windows')
52192
run: |
53193
cd src
54194
echo "Running 1weso_test"
@@ -62,8 +202,8 @@ jobs:
62202
CHIAVDF_PROVER_TEST_FAST=1 ./prover_test
63203
fi
64204
65-
- name: Test vdf-client
66-
if: matrix.config != 'optimized=1'
205+
- name: Run vdf tests (short)
206+
if: matrix.config != 'optimized=1' && !startsWith(matrix.os, 'windows')
67207
run: |
68208
cd src
69209
echo "Running 1weso_test"
@@ -75,7 +215,7 @@ jobs:
75215
# it prints to std::cout from multiple threads. Which is allowed by the
76216
# standard
77217
- name: test Prover
78-
if: matrix.config != 'optimized=1' && (matrix.config != 'TSAN=1' || startsWith(matrix.os, 'ubuntu'))
218+
if: matrix.config != 'optimized=1' && (matrix.config != 'TSAN=1' || startsWith(matrix.os, 'ubuntu')) && !startsWith(matrix.os, 'windows')
79219
run: |
80220
cd src
81221
echo "Running prover_test"
@@ -85,9 +225,51 @@ jobs:
85225
CHIAVDF_PROVER_TEST_FAST=1 ./prover_test
86226
fi
87227
88-
- name: Benchmark vdf-client
89-
if: matrix.config == 'optimized=1'
228+
- name: Test vdf-client (Windows)
229+
if: matrix.config == 'optimized=1' && startsWith(matrix.os, 'windows')
230+
shell: pwsh
231+
run: |
232+
cd build
233+
$dllPaths = @()
234+
if ($env:MPIR_ROOT -and (Test-Path "$env:MPIR_ROOT\bin")) { $dllPaths += "$env:MPIR_ROOT\bin" }
235+
if (Test-Path "$env:GITHUB_WORKSPACE\mpir_gc_x64") { $dllPaths += "$env:GITHUB_WORKSPACE\mpir_gc_x64" }
236+
if ($dllPaths.Count -gt 0) { $env:PATH = ($dllPaths -join ';') + ';' + $env:PATH }
237+
function Invoke-TestExe([string]$name, [string[]]$testArgs = @()) {
238+
Write-Host "Running $name"
239+
& ".\$name.exe" @testArgs
240+
$exitCode = $LASTEXITCODE
241+
if ($exitCode -ne 0) {
242+
Write-Host "$name exit code: $exitCode"
243+
exit $exitCode
244+
}
245+
return $exitCode
246+
}
247+
Write-Host "Running 1weso_test"
248+
Invoke-TestExe "1weso_test"
249+
Write-Host "Running 2weso_test"
250+
Invoke-TestExe "2weso_test"
251+
Write-Host "Running prover_test"
252+
$env:CHIAVDF_PROVER_TEST_FAST = "1"
253+
Invoke-TestExe "prover_test"
254+
255+
- name: Benchmark vdf_bench square (Ubuntu/Mac)
256+
if: matrix.config == 'optimized=1' && !startsWith(matrix.os, 'windows')
90257
run: |
91258
cd src
92-
echo "Benchmarking vdf_client with 400,000 iterations of vdf_bench"
93-
./vdf_bench square_asm 400000
259+
echo "Benchmarking vdf_bench with 2,000,000 iterations of square_asm"
260+
./vdf_bench square_asm 2000000
261+
262+
- name: Benchmark vdf_bench square (Windows)
263+
if: matrix.config == 'optimized=1' && startsWith(matrix.os, 'windows')
264+
shell: pwsh
265+
run: |
266+
cd build
267+
$dllPaths = @()
268+
if ($env:MPIR_ROOT -and (Test-Path "$env:MPIR_ROOT\bin")) { $dllPaths += "$env:MPIR_ROOT\bin" }
269+
if (Test-Path "$env:GITHUB_WORKSPACE\mpir_gc_x64") { $dllPaths += "$env:GITHUB_WORKSPACE\mpir_gc_x64" }
270+
if ($dllPaths.Count -gt 0) { $env:PATH = ($dllPaths -join ';') + ';' + $env:PATH }
271+
Write-Host "Benchmarking vdf_bench with 2,000,000 iterations of square_asm"
272+
& .\vdf_bench.exe square_asm 2000000
273+
Write-Host "vdf_bench exit code: $LASTEXITCODE"
274+
if ($LASTEXITCODE -ne 0) { exit $LASTEXITCODE }
275+

README.md

Lines changed: 36 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -38,12 +38,44 @@ to it by the Timelord. The repo also includes a benchmarking tool to get a
3838
sense of the iterations per second of a given CPU called vdf_bench. Try
3939
`./vdf_bench square_asm 250000` for an ips estimate on x86/x64 (phased/asm
4040
pipeline). On non-x86 architectures, use `./vdf_bench square 250000` (NUDUPL).
41+
Set `CHIAVDF_LOG_AVX=1` to emit AVX feature detection logs during startup.
4142

42-
To build vdf_client set the environment variable BUILD_VDF_CLIENT to "Y".
43-
`export BUILD_VDF_CLIENT=Y`.
43+
For direct CMake builds, the following options are available:
4444

45-
Similarly, to build vdf_bench set the environment variable BUILD_VDF_BENCH to
46-
"Y". `export BUILD_VDF_BENCH=Y`.
45+
- `BUILD_VDF_CLIENT` - build `vdf_client`
46+
- `BUILD_VDF_BENCH` - build `vdf_bench`
47+
- `BUILD_VDF_TESTS` - build `1weso_test`, `2weso_test`, and `prover_test`
48+
- `BUILD_HW_TOOLS` - build hardware timelord tools
49+
- `ENABLE_GNU_ASM` - enable GNU-style asm pipeline on x86/x64 (enabled by default)
50+
- `GENERATE_ASM_TRACKING_DATA` - enable `track_asm()` instrumentation in generated asm (off by default to avoid hot-loop overhead)
51+
52+
Example:
53+
54+
```bash
55+
cmake -S src -B build \
56+
-DBUILD_PYTHON=OFF \
57+
-DBUILD_CHIAVDFC=OFF \
58+
-DBUILD_VDF_CLIENT=ON \
59+
-DBUILD_VDF_BENCH=ON \
60+
-DBUILD_VDF_TESTS=ON
61+
cmake --build build --target vdf_client vdf_bench 1weso_test 2weso_test prover_test
62+
```
63+
64+
For the legacy `setup.py` + `Makefile.vdf-client` flow (used by wheel hooks),
65+
you can control native binary builds with environment variables:
66+
67+
- `BUILD_VDF_CLIENT=Y` to include `vdf_client` (and related test binaries)
68+
- `BUILD_VDF_BENCH=Y` to include `vdf_bench`
69+
For direct CMake builds, use `-DBUILD_*` flags instead of these environment variables.
70+
71+
AVX runtime flags:
72+
73+
- `CHIAVDF_LOG_AVX=1`: emit AVX detection logs at startup
74+
- `CHIA_DISABLE_AVX2=1`: disable AVX2 path even when supported
75+
- `CHIA_FORCE_AVX2=1`: force AVX2 path
76+
- `CHIA_DISABLE_AVX512_IFMA=1`: disable AVX-512 IFMA path
77+
- `CHIA_ENABLE_AVX512_IFMA=1`: enable AVX-512 IFMA path when CPUID support is present
78+
- `CHIA_FORCE_AVX512_IFMA=1`: force AVX-512 IFMA path
4779

4880
This is currently automated via pip in the
4981
[install-timelord.sh](https://github.com/Chia-Network/chia-blockchain/blob/master/install-timelord.sh)

pyproject.toml

Lines changed: 25 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,31 @@ before-build = "python -m pip install --upgrade pip"
3333
[tool.cibuildwheel.macos]
3434
build-verbosity = 0
3535
before-all = """
36-
brew --prefix --installed gmp >/dev/null 2>&1 || brew install gmp
37-
brew install boost cmake
36+
set -euo pipefail
37+
export HOMEBREW_NO_AUTO_UPDATE=1
38+
39+
brew_install_if_missing() {
40+
pkg="$1"
41+
if brew list --versions "$pkg" >/dev/null 2>&1; then
42+
echo "$pkg already installed"
43+
return 0
44+
fi
45+
46+
for attempt in 1 2 3; do
47+
if brew install "$pkg"; then
48+
return 0
49+
fi
50+
echo "brew install $pkg failed (attempt $attempt), retrying..."
51+
sleep $((attempt * 5))
52+
done
53+
54+
echo "Failed to install $pkg after retries"
55+
return 1
56+
}
57+
58+
brew_install_if_missing gmp
59+
brew_install_if_missing boost
60+
brew_install_if_missing cmake
3861
"""
3962
before-build = "python -m pip install --upgrade pip"
4063
environment = {MACOSX_DEPLOYMENT_TARGET="13", SYSTEM_VERSION_COMPAT=0, BUILD_VDF_CLIENT="N"}

src/1weso_test.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,8 @@ int main(int argc, char const* argv[]) try
2626
assert(is_vdf_test); //assertions should be disabled in VDF_MODE==0
2727
init_gmp();
2828
debug_mode = true;
29-
if(hasAVX2())
29+
const bool has_avx2 = hasAVX2();
30+
if(has_avx2)
3031
{
3132
gcd_base_bits=63;
3233
gcd_128_max_iter=2;

0 commit comments

Comments
 (0)