Counter ASIC 3.0 PC 1 AMD: gate G2 on the 9070 XT (the hash lane's form: found lines to g2-<pack>.found, count and sha256 per pack, digest_match against the verifier's digests derived on the Mac), the G2 kit maker with the chain-seed packs, README rows

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
This commit is contained in:
igneum-labs 2026-10-06 16:22:01 +00:00
parent 209ed232e2
commit 2a704cff30
3 changed files with 149 additions and 2 deletions

View file

@ -38,6 +38,7 @@ The fetch lands at `<jobs>\fetch-ca3-pc1-amd-20261006\{bin,packs,src,SHA256SUMS}
|---|---|---|---|---|---|
| 1 | `pc1-amd-g1-shadow.ps1` | `packaging/ota/publish-jobs.sh add --kind run --target ae432dc7 --id run-ca3-pc1-amd-g1-shadow-20261006 --script tools/ca3-pc1-amd/pc1-amd-g1-shadow.ps1 --timeout-minutes 40 --title "CA3 PC 1: G1 + AMD ladder on the 9070 XT" --deploy` | about 15 min (7 benches of 60 to 90 dispatches of 2^24 at 0.9 to 2 s each, the card switch up to 150 s, the installed-worker cross-check 40 dispatches) | 9070 XT ALONE (its worker stopped; 5090 and 4070 keep mining) | G1 for `mx8+sh256x27` on the AMD vendor (section 5: `RESULT G1 pack=sh256x27 fingerprint=3d2e8245cc084d07 match=yes` turns "AMD vendor NOT RUN" green; the other five packs give the same for the ladder); the 9070 XT column of the item 8 tables (section 3: `RESULT LADDER pack=<p> ops=<N> mhs= watts= uj= gclk_mhz=`), where the card leaves the latency bound by the 5 percent rule; item 1's AMD per-joule row from the control (`RESULT LADDER pack=mx8-devnet-epoch0 ... uj=`: section 3 "Consequences per tier (item 1)", 16 GB AMD row); section 7 rows "item 8: the 9070 XT rows", "item 1: the 9070 XT rows" |
| 1b (the watts re-run) | `pc1-amd-watts.ps1` | `packaging/ota/publish-jobs.sh add --kind run --target ae432dc7 --id run-ca3-pc1-amd-watts-20261006 --script tools/ca3-pc1-amd/pc1-amd-watts.ps1 --timeout-minutes 20 --title "CA3 PC 1: watts on the 9070 XT (control + sh256x27)" --deploy` | about 5 min (2 x 100 dispatches at the 18.9 to 19.3 MH/s job 1 measured = 87 to 89 s each, the switch, 12 s of proof) | 9070 XT ALONE | the two `watts= uj=` cells job 1 left owed: item 1's AMD per-joule row (the control) and the candidate's AMD row in the item 8 table (sh256x27); the sampler is proven on the 12 idle seconds first (`RESULT sampler_raw` x3, `RESULT sampler_idle lines= lines_9070_with_watts=`) and the benches do not run without a 9070 XT watts line (`RESULT watts error=<why>`, status failed, card restored) |
| G2 (job 2's slot, after "Ember closed") | `pc1-amd-g2.ps1` | its own small kit first: `tools/ca3-pc1-amd/make-g2-kit.sh "$TMPDIR/igneum-ca3-pc1-amd-g2-kit.zip"` (built 6 October 16:2x UTC: sha256 `f4c029c737740e8b59c68ebc94861bbdede2a968836bb22331677844eea2e7aa`, 198,384 bytes, 35 files; worker exe `1c39e123…`), then `packaging/ota/publish-jobs.sh add --kind fetch --target ae432dc7 --id fetch-ca3-pc1-amd-g2-20261006 --file "$TMPDIR/igneum-ca3-pc1-amd-g2-kit.zip" --dir jobs --extract --title "CA3 PC 1 G2 kit" --deploy`, then `packaging/ota/publish-jobs.sh add --kind run --target ae432dc7 --id run-ca3-pc1-amd-g2-20261006 --script tools/ca3-pc1-amd/pc1-amd-g2.ps1 --timeout-minutes 10 --title "CA3 PC 1: gate G2 on the 9070 XT" --deploy` | about 2 min (two serve-mode jobs of 1,024 nonces; the Apple OpenCL dry run took 2.6 s a pack) | beside the miners (a correctness gate) | the "RX 9070 XT" cell of G2 in `docs/plans/counter-asic-3-gate/hash-gates.md` and the AMD line of G2 in status section 5: `RESULT g2 <pack> found <n> of 1024 distinct=<d> sha256 <digest> file <path> exit=<code>` (the hash lane's form) plus `RESULT G2 pack= found= distinct= digest= digest_match=yes|no`; the found lines go to `g2-<pack>.found` in the job folder, never to stdout; the Mac re-check is `tools/ca3-v4/g2-recheck.sh proto-cuda/packs-ca3-v4/<pack> --digest <hex>` (a digest match is 1,024 of 1,024), or `--file` after `publish-jobs.sh add --kind collect --target ae432dc7 --glob "app/jobs/run-ca3-pc1-amd-g2-20261006/g2-*.found"`. Packs: `packs-ca3-v4/mx8-devnet-epoch0` (control) and `packs-ca3-v4/v4-devnet-epoch0` (the candidate with the era at the devnet epoch-0 chain seeds), NOT the first kit's `sh256x27`: that one is the genesis string-seed pack (`IGNEUM_SEED_BYTES_HEX` of 14 bytes) and the worker's job protocol takes only a 64-hex epoch seed, so it cannot be served (the script refuses such a pack with a RESULT line instead of a malformed job). Expected digests (the verifier through g2-recheck.sh on the Mac, equal to the kit worker's serve mode on Apple OpenCL, 16:21Z, 1,024 of 1,024 both): mx8 `2a1824a2e0834287cf53b33f84cb7322014c85efa9788bece574e4e0730940bd`, v4 `435b976a4de57c5a26c8bada8b3b9e003504687c790d4b856bc56619d3aabd18`; the script carries them and prints `digest_match` itself |
| 2 | `pc1-amd-family.ps1` | `packaging/ota/publish-jobs.sh add --kind run --target ae432dc7 --id run-ca3-pc1-amd-family-20261006 --script tools/ca3-pc1-amd/pc1-amd-family.ps1 --timeout-minutes 15 --title "CA3 PC 1: family step costs on the 9070 XT" --deploy` | about 3 min (3 runs x up to 3 AMD devices, 26 variants each, builds dominate) | beside the miners (ratios; every row says `card_state=`) | the "RX 9070 XT" column of the item 6 table (section 3: `RESULT FAMILYBEST name=<f> ratio=<r> exact= path=` per family, `RESULT FAMILY ... variant=` for the form each took: `shfla_bperm` = `ds_bpermute_b32`, the one number that could move R3; `shflx_swz` / `shflx_bperm`; `perm_amd` = `v_perm_b32` through `amd_perm` or `perm_c` emulated; `bfe_amd`; `dot4_amd` = the 5 October sudot4 row re-measured; `mm8_gfx12` / `mm8_gfx11` = the WMMA builtins, exact=unverified); section 7 row "item 6: the 9070 XT step costs" |
| 3 | `pc1-amd-derive.ps1` | `packaging/ota/publish-jobs.sh add --kind run --target ae432dc7 --id run-ca3-pc1-amd-derive-20261006 --script tools/ca3-pc1-amd/pc1-amd-derive.ps1 --timeout-minutes 15 --title "CA3 PC 1: dr736 on the 9070 XT" --deploy` | about 4 min (3 packs x a 60-dispatch pass and a 3-dispatch pass) | beside the miners (build, compile and bit-exact rows; the rate as a ratio to mx8 in the same job) | the item 2 table's 9070 XT cells (section 3: `RESULT DERIVE pack=dr736-genesis build_ms= build_ms_cached= build_ms_over_mx8= dataset_ms= fingerprint= match= mhs= ratio_to_mx8=`): the OpenCL compile cost of the derivation program against mx8's (the NVRTC +1.1 s finding on AMD), the 1 GiB daily build against mx8's 72 to 77 ms (5 October), bit-exactness on the AMD vendor; section 7 row "item 2: the 9070 XT rows" |
| 4 (optional, confirmed by main) | `pc1-4070-shadow.ps1` | `packaging/ota/publish-jobs.sh add --kind run --target ae432dc7 --id run-ca3-pc1-4070-shadow-20261006 --script tools/ca3-pc1-amd/pc1-4070-shadow.ps1 --timeout-minutes 30 --title "CA3 PC 1: item 8 ladder on the RTX 4070" --deploy` | about 11 min (7 benches of 100 to 200 dispatches at an expected 0.4 to 1 s each, approximate: no 4070 row exists yet; NVRTC per pack; the card switch) | 4070 ALONE (its CUDA worker stopped; 5090 and 9070 XT keep mining) | the "small NVIDIA card binds near 100,000" row of item 8 (section 3, consequences per tier at N = 100,000; section 7 "the 4060-class rows"): `RESULT LADDER pack=<p> ops=<N> mhs= watts= uj= sm_mhz=` with nvidia-smi at 1 Hz on that index; G1 fingerprints on a second NVIDIA card |
@ -64,8 +65,9 @@ G1 on the AMD vendor 7 of 7 (every fingerprint equal to the Mac's and the 5090's
| `proto-opencl/family-probe.c` on Apple OpenCL (`cc -framework OpenCL`, M5 Max) | every C-form and emulated row bit-exact on both 32-lane groups in 3 repetitions; ratios to the alu chain beside the Metal probe's (rotr 1.14 against Metal 1.13, shl 0.89 / 0.85, shr 0.89 / 0.86, bfe 0.82 / 0.77, andn 0.84 / 0.75, popc 1.00 / 0.87, clz 1.11 / 1.01, sel 0.82 / 0.76, perm emulated 1.52 / 1.13, shflx and shfla through `__local` 1.96 and 2.04 (Metal native 0.86 and 1.91), dot4 emulated signed 4.66 / 4.73); the Apple `dot(char4,char4)` row exact=no as the 5 October finding said; every AMD builtin skipped (`build=skipped`), the khr, intel and amd_media_ops2 forms `build=failed` with the log line, the run went on; `FAMILYBEST` picked the exact rows |
| `proto-opencl/host.c` with the build line, `--bench-pack` on all eight kit packs on Apple OpenCL | self-test PASS (96 of 96 lanes) and the 2^24 fingerprint at base 0 equal to the recorded one on every pack: mx8-devnet-epoch0 `90f794dd556f7a3b`, sh256x13 `59ac286fe2a5a9ef`, sh256x27 `3d2e8245cc084d07`, sh256x53 `4f824b15cf2b124a`, sh256x88 `0572522e39a94d8a`, sh64x52 `9dd010f79d8ca9f4`, dr736-genesis `50e3eaa779da4f1e`, dr736-devnet-epoch0 `9553f6d5c667205a`; `build` line: mx8 70 ms, shadow packs 70 to 88 ms, dr736 337 to 356 ms (+270 ms on Apple OpenCL: item 2's compile cost shows on this harness too) |
| mingw cross-builds of both exes | clean (`-Wall -Wextra`), 116 KB and 35 KB |
| `tools/ci/bash-body-check.sh` on the five scripts | 0 bash bodies, all parse |
| `tools/ci/kit-path-check.sh` on the five scripts | 5 of 5 kit paths checked before use |
| The kit worker's serve mode on Apple OpenCL (G2 dry run, 16:21 UTC, `with-lock.sh run`, load 5.2 to 5.7) | `packs-ca3-v4/mx8-devnet-epoch0` and `v4-devnet-epoch0`: 1,024 of 1,024 found each (2.6 s), nonces 0 to 1,023, the sorted found file's sha256 equal to the verifier's through `tools/ca3-v4/g2-recheck.sh --file` (the coordinator's `igneum-pow` binary): the two digests above |
| `tools/ci/bash-body-check.sh` on the six scripts | 0 bash bodies, all parse |
| `tools/ci/kit-path-check.sh` on the six scripts | 6 of 6 kit paths checked before use |
| `tools/ci/prover-socket-check.sh`, `copied-sources-check.sh`, `no-conflict-markers.sh` | pass |
| The Windows PowerShell 5.1 parse (`windows.yml` parse job) | the real parser runs only on the Windows runner and only over `relay/playbooks` and the other listed folders (not `tools/`); on the Mac the same rule's approximation (`tools/ci/check-workflow-shell.mjs`'s drive-reference regex, applied to these five files by hand) fired once on `"$dev: --stop-miners"` and the line was fixed to `${dev}:`; 0 findings after; brace, paren and bracket depth 0 by the bash-body-check tokenizer |

View file

@ -0,0 +1,36 @@
#!/usr/bin/env bash
# The G2 kit for tools/ca3-pc1-amd/pc1-amd-g2.ps1 (6 October 2026): the kit OpenCL worker (THIS tree's
# proto-opencl/host.c, cross-compiled with mingw as make-kit.sh does) and the two chain-seed packs of the class v4
# gate run, proto-cuda/packs-ca3-v4/mx8-devnet-epoch0 (the class v3 control) and v4-devnet-epoch0 (the candidate
# mx8+sh256x27 with the era at the devnet epoch-0 seeds), plus the sources and SHA256SUMS. The first kit's sh256x27
# is the genesis string-seed pack, which serve mode cannot take (epoch_seed must be 64 hex): hence this kit.
# tools/ca3-pc1-amd/make-g2-kit.sh [out.zip] default $TMPDIR/igneum-ca3-pc1-amd-g2-kit.zip
set -euo pipefail
HERE="$(cd "$(dirname "$0")" && pwd)"
ROOT="$(cd "$HERE/../.." && pwd)"
OUT="${1:-${TMPDIR:-/tmp}/igneum-ca3-pc1-amd-g2-kit.zip}"
RED="${IGNEUM_REDIST:-$ROOT/proto-cuda/nvrtc/redist}"
[ -f "$RED/include/CL/cl.h" ] || { echo "no OpenCL headers at $RED/include/CL/cl.h (run proto-cuda/nvrtc/fetch-redist.sh or set IGNEUM_REDIST)" >&2; exit 1; }
CC=x86_64-w64-mingw32-gcc; STRIP=x86_64-w64-mingw32-strip
command -v "$CC" >/dev/null || { echo "$CC not found (brew install mingw-w64)" >&2; exit 1; }
PLACEHOLDER="$ROOT/proto-cuda/packs/igneum-devnet-v4-epoch0"
STAGE="$(mktemp -d)"
mkdir -p "$STAGE/bin" "$STAGE/src" "$STAGE/packs"
echo "== igneum-worker-opencl.exe (kit build of proto-opencl/host.c)"
"$CC" -std=c99 -O2 -Wall -Wextra -Wno-stringop-truncation -Wno-format-truncation -static -DIGNEUM_CL_DYNAMIC -DCL_TARGET_OPENCL_VERSION=120 \
-I "$RED/include" -I "$PLACEHOLDER" -DIGNEUM_KERNEL_PATH='"kernel_bound.cl"' -o "$STAGE/bin/igneum-worker-opencl.exe" "$ROOT/proto-opencl/host.c"
"$STRIP" "$STAGE/bin/igneum-worker-opencl.exe"
cp "$ROOT/proto-opencl/host.c" "$ROOT/proto-opencl/cl_dynamic.h" "$STAGE/src/"
for p in packs-ca3-v4/mx8-devnet-epoch0 packs-ca3-v4/v4-devnet-epoch0; do
name="$(basename "$p")"
[ -f "$ROOT/proto-cuda/$p/kernel_bound.cl" ] || { echo "pack $p has no kernel_bound.cl" >&2; exit 1; }
mkdir -p "$STAGE/packs/$name"
cp "$ROOT/proto-cuda/$p"/* "$STAGE/packs/$name/"
done
( cd "$STAGE" && find . -type f ! -name SHA256SUMS | sort | xargs shasum -a 256 > SHA256SUMS )
rm -f "$OUT"
( cd "$STAGE" && zip -X -q -r "$OUT" . )
rm -rf "$STAGE"
echo "kit $OUT"
echo "sha256 $(shasum -a 256 "$OUT" | cut -c1-64) bytes $(wc -c < "$OUT" | tr -d ' ')"
unzip -l "$OUT" | tail -1

View file

@ -0,0 +1,109 @@
# Counter ASIC 3.0, PC 1 AMD job G2 (6 October 2026): gate G2 of docs/plans/counter-asic-2-rollout.md section 7 on
# the AMD vendor (docs/plans/counter-asic-3-gate/hash-gates.md, the "RX 9070 XT" cell): the CPU verifier exact on
# 1,024 hashes from the RX 9070 XT (machine ae432dc7, gfx1201) for the class v4 candidate and the class v3 control.
# The hash lane's form (tools/ca3-v4/pc2-v4-gates.ps1, ca3-coord b7cd99e): one serve-mode job per pack of 1,024 nonces
# at target ffffffffffffffff and prehash 00..01 (every nonce a "found g2 <nonce> <hash>" line), through the kit's
# igneum-worker-opencl.exe (--serve --pack <dir> --device <gfx1201>); the found lines never go to stdout: each pack's
# lines go to g2-<pack>.found in this job's folder (nonce order, LF, no BOM) and ONE line per pack reports the count,
# the distinct nonces and the file's sha256. The Mac derives the same bytes from `igneum-pow hash-bound --prehash 00..01
# --nonce 0 --count 1024` on the same pack (tools/ca3-v4/g2-recheck.sh <pack dir> --digest <hex>): equal digests are
# 1,024 of 1,024; on a mismatch the file is fetched with `publish-jobs.sh add --kind collect --glob
# "app/jobs/<job id>/g2-*.found"` and diffed line by line.
# Packs (the G2 kit, fetch job fetch-ca3-pc1-amd-g2-20261006): proto-cuda/packs-ca3-v4/v4-devnet-epoch0 (the candidate
# mx8+sh256x27 composed with the era at the devnet epoch-0 chain seeds) and packs-ca3-v4/mx8-devnet-epoch0 (the class v3
# control). The first kit's sh256x27 is the genesis STRING-seed pack (IGNEUM_SEED_BYTES_HEX of 14 bytes), which the
# worker's job protocol cannot take (epoch_seed must be 64 hex), so G2 runs on the chain-seed packs the 5090 and the
# Mac ran (8 x 1,024 of 1,024 there). Beside the miners (correctness, not rate): no card is switched; the process
# list says what the card carried. Never quits, pauses, resumes or updates the installed app; never writes
# settings.json. Every result line starts with RESULT; a `SUMMARY {json}` line ends the job. Read back with
# `node tools/jobs.mjs <job id>`; the full output stays in app/jobs/<job id>/job.log on the PC beside the found files.
$ErrorActionPreference = 'Continue'
$jobName = 'pc1-amd-g2'
$kitId = 'fetch-ca3-pc1-amd-g2-20261006'
$started = Get-Date
function Stamp { (Get-Date).ToUniversalTime().ToString('yyyy-MM-ddTHH:mm:ssZ') }
function Summary([string] $status, [hashtable] $extra) {
$o = [ordered]@{ job = $jobName; status = $status; duration_s = [int]((Get-Date) - $started).TotalSeconds; finished_at = (Stamp) }
foreach ($k in $extra.Keys) { $o[$k] = $extra[$k] }
'SUMMARY ' + ($o | ConvertTo-Json -Compress -Depth 4)
}
# the verifier's digests of the two found files, derived on the Mac through tools/ca3-v4/g2-recheck.sh on 6 October
# 2026 (the kit worker's serve mode on Apple OpenCL gave the same files): a match is 1,024 of 1,024 with no file moved
$expectedDigest = @{ 'mx8-devnet-epoch0' = '2a1824a2e0834287cf53b33f84cb7322014c85efa9788bece574e4e0730940bd'; 'v4-devnet-epoch0' = '435b976a4de57c5a26c8bada8b3b9e003504687c790d4b856bc56619d3aabd18' }
$order = @('mx8-devnet-epoch0', 'v4-devnet-epoch0')
"RESULT start $(Stamp) job=$jobName machine=$env:COMPUTERNAME app_version=$env:IGNEUM_APP_VERSION"
"RESULT log $(Join-Path $env:IGNEUM_JOB_DIR 'job.log') (the full output; the found lines of G2 are g2-<pack>.found beside it: collect --glob app/jobs/<job id>/g2-*.found)"
$jobs = Split-Path $env:IGNEUM_JOB_DIR
$kit = Join-Path $jobs $kitId
if (-not (Test-Path $kit)) { "RESULT error kit missing at $kit (the fetch job $kitId runs first; republish it after any app update)"; Summary 'failed' @{ error = 'kit missing' }; exit 2 }
$exe = Join-Path $kit 'bin\igneum-worker-opencl.exe'
$packs = Join-Path $kit 'packs'
if (-not (Test-Path $exe)) { "RESULT error worker missing at $exe"; Summary 'failed' @{ error = 'worker missing' }; exit 2 }
if (-not (Test-Path $packs)) { "RESULT error packs missing at $packs"; Summary 'failed' @{ error = 'packs missing' }; exit 2 }
"RESULT worker kit $exe sha256 $((Get-FileHash -Algorithm SHA256 $exe).Hash.ToLower()) bytes $((Get-Item $exe).Length)"
foreach ($pk in $order) {
$d = Join-Path $packs $pk
if (-not (Test-Path (Join-Path $d 'kernel_bound.cl'))) { "RESULT error pack $pk missing at $d"; Summary 'failed' @{ error = "pack $pk missing" }; exit 2 }
"RESULT pack $pk kernel_bound.cl sha256 $((Get-FileHash -Algorithm SHA256 (Join-Path $d 'kernel_bound.cl')).Hash.ToLower()) program.h sha256 $((Get-FileHash -Algorithm SHA256 (Join-Path $d 'program.h')).Hash.ToLower())"
}
$job = $env:IGNEUM_JOB_DIR; if (-not $job) { $job = Join-Path $env:TEMP 'igneum-ca3-pc1-amd-g2' }; New-Item -ItemType Directory -Force -Path $job | Out-Null
# the OpenCL device index of the 9070 XT (the installed worker's list when present: the app's own indices)
$inst = @("$env:LOCALAPPDATA\Programs\Igneum Miner", "$env:ProgramFiles\Igneum Miner") | Where-Object { Test-Path (Join-Path $_ 'igneum-app.exe') } | Select-Object -First 1
$listExe = $exe
if ($inst -and (Test-Path (Join-Path $inst 'igneum-worker-opencl.exe'))) { $listExe = Join-Path $inst 'igneum-worker-opencl.exe' }
$list = @(& $listExe --list 2>&1 | ForEach-Object { "$_" })
$list | ForEach-Object { "RESULT list $_" }
$dev = $null
foreach ($l in $list) { if ($l -match '^\s*\[(\d+)\].*gfx1201' -and $l -notmatch 'dup') { $dev = [int]$Matches[1]; break } }
if ($null -eq $dev) { "RESULT error no gfx1201 device in --list (the eGPU is off the bus: G2 on AMD stays OWED)"; Summary 'failed' @{ error = 'no gfx1201' }; exit 2 }
"RESULT device $dev gfx1201 (list from $listExe)"
function Workers { @(Get-CimInstance Win32_Process -Filter "Name = 'igneum-worker-opencl.exe' OR Name = 'igneum-worker-cuda.exe'" -ErrorAction SilentlyContinue | ForEach-Object { "$($_.Name):$($_.ProcessId):[$($_.CommandLine -replace '\s+', ' ')]" }) }
$w = @(Workers)
$loaded = ($w | Where-Object { $_ -match "igneum-worker-opencl.*--device\s+$dev(\s|$)" }).Count -gt 0
"RESULT workers_before $(Stamp) $($w -join ' ')"
"RESULT context card_state=$(if ($loaded) { 'loaded (the card mines beside this job: a correctness gate, the load changes nothing)' } else { 'quiet (no opencl worker with --device ' + $dev + ')' })"
# ---- G2: serve mode, 1,024 nonces at target ff..ff per pack, every nonce a found line, the lines to a file ----
$g2Pre = '0000000000000000000000000000000000000000000000000000000000000001'
function G2-JobLines([string] $d) {
$ph = Get-Content -LiteralPath (Join-Path $d 'program.h') -Raw
$epoch = ([regex]::Match($ph, '#define IGNEUM_SEED_BYTES_HEX "([0-9a-f]+)"')).Groups[1].Value
$day = ([regex]::Match($ph, '#define IGNEUM_DAY_BYTES_HEX "([0-9a-f]+)"')).Groups[1].Value
$tokens = ''
$cls = [regex]::Match($ph, '#define IGNEUM_PROGRAM_CLASS "(v[23])"')
$era = [regex]::Match($ph, '#define IGNEUM_ERA_SEED_HEX "([0-9a-f]+)"')
if ($cls.Success -and $cls.Groups[1].Value -eq 'v3') { $tokens = ' class=v3'; if ($era.Success) { $tokens += ' era=' + $era.Groups[1].Value } }
return @("job g2 $g2Pre ffffffffffffffff 0 1024 $epoch $day$tokens", 'quit')
}
$ok = 0; $digestMatch = 0
foreach ($pk in $order) {
$d = Join-Path $packs $pk
$lines = G2-JobLines $d
if ($lines[0] -notmatch ' [0-9a-f]{64} ') { "RESULT g2 $pk error=the pack's IGNEUM_SEED_BYTES_HEX is not 64 hex (a string-seed pack cannot be served)"; continue }
$t0 = Get-Date
"RESULT g2 $pk start $(Stamp) job-line $($lines[0])"
$out = $lines | & $exe --serve --pack $d --device $dev 2>&1
$code = $LASTEXITCODE
$found = @()
foreach ($l in $out) { $s = [string]$l; if ($s -match '^found g2 (\d+) ([0-9a-f]{16})$') { $found += [pscustomobject]@{ n = [uint64]$Matches[1]; line = $s } } elseif ($s -match '^(ready|done|error|need|prepared|info first pack|build )') { "RESULT g2 $pk $s" } }
# the found lines to a file in this job's folder: nonce order, LF, no BOM (the Mac derives the same bytes from hash-bound)
$ff = Join-Path $job "g2-$pk.found"
$text = (($found | Sort-Object n | ForEach-Object { $_.line }) -join "`n")
if ($found.Count -gt 0) { $text += "`n" }
[IO.File]::WriteAllText($ff, $text, (New-Object Text.UTF8Encoding $false))
$dg = (Get-FileHash -Algorithm SHA256 $ff).Hash.ToLower()
$distinct = ($found | Select-Object -ExpandProperty n -Unique | Measure-Object).Count
$want = $expectedDigest[$pk]
$m = if ($want -and $want -notmatch '^__') { if ($dg -eq $want) { 'yes' } else { 'no' } } else { 'unknown' }
"RESULT g2 $pk found $($found.Count) of 1024 distinct=$distinct sha256 $dg file $ff exit=$code"
"RESULT G2 pack=$pk found=$($found.Count) distinct=$distinct digest=$dg digest_match=$m expected=$want wall_s=$([int]((Get-Date) - $t0).TotalSeconds) card=gfx1201 harness=opencl-kit-serve card_state=$(if ($loaded) { 'loaded' } else { 'quiet' })"
if ($found.Count -eq 1024 -and $distinct -eq 1024 -and $code -eq 0) { $ok++ }
if ($m -eq 'yes') { $digestMatch++ }
}
"RESULT workers_after $(Stamp) $((Workers) -join ' ')"
"RESULT end $(Stamp)"
$status = if ($ok -eq $order.Count) { 'done' } elseif ($ok -gt 0) { 'partial' } else { 'failed' }
Summary $status @{ packs_ok = $ok; packs_wanted = $order.Count; digest_match = $digestMatch; device = $dev; card_state = $(if ($loaded) { 'loaded' } else { 'quiet' }) }
if ($status -eq 'failed') { exit 1 }
exit 0