diff --git a/.github/workflows/selftest.yml b/.github/workflows/selftest.yml index c3c3e27..f60236d 100644 --- a/.github/workflows/selftest.yml +++ b/.github/workflows/selftest.yml @@ -27,6 +27,9 @@ jobs: - name: Validate all 100 hidden checkers (untouched must fail, reference must pass) working-directory: evalsuite run: python selftest.py --ci + - name: Runner turn cap, acceptance set and trust pruning (offline) + working-directory: evalsuite + run: python check_runner.py gateway: diff --git a/CHANGELOG.md b/CHANGELOG.md index f3c7b91..3e90920 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,20 @@ # Changelog +## Unreleased - 2026-10-18 Codex lock-in and engine A/B + +- **Codex is the one harness.** `agents/codex-qwen.cmd` now runs the lean Codex home ([agents/codex-lean-home/](agents/codex-lean-home/), about 3K base prompt tokens) with a preflight that takes a shared engine lock (`agents/locks/qwen-lock.ps1`, `C:\AI\locks\qwen-engine.lock`) so only one Qwen job runs at a time; `claude-qwen` takes the same lock. The old heavy launcher is kept as `codex-qwen-full.cmd`. Details: [docs/CODEX-QWEN.md](docs/CODEX-QWEN.md). +- **evalsuite, same 19 tasks:** old home 13/19; lean home 15/19 and 49% faster on the 12 tasks both passed (930 s -> 477 s), 85% fewer server prompt tokens; after five traced fixes the acceptance run scored **18/19, all 19 in 711 s** (old: 2,140 s), and the last failure (money rounding) passed 3/3 after a tighter rule. Raw rows in `data/codex-eval-20261018/`. +- Fixes found from the Codex event logs: PowerShell `>` writes UTF-16; the compact prompt's own patch example taught a stray space; Codex's Windows sandbox keeps `.git` read-only and a root-level `writable_roots` override is ignored under `exec -s` (now placed after `exec`, unattended runs only); repeat-the-failing-command loops; float money rounding; positional CSV parsing. +- **Engine A/B on production Vulkan 11526 (ctx 32768, 3-seed contract, `bench/ab-20261018/`):** f16 KV baseline 38.95 / 43.01 / 44.16 tok/s (mean 42.04), pp 471 (2K) / 520 (8K). q8_0 main KV with DFlash2: 34.34 / 33.62 / 37.52 (mean 35.16, -16%), pp 433 / 381, saves 0.94 GiB: **rejected again**, so 48K/56K q8_0 was not run. +- **DFlash round attribution (GGML_VK_PERF_LOGGER):** 125.2 ms/round of GPU time against 128.3 ms/round wall, so the host readback/injection/sync gap is about 3 ms: the round is kernel-bound. The verify graph (101 ms/round) is n=8 mat-vec over Q4_K/Q6_K at about 160 GB/s, about 35% of the card's 456 GB/s; that kernel efficiency is the remaining lever, not the DFlash bridge. +- **SYCL fork review (valarauca/llama.cpp `feature/intel`, MIT):** source audit only, not built. Its large prefill gains target Q4_0/Q8_0; Q4_K/Q6_K get about 20% faster matmul, so the 2x prompt-speed gate for this Q4_K_M model was not expected to pass (INFERRED +10-30%), and speculative decoding on SYCL has an open upstream issue (#23203). Parked; the earlier 1.2% figure came from a Vulkan port of one idea, not the SYCL build. +- **B60 hardware tuning:** the Intel control library (IGCL 1.2.298) lists overclock ranges for the card, but its overclock waiver call returns `CTL_RESULT_ERROR_UNSUPPORTED_FEATURE`, so nothing was applied and the card runs stock (VERIFIED by readback). The card runs at about 141 W of a 200 W cap at 2.4 GHz. +- **Engine: two rows per workgroup for Intel K-quant mat-vec (`engine/patches/0004`).** The DFlash2 verify batch is an n=8 mat-vec that ran at about 35% of the card's bandwidth. `rm_kq_int` 1 -> 2: q4_K 178.6 -> 133.8 us, q6_K 288 -> 253 us (m=4096 k=14336); end to end **42.12 -> 51.22 tok/s** mean (3 seeds, ctx 32768, 127 -> 104 ms/round), token-identical greedy output, test-backend-ops 695/695, soak 51.19 / 51.22 / 51.09. Promoted as `C:\AI\llama.cpp\vulkan-intelfa-kq2-20261018` (one-line governor `exe` change; old engine kept for rollback). `engine/patches/0003` is Codex's GDN state-snapshot fusion: correct, speed-neutral, kept. Tuning-log rows 34-35. +- **VRAM spill found and fixed (governor).** Production ran 26-30 tok/s at 49K context: once the adapter passes about 22.6 GiB, Windows moves a ~0.94 GiB block of the model to system memory. The governor only counted dedicated memory, so the spill looked like a perfect fit and its calibration shrank the next margin further. Live governor: margin 1.2 -> 1.45 GiB, pressure threshold 1.1 -> 1.3, calibration counts llama shared usage, a spill queues one idle-time re-fit; 4 new tests (195 of 196 pass; the remaining failure is an older `others_vram_max_gib` drift). Production after the fix: **51.78 tok/s** mean (47.83 / 53.11 / 54.41) at 32K. This corrects the 1.2 GiB margin from the context tune below. Tuning-log row 36. +- **Codex on the new engine: 19/19 in 521 s** (18/19 in 711 s before the engine change), after four generic rules in `agents/codex-lean-home/instructions-compact.md`: an unindented apply_patch example, one-step rounding to 5 cents, edge cases beyond the given tests, and checking every patched file for a stray leading space. The three tasks that had been flaky passed 9/9. Details in [docs/CODEX-QWEN.md](docs/CODEX-QWEN.md), raw rows `data/codex-eval-20261018/codex-kq2-*`. +- **Review fixes (launcher and lock).** `agents/codex-qwen.cmd` re-parsed its arguments to drop `exec`, so text after `&` inside a quoted prompt ran as a command and a `.git` path with spaces split; the exec half now lives in `agents/codex-qwen-exec.mjs`, which receives the arguments already split and passes them to `codex.exe` untouched (it also points git at an empty config folder, silencing the sandbox's `git/ignore` warnings). `agents/locks/qwen-lock.ps1`: a launcher waiting for the slot was taken over after 60 s (grace now covers the wait), two waiters could both take over a stale lock (compare-and-delete under an exclusive handle), reused PIDs kept a lock (start time recorded), and a delete-pending lock file crashed the acquirer. New `agents/locks/test-qwen-lock.ps1` (14 checks, including the takeover race). Codex smoke on four tasks: 4/4. +- **Unloads, profile flapping, eval runner (19 Oct).** llama-swap `ttl` for the default 27B is now 0 so only the governor unloads (it saves the KV slot first; an explicit 0 is not replaced by `globalTTL`). Live governor: MAX/BALANCED hysteresis (enter MAX at RAM >= 10 GB and CPU < 25%, leave below 8.5 GB or above 40%) after 16 flips in one evening, and an optional upgrade reload needs at least +8K context; 217/217 governor tests. The suspected Open WebUI cache eviction was not real (task generation off, no chats; the only other client is Codex's Qwen MCP gateway), so nothing changed there. evalsuite: `--max-turns` for Codex (default 25), the engine lock is released after a killed run, `prune_codex_trust.py` removes the per-workdir trust tables each run leaves in the lean Codex home, acceptance set 19 -> 27 in `evalsuite/acceptance.txt` (the 8 added tasks 8/8 on kq2), and `nightly-codex.ps1` runs it nightly with a regression comparison. `evalsuite/check_runner.py` covers the cap and pruning offline and runs in CI. Tuning-log rows 37-40. + ## Unreleased — 2026-10-18 context tune - Context sweep on the production launch line (32K/40K/48K/56K, short and 80%-full requests): speed holds to 48K (43.6 tok/s with 39K tokens in context) and falls off at 56K (22.4 tok/s, about 1 GiB moved to system memory). New `bench/ctx-sweep.py`, raw results in `data/ctx-sweep-20261018.jsonl`, tuning-log rows 24-27. diff --git a/agents/claude-qwen.cmd b/agents/claude-qwen.cmd index 88beec4..582ed5d 100644 --- a/agents/claude-qwen.cmd +++ b/agents/claude-qwen.cmd @@ -1,55 +1,33 @@ @echo off -rem Claude Code (real CLI) on the local Qwen3.8-27B (Arc B60, llama-swap, loads on request). -rem Usage: claude-qwen [claude args]. Default preset qwen3.8-27b:code (fast agent turns, no thinking). -rem Deep planning: set QWEN_MODEL=qwen3.8-27b:plan Balanced: qwen3.8-27b Huge docs: qwen3.8-27b-long +rem claude-qwen: Claude Code running on the local Qwen3.8-27B (ELZYDLAB Arc B60) through llama-swap's +rem Anthropic-compatible /v1/messages endpoint. --bare keeps the prompt small (no plugins, hooks, connectors, +rem CLAUDE.md auto-discovery). Your normal "claude" command and settings are not changed. +rem Usage: claude-qwen [claude args] e.g. claude-qwen or claude-qwen -p "explain this repo" +rem Add context explicitly if you want it: --add-dir . (CLAUDE.md), --mcp-config setlocal -if "%QWEN_MODEL%"=="" set "QWEN_MODEL=qwen3.8-27b:code" -if "%QWEN_BASE%"=="" set "QWEN_BASE=http://127.0.0.1:8090" -set "CLAUDE_BIN=" -if exist "%USERPROFILE%\.local\bin\claude.exe" set "CLAUDE_BIN=%USERPROFILE%\.local\bin\claude.exe" -if not defined CLAUDE_BIN for /f "usebackq delims=" %%p in (`powershell -NoProfile -Command "$r=@($env:APPDATA+'\Claude\claude-code')+@(Get-ChildItem ($env:LOCALAPPDATA+'\Packages') -Directory -Filter 'Claude_*' -ErrorAction SilentlyContinue | ForEach-Object { $_.FullName+'\LocalCache\Roaming\Claude\claude-code' }); ($r | Where-Object { Test-Path $_ } | ForEach-Object { Get-ChildItem $_ -Recurse -Force -Filter claude.exe -ErrorAction SilentlyContinue } | Sort-Object LastWriteTime -Descending | Select-Object -First 1).FullName"`) do set "CLAUDE_BIN=%%p" -if not defined CLAUDE_BIN ( echo Claude Code not found. Install it: powershell -c "irm https://claude.ai/install.ps1 | iex" & exit /b 2 ) if "%LOCAL_QWEN_KEY%"=="" for /f "usebackq delims=" %%k in (`powershell -NoProfile -Command "[Environment]::GetEnvironmentVariable('LOCAL_QWEN_KEY','User')"`) do set "LOCAL_QWEN_KEY=%%k" -if not defined LOCAL_QWEN_KEY ( echo LOCAL_QWEN_KEY is not set - see docs\SETUP.md step 3. & exit /b 3 ) -set "ANTHROPIC_BASE_URL=%QWEN_BASE%" -set "ANTHROPIC_AUTH_TOKEN=%LOCAL_QWEN_KEY%" -set "ANTHROPIC_API_KEY=" -set "ANTHROPIC_MODEL=%QWEN_MODEL%" -set "ANTHROPIC_DEFAULT_OPUS_MODEL=%QWEN_MODEL%" -set "ANTHROPIC_DEFAULT_SONNET_MODEL=%QWEN_MODEL%" -set "ANTHROPIC_DEFAULT_HAIKU_MODEL=%QWEN_MODEL%" -set "CLAUDE_CODE_SUBAGENT_MODEL=%QWEN_MODEL%" -rem Live context window from the governor (loaded ctx or expected ctx, minus 8k headroom) -set "QWEN_WIN=50000" -set "WINARG=" -if /i "%QWEN_MODEL%"=="qwen3.8-27b-long" set "WINARG=long" -for /f "usebackq delims=" %%w in (`powershell -NoProfile -ExecutionPolicy Bypass -File C:\AI\governor\qwen.ps1 window %WINARG%`) do set "QWEN_WIN=%%w" -if "%QWEN_CLIENT_CAP%"=="" set "QWEN_CLIENT_CAP=32768" -if %QWEN_WIN% GTR %QWEN_CLIENT_CAP% set "QWEN_WIN=%QWEN_CLIENT_CAP%" -if /i "%QWEN_MODEL%"=="qwen3.8-27b-big" set "QWEN_WIN=120000" -set "CLAUDE_CODE_MAX_CONTEXT_TOKENS=%QWEN_WIN%" -rem Efficient sessions: 8k output reserve (more room before auto-compact), capped tool output -set "CLAUDE_CODE_MAX_OUTPUT_TOKENS=8000" -set "BASH_MAX_OUTPUT_LENGTH=15000" -set "MAX_MCP_OUTPUT_TOKENS=8000" -set "CLAUDE_CODE_ATTRIBUTION_HEADER=0" +rem One Qwen job at a time: preflight takes C:\AI\locks\qwen-engine.lock (kind claude) and prints " ". +set "WIN=" & set "LOCKPID=0" +for /f "usebackq tokens=1,2" %%a in (`powershell -NoProfile -ExecutionPolicy Bypass -File C:\AI\codex-local\preflight.ps1 -Kind claude`) do ( + set "WIN=%%a" + set "LOCKPID=%%b" +) +if not defined WIN set "WIN=28672" +set "ANTHROPIC_BASE_URL=http://127.0.0.1:8090" +set "ANTHROPIC_API_KEY=%LOCAL_QWEN_KEY%" +set "ANTHROPIC_AUTH_TOKEN=" +set "ANTHROPIC_MODEL=qwen3.8-27b:code" +set "ANTHROPIC_DEFAULT_OPUS_MODEL=qwen3.8-27b:code" +set "ANTHROPIC_DEFAULT_SONNET_MODEL=qwen3.8-27b:code" +set "ANTHROPIC_DEFAULT_HAIKU_MODEL=qwen3.8-27b:code" +set "ANTHROPIC_SMALL_FAST_MODEL=qwen3.8-27b:code" +set "CLAUDE_CODE_SUBAGENT_MODEL=qwen3.8-27b:code" +set "CLAUDE_CODE_MAX_OUTPUT_TOKENS=8192" set "CLAUDE_CODE_DISABLE_NONESSENTIAL_TRAFFIC=1" -set "CLAUDE_CODE_DISABLE_EXPERIMENTAL_BETAS=1" -rem (The "v2" extra settings tested on 2026-10-10 scored lower - 93/100 vs 97/100 - and are not used. See docs/RELIABILITY.md.) set "API_TIMEOUT_MS=900000" -rem Compaction is governed by CLAUDE_CODE_MAX_CONTEXT_TOKENS above. CLAUDE_CODE_AUTO_COMPACT_WINDOW is deliberately NOT set: -rem its documented valid range is 100000-1000000, so the 32K-57K windows used here are out of range. -rem Browser tools (playwright) are opt-in: set QWEN_BROWSER=1 and create C:\AI\claude-local\mcp-browser.json yourself (not shipped: browser tool schemas are large and load on every turn) -set "MCPFILE=C:\AI\claude-local\mcp.json" -if "%QWEN_BROWSER%"=="1" if exist "C:\AI\claude-local\mcp-browser.json" (set "MCPFILE=C:\AI\claude-local\mcp-browser.json") else (echo mcp-browser.json not found in C:\AI\claude-local - continuing without browser tools.) -rem DEFAULT = FAST mode: full core toolset (Bash Read Edit Write Glob Grep WebFetch Agent TodoWrite + context7) with a compact local system prompt instead of Claude Code's ~19k-token one. -rem set QWEN_FULL=1 standard Claude Code prompt (lean config dir, hooks/skills discovery) -if "%QWEN_FULL%"=="1" goto full -set "CLAUDE_CONFIG_DIR=C:\AI\claude-local" -"%CLAUDE_BIN%" --model %QWEN_MODEL% --system-prompt-file C:\AI\claude-local\LOCAL-SYSTEM.md --tools "Bash,Read,Edit,Write,Glob,Grep,WebFetch,Agent,TodoWrite" --mcp-config "%MCPFILE%" --strict-mcp-config %* -goto done -:full -set "CLAUDE_CONFIG_DIR=C:\AI\claude-local" -"%CLAUDE_BIN%" --model %QWEN_MODEL% --mcp-config "%MCPFILE%" --disallowedTools WebSearch %* -:done -endlocal +set "SET_FILE=%LOCALAPPDATA%\Temp\claude-qwen-settings.json" +> "%SET_FILE%" echo {"autoCompactWindow": %WIN%, "autoCompactEnabled": true} +claude --bare --model qwen3.8-27b:code --settings "%SET_FILE%" %* +set "RC=%ERRORLEVEL%" +if not "%LOCKPID%"=="0" powershell -NoProfile -ExecutionPolicy Bypass -File C:\AI\locks\qwen-lock.ps1 release -HolderPid %LOCKPID% >nul 2>&1 +endlocal & exit /b %RC% diff --git a/agents/codex-lean-home/config.toml b/agents/codex-lean-home/config.toml new file mode 100644 index 0000000..9a10e56 --- /dev/null +++ b/agents/codex-lean-home/config.toml @@ -0,0 +1,282 @@ +# Lean Codex home for the local Qwen (ELZYDLAB, Arc Pro B60). Deploy to C:\AI\codex-local\home and run Codex with +# CODEX_HOME=C:\AI\codex-local\home (see codex-qwen-lean.cmd). A separate CODEX_HOME is what removes the 26 plugins, +# 7 MCP servers, the 21 KB global AGENTS.md and the ~/.codex/skills tree from every request. +# MEASURED 2026-10-17 (llama-server /metrics, "Reply OK" in an empty project): +# ~/.codex + qwen-lean profile : 12,235 prompt tokens, 33 s wall (cold) +# this home, stock instructions: 7,150 (agents/goals tools off: ~4,900 est. from request bytes) +# this home, compact instructions: 3,010 prompt tokens, 1.6 s when cached <- VERIFIED +model = "qwen3.8-27b:code" # thinking off; the governor's default variant (f16 KV, Intel FA, DFlash2) +model_provider = "qwen-b60" +model_reasoning_effort = "low" +model_reasoning_summary = "none" +hide_agent_reasoning = true +model_verbosity = "low" + +approval_policy = "on-request" +sandbox_mode = "workspace-write" + +# Window: the governor sizes ctx per load (32768-65536, --no-context-shift => overflow is a hard 400). +# codex-qwen-lean.cmd overrides these two with the live value from `qwen window` (ctx - 8192) and 75% of it. +model_context_window = 32768 +model_auto_compact_token_limit = 24000 +tool_output_token_limit = 3000 + +web_search = "disabled" # llama.cpp drops web_search tools +project_doc_max_bytes = 8192 # AGENTS.md cap per file (default 32 KiB) + +# Replaces Codex's 17.3 KB stock system prompt (~4K tokens) with a 1.2 KB one. VERIFIED to take effect (request capture). +# Risk: untested on the eval suite; keep the stock prompt by commenting this line out (prompt then ~4.9K tokens). +model_instructions_file = 'C:\AI\codex-local\home\instructions-compact.md' +include_permissions_instructions = false +include_apps_instructions = false +include_collaboration_mode_instructions = false + +developer_instructions = "Local Qwen on ELZYDLAB. Context is small: read only what you need, keep tool output short, valid JSON tool arguments, one step at a time. User: Elz (Elie, never Eli), Australian English, AUD, concise, VERIFIED vs INFERRED." + +[windows] +sandbox = "elevated" + +[agents] +enabled = false # removes the multi_agent_v1 namespace tool (10 KB of schema) - VERIFIED by capture + +[features] +memories = false +multi_agent = false # (INFERRED name; harmless if unknown) +collaboration_modes = false # (INFERRED name) +goals = false # goals tools disappeared together with [agents] enabled=false; name INFERRED +apply_patch_freeform = false + +[tools] +view_image = false # the schema still ships (371 bytes); harmless + +[model_providers.qwen-b60] +name = "Local Qwen (ELZYDLAB Arc B60)" +base_url = "http://127.0.0.1:8090/v1" +env_key = "LOCAL_QWEN_KEY" +wire_api = "responses" +stream_idle_timeout_ms = 900000 +request_max_retries = 1 +stream_max_retries = 1 + +# Codex writes six system skills into any new CODEX_HOME; switch them off (each listing costs tokens). +[[skills.config]] +path = 'C:\AI\codex-local\home\skills\.system\imagegen\SKILL.md' +enabled = false +[[skills.config]] +path = 'C:\AI\codex-local\home\skills\.system\openai-docs\SKILL.md' +enabled = false +[[skills.config]] +path = 'C:\AI\codex-local\home\skills\.system\plugin-creator\SKILL.md' +enabled = false +[[skills.config]] +path = 'C:\AI\codex-local\home\skills\.system\review-agent\SKILL.md' +enabled = false +[[skills.config]] +path = 'C:\AI\codex-local\home\skills\.system\skill-creator\SKILL.md' +enabled = false +[[skills.config]] +path = 'C:\AI\codex-local\home\skills\.system\skill-installer\SKILL.md' +enabled = false + +[projects.'c:\ai\bench'] +trust_level = "trusted" +# Same trust as your main ~/.codex (which trusts c:\users\edagh and c:\codex); c:\ai added for the AI stack repos. +# Without these, Codex on Qwen asks for trust or drops to read-only in your repos. +[projects.'c:\users\edagh'] +trust_level = "trusted" +[projects.'c:\ai'] +trust_level = "trusted" + +[projects.'c:\ai\evalsuite\work\codex-lean-20261018\code-merge_intervals'] +trust_level = "trusted" + +[projects.'c:\ai\evalsuite\work\codex-lean-20261018\debug-pager'] +trust_level = "trusted" + +[projects.'c:\ai\evalsuite\work\codex-lean-20261018\tool-sha256'] +trust_level = "trusted" + +[projects.'c:\ai\evalsuite\work\codex-lean-20261018\files-version-bump'] +trust_level = "trusted" + +[projects.'c:\ai\evalsuite\work\codex-lean-20261018\long-config-path'] +trust_level = "trusted" + +[projects.'c:\ai\evalsuite\work\codex-lean-20261018\biz-gst-invoice'] +trust_level = "trusted" + +[projects.'c:\ai\evalsuite\work\codex-lean-20261018\recover-encoding'] +trust_level = "trusted" + +[projects.'c:\ai\evalsuite\work\codex-lean-20261018\code-gst'] +trust_level = "trusted" + +[projects.'c:\ai\evalsuite\work\codex-lean-20261018\debug-bsearch'] +trust_level = "trusted" + +[projects.'c:\ai\evalsuite\work\codex-lean-20261018\tool-git-branch'] +trust_level = "trusted" + +[projects.'c:\ai\evalsuite\work\codex-lean-20261018\files-refactor-rename'] +trust_level = "trusted" + +[projects.'c:\ai\evalsuite\work\codex-lean-20261018\long-find-caller'] +trust_level = "trusted" + +[projects.'c:\ai\evalsuite\work\codex-lean-20261018\biz-bank-rec'] +trust_level = "trusted" + +[projects.'c:\ai\evalsuite\work\codex-lean-20261018\recover-missing-dir'] +trust_level = "trusted" + +[projects.'c:\ai\evalsuite\work\codex-lean-20261018\debug-csvout'] +trust_level = "trusted" + +[projects.'c:\ai\evalsuite\work\codex-lean-20261018\tool-unique-suburbs'] +trust_level = "trusted" + +[projects.'c:\ai\evalsuite\work\codex-lean-20261018\files-extract-emails'] +trust_level = "trusted" + +[projects.'c:\ai\evalsuite\work\codex-lean-20261018\biz-price-update'] +trust_level = "trusted" + +[projects.'c:\ai\evalsuite\work\codex-lean-20261018\recover-circular-import'] +trust_level = "trusted" + +[projects.'c:\ai\evalsuite\work\codex-lean2-20261018\code-merge_intervals'] +trust_level = "trusted" + +[projects.'c:\ai\evalsuite\work\codex-lean2-20261018\tool-sha256'] +trust_level = "trusted" + +[projects.'c:\ai\evalsuite\work\codex-lean2-20261018\files-refactor-rename'] +trust_level = "trusted" + +[projects.'c:\ai\evalsuite\work\codex-lean2-20261018\biz-price-update'] +trust_level = "trusted" + +[projects.'c:\ai\evalsuite\work\codex-lean2-20261018\tool-git-branch'] +trust_level = "trusted" + +[projects.'c:\ai\evalsuite\work\codex-lean2-20261018\tool-unique-suburbs'] +trust_level = "trusted" + +[projects.'c:\ai\bench\gitw-test'] +trust_level = "trusted" + +[projects.'c:\ai\evalsuite\work\codex-lean3-20261018\tool-git-branch'] +trust_level = "trusted" + +[projects.'c:\ai\evalsuite\work\codex-lean3-20261018\tool-unique-suburbs'] +trust_level = "trusted" + +[projects.'c:\ai\evalsuite\work\codex-lean4-20261018\tool-git-branch'] +trust_level = "trusted" + +[projects.'c:\ai\evalsuite\work\codex-lean5-20261018\tool-sha256'] +trust_level = "trusted" + +[projects.'c:\ai\evalsuite\work\codex-lean5-20261018\tool-git-branch'] +trust_level = "trusted" + +[projects.'c:\ai\evalsuite\work\codex-final-20261018\code-merge_intervals'] +trust_level = "trusted" + +[projects.'c:\ai\evalsuite\work\codex-final-20261018\debug-pager'] +trust_level = "trusted" + +[projects.'c:\ai\evalsuite\work\codex-final-20261018\tool-sha256'] +trust_level = "trusted" + +[projects.'c:\ai\evalsuite\work\codex-final-20261018\files-version-bump'] +trust_level = "trusted" + +[projects.'c:\ai\evalsuite\work\codex-final-20261018\long-config-path'] +trust_level = "trusted" + +[projects.'c:\ai\evalsuite\work\codex-final-20261018\biz-gst-invoice'] +trust_level = "trusted" + +[projects.'c:\ai\evalsuite\work\codex-final-20261018\recover-encoding'] +trust_level = "trusted" + +[projects.'c:\ai\evalsuite\work\codex-final-20261018\code-gst'] +trust_level = "trusted" + +[projects.'c:\ai\evalsuite\work\codex-final-20261018\debug-bsearch'] +trust_level = "trusted" + +[projects.'c:\ai\evalsuite\work\codex-final2-20261018\code-merge_intervals'] +trust_level = "trusted" + +[projects.'c:\ai\evalsuite\work\codex-final2-20261018\debug-pager'] +trust_level = "trusted" + +[projects.'c:\ai\evalsuite\work\codex-final2-20261018\tool-sha256'] +trust_level = "trusted" + +[projects.'c:\ai\evalsuite\work\codex-final2-20261018\files-version-bump'] +trust_level = "trusted" + +[projects.'c:\ai\evalsuite\work\codex-final2-20261018\long-config-path'] +trust_level = "trusted" + +[projects.'c:\ai\evalsuite\work\codex-final2-20261018\biz-gst-invoice'] +trust_level = "trusted" + +[projects.'c:\ai\evalsuite\work\codex-final2-20261018\recover-encoding'] +trust_level = "trusted" + +[projects.'c:\ai\evalsuite\work\codex-final2-20261018\code-gst'] +trust_level = "trusted" + +[projects.'c:\ai\evalsuite\work\codex-final2-20261018\debug-bsearch'] +trust_level = "trusted" + +[projects.'c:\ai\evalsuite\work\codex-final2-20261018\tool-git-branch'] +trust_level = "trusted" + +[projects.'c:\ai\evalsuite\work\codex-final2-20261018\files-refactor-rename'] +trust_level = "trusted" + +[projects.'c:\ai\evalsuite\work\codex-final2-20261018\long-find-caller'] +trust_level = "trusted" + +[projects.'c:\ai\evalsuite\work\codex-final2-20261018\biz-bank-rec'] +trust_level = "trusted" + +[projects.'c:\ai\evalsuite\work\codex-final2-20261018\recover-missing-dir'] +trust_level = "trusted" + +[projects.'c:\ai\evalsuite\work\codex-final2-20261018\debug-csvout'] +trust_level = "trusted" + +[projects.'c:\ai\evalsuite\work\codex-final2-20261018\tool-unique-suburbs'] +trust_level = "trusted" + +[projects.'c:\ai\evalsuite\work\codex-final2-20261018\files-extract-emails'] +trust_level = "trusted" + +[projects.'c:\ai\evalsuite\work\codex-final2-20261018\biz-price-update'] +trust_level = "trusted" + +[projects.'c:\ai\evalsuite\work\codex-final2-20261018\recover-circular-import'] +trust_level = "trusted" + +[projects.'c:\ai\evalsuite\work\codex-final3-20261018\debug-bsearch'] +trust_level = "trusted" + +[projects.'c:\ai\evalsuite\work\codex-final3-20261018\biz-gst-invoice'] +trust_level = "trusted" + +[projects.'c:\ai\evalsuite\work\codex-final3-20261018\biz-bank-rec'] +trust_level = "trusted" + +[projects.'c:\ai\evalsuite\work\codex-final3-20261018\biz-price-update'] +trust_level = "trusted" + +[projects.'c:\ai\evalsuite\work\codex-accept-20261018\code-merge_intervals'] +trust_level = "trusted" +# Still injected: a truncated list of ~/.agents/skills (about 700 tokens). Codex reads that directory from the user +# profile, not CODEX_HOME; moving rarely used skills out of ~/.agents/skills is the only way to drop it. diff --git a/agents/codex-lean-home/instructions-compact.md b/agents/codex-lean-home/instructions-compact.md new file mode 100644 index 0000000..eefda67 --- /dev/null +++ b/agents/codex-lean-home/instructions-compact.md @@ -0,0 +1,18 @@ +You are Codex, a coding agent running on a local model with a small context window. Work in the user's repository through the tools you are given. + +Rules: +- Read only the files and lines you need. Keep every tool call's output short (head/tail, grep, line ranges). +- Make the smallest change that completes the task. Do not refactor unrelated code. Do not add dependencies without being asked. +- Edit files with `apply_patch` through the shell tool, in small hunks: {"cmd":"apply_patch <<'EOF'\n*** Begin Patch\n*** Update File: path/to/file.py\n@@ def example():\n- pass\n+ return 123\n@@\n-VERSION = \"1.4.2\"\n+VERSION = \"1.5.0\"\n*** End Patch\nEOF"}. The character right after `+`, `-` or ` ` is the line's first character: an unindented line is `+VERSION = ...`, never `+ VERSION = ...`. Never use applypatch or apply-patch. After a patch, print just the changed lines (e.g. `Select-String -Path f -Pattern VERSION`) and check their indentation matches the original; do not re-read whole files. +- Verify every change by running the relevant test, build or lint command and reading its output. Never claim something works without running it. Given tests are not enough: also try the edge cases they miss (empty input, first and last element, a value that is absent or larger than all) with a quick script. +- A stray leading space found in one patched file means every `+` line you wrote may have it: print the added lines in every file you patched and fix each one, even where the file still parses. +- For tasks of more than three steps, write a short numbered plan first and tick items off as you go. +- Facts come from files and tool output, never from memory. If unsure, say so and write [CONFIRM: ...]. +- Call tools with valid JSON arguments, one step at a time. Wait for the result before the next call. +- Final answer: plain text, concise, no reasoning text. State what changed, what was verified and what is left. +- If the same approach fails twice, stop and report what you tried, what failed and what you need. Never re-run an identical command that just failed: change something first. +- A failing check means the output is wrong: fix the file, then re-check. Do not repeat the check hoping for a different result. +- The shell is Windows PowerShell 5.1: `>` and Out-File write UTF-16. Write text files with `Set-Content -Encoding ascii` (or utf8), and multi-line scripts as a file you then run, not `python -c`. +- CSV in PowerShell: `Import-Csv f.csv | Select-Object -ExpandProperty `; pick columns by header name, never by position after a manual split. Sanity-check a computed answer against the data before writing it. +- Money and prices: compute in integer cents or Python `decimal.Decimal` with an explicit rounding mode (ROUND_HALF_UP for "halves round up"); never round binary floats (3.225 is stored as 3.2249...). Build Decimals from the text (`Decimal('3.00')`), never call float() or round() on money, and check one hand-worked row before finishing. Rounding to a step (nearest 5 cents, AU cash rounding) is one rounding: `(x / Decimal('0.05')).quantize(Decimal(1), ROUND_HALF_UP) * Decimal('0.05')`, and every result must then be a multiple of the step (4.10 x 1.075 = 4.4075 -> 4.40, not 4.41). +- "Access denied" inside .git or outside this folder is the sandbox, not a bug: do not retry or work around it; ask for approval or say what needs it. diff --git a/agents/codex-lean-home/preflight.ps1 b/agents/codex-lean-home/preflight.ps1 new file mode 100644 index 0000000..e0f82c4 --- /dev/null +++ b/agents/codex-lean-home/preflight.ps1 @@ -0,0 +1,38 @@ +# codex-qwen preflight (18 Oct 2026): one Qwen job at a time, then print " " for the launcher. +# 1. Job lock: C:\AI\locks\qwen-lock.ps1 acquire (kind codex, holder = the codex-qwen.cmd process), waiting while +# another live job (UBOS runner, eval, benchmark, another Codex) owns it. +# 2. Slot check: also waits while the llama-server slot is busy with a job that does not take the lock (ask_local, chats). +# QWEN_WAIT_S (default 600) caps each wait; QWEN_NOWAIT=1 skips both (lock not taken). Messages go to stderr. +param([string]$Kind = 'codex') +$ErrorActionPreference = 'SilentlyContinue' +$key = $env:LOCAL_QWEN_KEY +if (-not $key) { $key = [Environment]::GetEnvironmentVariable('LOCAL_QWEN_KEY', 'User') } +$maxWait = 600; if ($env:QWEN_WAIT_S) { $maxWait = [int]$env:QWEN_WAIT_S } +$holder = 0 +if ($env:QWEN_NOWAIT -ne '1') { + # for /f runs this script in a child "cmd /c"; its parent is the cmd.exe executing codex-qwen.cmd. + $me = Get-CimInstance Win32_Process -Filter "ProcessId=$PID" + $sub = Get-CimInstance Win32_Process -Filter "ProcessId=$($me.ParentProcessId)" + $launcher = if ($sub -and $sub.Name -ieq 'cmd.exe') { [int]$sub.ParentProcessId } else { [int]$me.ParentProcessId } + & powershell -NoProfile -ExecutionPolicy Bypass -File 'C:\AI\locks\qwen-lock.ps1' acquire -Kind $Kind -HolderPid $launcher -WaitS $maxWait -Note "$Kind-qwen in $((Get-Location).Path)" + if ($LASTEXITCODE -eq 0) { $holder = $launcher } + else { [Console]::Error.WriteLine('codex-qwen: starting without the job lock (expect half speed). Set QWEN_NOWAIT=1 to skip waiting.') } + + $t0 = Get-Date; $said = -999 + while ($true) { + $busy = $false + try { + $s = Invoke-RestMethod 'http://127.0.0.1:8090/upstream/qwen3.8-27b/slots' -Headers @{ Authorization = "Bearer $key" } -TimeoutSec 3 + $busy = [bool](@($s) | Where-Object { $_.is_processing }) + } catch { $busy = $false } # model not loaded / llama-swap starting: nothing to wait for + if (-not $busy) { break } + $el = [int]((Get-Date) - $t0).TotalSeconds + if ($el -ge $maxWait) { [Console]::Error.WriteLine("codex-qwen: Qwen slot still busy after ${el}s - starting anyway."); break } + if ($el - $said -ge 30) { [Console]::Error.WriteLine("codex-qwen: Qwen is answering another request - waiting (${el}s)."); $said = $el } + Start-Sleep -Seconds 3 + } +} +$win = (& 'C:\AI\governor\qwen.ps1' window | Select-Object -Last 1) +if ("$win" -notmatch '^\d+$') { $win = 24576 } +"$win $holder" + diff --git a/agents/codex-qwen-exec.mjs b/agents/codex-qwen-exec.mjs new file mode 100644 index 0000000..1a38957 --- /dev/null +++ b/agents/codex-qwen-exec.mjs @@ -0,0 +1,30 @@ +// codex-qwen-exec.mjs - the "exec" half of codex-qwen.cmd (18 Oct 2026). +// cmd.exe cannot drop the first argument of %* without re-parsing it: a re-parse runs text after "&" inside a quoted +// prompt as a command, and batch %1/shift splits unquoted arguments on "=" (breaking -c key="value"). Node receives the +// arguments already split by the Windows rules, so this inserts the Qwen overrides after "exec" and passes everything +// else through untouched to codex.exe (no shell). Settings come from the launcher's environment: +// QWEN_WIN, QWEN_COMPACT_AT context window and auto-compaction point (tokens) +// QWEN_GITDIR optional: the repo's .git, made writable for unattended runs +// Usage (from codex-qwen.cmd): node codex-qwen-exec.mjs exec [codex exec args...] +import { spawnSync } from 'node:child_process'; + +const argv = process.argv.slice(2); +if (argv[0]?.toLowerCase() !== 'exec') { + process.stderr.write('codex-qwen-exec: first argument must be "exec"\n'); + process.exit(2); +} +const overrides = []; +if (/^\d+$/.test(process.env.QWEN_WIN ?? '')) overrides.push('-c', `model_context_window=${process.env.QWEN_WIN}`); +if (/^\d+$/.test(process.env.QWEN_COMPACT_AT ?? '')) overrides.push('-c', `model_auto_compact_token_limit=${process.env.QWEN_COMPACT_AT}`); +const gitDir = process.env.QWEN_GITDIR; +// a TOML literal string cannot contain a single quote; skip the override rather than build a broken one +if (gitDir && !gitDir.includes("'")) overrides.push('-c', `sandbox_workspace_write.writable_roots=['${gitDir}']`); + +const args = ['exec', ...overrides, ...argv.slice(1)]; +if (process.env.QWEN_EXEC_DRYRUN === '1') { process.stdout.write(JSON.stringify(args) + '\n'); process.exit(0); } +const child = spawnSync('codex', args, { stdio: 'inherit', shell: false, windowsHide: false }); +if (child.error) { + process.stderr.write(`codex-qwen-exec: could not start codex: ${child.error.code ?? child.error.message}\n`); + process.exit(1); +} +process.exit(child.status ?? 1); diff --git a/agents/codex-qwen-full.cmd b/agents/codex-qwen-full.cmd new file mode 100644 index 0000000..c4f9a3c --- /dev/null +++ b/agents/codex-qwen-full.cmd @@ -0,0 +1,26 @@ +@echo off +rem Codex CLI on the local Qwen3.8-27B (ELZYDLAB Arc B60). Live context window from the governor; compacts early to stay fast. +rem Usage: codex-qwen [codex args] Override compaction point: set QWEN_COMPACT=120000 +setlocal +rem Codex Windows sandbox cannot grant itself access to C:\Temp (admin-owned) - use the per-user temp folder +set "TEMP=%LOCALAPPDATA%\Temp" +set "TMP=%LOCALAPPDATA%\Temp" +if "%LOCAL_QWEN_KEY%"=="" for /f "usebackq delims=" %%k in (`powershell -NoProfile -Command "[Environment]::GetEnvironmentVariable('LOCAL_QWEN_KEY','User')"`) do set "LOCAL_QWEN_KEY=%%k" +set "QWEN_WIN=100000" +for /f "usebackq delims=" %%w in (`powershell -NoProfile -ExecutionPolicy Bypass -File C:\AI\governor\qwen.ps1 window`) do set "QWEN_WIN=%%w" +if "%QWEN_CLIENT_CAP%"=="" set "QWEN_CLIENT_CAP=65536" +if %QWEN_WIN% GTR %QWEN_CLIENT_CAP% set "QWEN_WIN=%QWEN_CLIENT_CAP%" +if "%QWEN_COMPACT%"=="" set "QWEN_COMPACT=200000" +set /a QWEN_CAP=QWEN_WIN*90/100 +if %QWEN_COMPACT% GTR %QWEN_CAP% set "QWEN_COMPACT=%QWEN_CAP%" +rem Lean MCP set for the local model: keep context7; cloud/heavy servers off (playwright on with QWEN_BROWSER=1) +set "MCPOFF=-c mcp_servers.render.enabled=false -c mcp_servers.openaiDeveloperDocs.enabled=false -c mcp_servers.headroom.enabled=false -c mcp_servers.node_repl.enabled=false" +if not "%QWEN_BROWSER%"=="1" set "MCPOFF=%MCPOFF% -c mcp_servers.local-ai-playwright.enabled=false" +codex --profile qwen -c model_context_window=%QWEN_WIN% -c model_auto_compact_token_limit=%QWEN_COMPACT% %MCPOFF% %* +endlocal + + + + + +rem (18 Oct 2026) Superseded by codex-qwen (lean). Kept for MCP-heavy sessions. diff --git a/agents/codex-qwen.cmd b/agents/codex-qwen.cmd index 97db198..14f54f6 100644 --- a/agents/codex-qwen.cmd +++ b/agents/codex-qwen.cmd @@ -1,22 +1,58 @@ @echo off -rem Codex CLI on the local Qwen3.8-27B (Arc B60). Live context window from the governor; compacts early to stay fast. -rem Usage: codex-qwen [codex args] Override compaction point: set QWEN_COMPACT=120000 +rem codex-qwen: THE Codex harness for the local Qwen3.8-27B on ELZYDLAB (locked in 18 Oct 2026). +rem Lean CODEX_HOME (C:\AI\codex-local\home): ~3K-token base prompt instead of ~16K, no plugins/MCP/global AGENTS.md. +rem Preflight takes the shared job lock (C:\AI\locks\qwen-engine.lock) so only one Qwen job runs at a time, +rem waits while the slot is busy, then sizes the window from the live server. The lock is released on exit. +rem Usage: codex-qwen [codex args] Old heavy setup (your ~/.codex + MCP): codex-qwen-full +rem Knobs: QWEN_NOWAIT=1 (skip waits, no lock), QWEN_WAIT_S=600, QWEN_COMPACT= (compaction point override) setlocal -rem Codex Windows sandbox cannot grant itself access to C:\Temp (admin-owned) - use the per-user temp folder +set "CODEX_HOME=C:\AI\codex-local\home" +rem Codex's Windows sandbox cannot grant itself access to C:\Temp (admin-owned) - use the per-user temp folder set "TEMP=%LOCALAPPDATA%\Temp" set "TMP=%LOCALAPPDATA%\Temp" if "%LOCAL_QWEN_KEY%"=="" for /f "usebackq delims=" %%k in (`powershell -NoProfile -Command "[Environment]::GetEnvironmentVariable('LOCAL_QWEN_KEY','User')"`) do set "LOCAL_QWEN_KEY=%%k" -set "QWEN_WIN=100000" -for /f "usebackq delims=" %%w in (`powershell -NoProfile -ExecutionPolicy Bypass -File C:\AI\governor\qwen.ps1 window`) do set "QWEN_WIN=%%w" -if "%QWEN_CLIENT_CAP%"=="" set "QWEN_CLIENT_CAP=65536" -if %QWEN_WIN% GTR %QWEN_CLIENT_CAP% set "QWEN_WIN=%QWEN_CLIENT_CAP%" -if "%QWEN_COMPACT%"=="" set "QWEN_COMPACT=200000" -set /a QWEN_CAP=QWEN_WIN*90/100 -if %QWEN_COMPACT% GTR %QWEN_CAP% set "QWEN_COMPACT=%QWEN_CAP%" -rem Lean MCP set for the local model: disable any heavy/cloud MCP servers from your main Codex config here, e.g. -rem -c mcp_servers..enabled=false -rem Each MCP server configured in your ~/.codex/config.toml adds its tool schemas to EVERY request. Switch off the ones a local -rem model does not need, by name, e.g.: set "MCPOFF=-c mcp_servers.playwright.enabled=false -c mcp_servers.render.enabled=false" -if not defined MCPOFF set "MCPOFF=" -codex --profile qwen -c model_context_window=%QWEN_WIN% -c model_auto_compact_token_limit=%QWEN_COMPACT% %MCPOFF% %* -endlocal +set "WIN=" +set "LOCKPID=0" +for /f "usebackq tokens=1,2" %%a in (`powershell -NoProfile -ExecutionPolicy Bypass -File C:\AI\codex-local\preflight.ps1`) do ( + set "WIN=%%a" + set "LOCKPID=%%b" +) +if not defined WIN set "WIN=24576" +set /a "COMPACT=WIN*9/10" +set "CAP=%QWEN_COMPACT%" +if not defined CAP set "CAP=999999" +if %CAP% LSS %COMPACT% set "COMPACT=%CAP%" +rem Git: no global identity is set on this PC, so label commits made from Codex-on-Qwen instead of letting the model +rem invent one. Unattended "exec" runs cannot ask for approval, and Codex's sandbox keeps .git read-only, so for exec +rem only the current repo's .git is made writable (branches/commits work). Interactive sessions keep Codex's protection +rem and ask you before git writes. QWEN_GIT_WRITE=0 turns the exec exception off. +if not defined GIT_AUTHOR_NAME set "GIT_AUTHOR_NAME=Codex (local Qwen)" +if not defined GIT_AUTHOR_EMAIL set "GIT_AUTHOR_EMAIL=codex-qwen@elzydlab.local" +if not defined GIT_COMMITTER_NAME set "GIT_COMMITTER_NAME=%GIT_AUTHOR_NAME%" +if not defined GIT_COMMITTER_EMAIL set "GIT_COMMITTER_EMAIL=%GIT_AUTHOR_EMAIL%" +set "GITDIR=" +set "GITW=" +if /i "%~1"=="exec" if not "%QWEN_GIT_WRITE%"=="0" for /f "usebackq delims=" %%g in (`git rev-parse --absolute-git-dir 2^>nul`) do set "GITDIR=%%g" +rem git prints C:/x/.git; pass the native C:\x\.git form to the Windows sandbox +if defined GITDIR set "GITDIR=%GITDIR:/=\%" +rem For exec, overrides must come AFTER the subcommand: a root-level -c sandbox_workspace_write override is ignored +rem when exec gets -s (VERIFIED 18 Oct: root placement -> .git still denied; after "exec" -> branch created). +if /i not "%~1"=="exec" goto :interactive +rem The sandbox cannot read ~/.config/git, so git warned "unable to access ...git/ignore" on every call: point it at an +rem empty folder for unattended runs only. +set "XDG_CONFIG_HOME=%CODEX_HOME%\xdg" +rem codex-qwen-exec.mjs inserts the overrides after "exec" and passes the rest through as already-split arguments. +rem (cmd cannot drop "exec" from the arguments safely: re-parsing them ran text after an ampersand inside a quoted +rem prompt, and shift-based loops split key="value" on the equals sign. Git dirs with spaces stay one argument.) +set "QWEN_WIN=%WIN%" +set "QWEN_COMPACT_AT=%COMPACT%" +set "QWEN_GITDIR=%GITDIR%" +node "%~dp0codex-qwen-exec.mjs" %* +set "RC=%ERRORLEVEL%" +goto :release +:interactive +codex -c model_context_window=%WIN% -c model_auto_compact_token_limit=%COMPACT% %* +set "RC=%ERRORLEVEL%" +:release +if not "%LOCKPID%"=="0" powershell -NoProfile -ExecutionPolicy Bypass -File C:\AI\locks\qwen-lock.ps1 release -HolderPid %LOCKPID% >nul 2>&1 +endlocal & exit /b %RC% diff --git a/agents/locks/qwen-lock.ps1 b/agents/locks/qwen-lock.ps1 new file mode 100644 index 0000000..8896756 --- /dev/null +++ b/agents/locks/qwen-lock.ps1 @@ -0,0 +1,120 @@ +# qwen-lock.ps1 - one Qwen job at a time on ELZYDLAB (18 Oct 2026; hardened 18 Oct 23:30 after a code review). +# The single llama-server slot is shared: two jobs interleave requests and each runs at about half speed. +# Lock file: C:\AI\locks\qwen-engine.lock (JSON: pid, pstart, kind, started, grace, note) +# acquire -Kind codex|claude|runner|bench|other -HolderPid [-WaitS 600] [-Note text] +# waits while another LIVE holder owns the lock (status line to stderr every ~30 s); exit 0 = acquired, +# exit 3 = still busy after WaitS. A holder is stale (lock taken over) when its PID is dead, when the PID now +# belongs to a different process (start time differs: PID reuse), or, for kinds codex/claude, when it is older than +# its grace (WaitS + 120 s, so the launcher's own slot wait is covered) and no codex.exe/claude.exe runs under it. +# release -HolderPid removes the lock only if owns it +# status prints the holder (or "free") and whether it is live +# A stale lock is removed only if the file still holds exactly what was judged stale (compare-and-delete under an +# exclusive handle), so two waiters cannot both take over and delete each other's fresh lock. +param( + [Parameter(Position = 0)][ValidateSet('acquire', 'release', 'status')][string]$Action = 'status', + [string]$Kind = 'other', + [int]$HolderPid = 0, + [int]$WaitS = 600, + [string]$Note = '' +) +$ErrorActionPreference = 'Stop' +$LockPath = 'C:\AI\locks\qwen-engine.lock' +if ($env:QWEN_LOCK_PATH) { $LockPath = $env:QWEN_LOCK_PATH } # tests only (test-qwen-lock.ps1) + +function Read-LockRaw { + try { + $fs = [IO.File]::Open($LockPath, [IO.FileMode]::Open, [IO.FileAccess]::Read, ([IO.FileShare]::ReadWrite -bor [IO.FileShare]::Delete)) + try { return (New-Object IO.StreamReader($fs)).ReadToEnd() } finally { $fs.Dispose() } + } catch [System.IO.FileNotFoundException] { return $null } + catch [System.IO.DirectoryNotFoundException] { return $null } + catch { return '' } # held exclusively for a moment (being written or removed): treat like a half-written file +} + +function Read-Lock { + if (-not (Test-Path $LockPath)) { return $null } + $raw = Read-LockRaw + if ($null -eq $raw) { return $null } + try { $l = $raw | ConvertFrom-Json; if ($l -and $l.pid) { $l | Add-Member -NotePropertyName raw -NotePropertyValue $raw -Force; return $l } } catch {} + # empty or half-written: another acquirer is writing it right now (CreateNew, then write) - treat as live for 10 s + $when = (Get-Date).ToString('s'); try { $when = (Get-Item $LockPath).LastWriteTime.ToString('s') } catch {} + return [pscustomobject]@{ pid = 0; kind = 'writing'; started = $when; raw = $raw } +} + +function Get-StartStamp([int]$id) { + try { return (Get-Process -Id $id -ErrorAction Stop).StartTime.ToUniversalTime().ToString('o') } catch { return $null } +} + +function Test-Live($lock) { + if ($lock -and $lock.kind -eq 'writing') { try { return (((Get-Date) - [datetime]$lock.started).TotalSeconds -lt 10) } catch { return $false } } + if (-not $lock -or -not $lock.pid) { return $false } + if (-not (Get-Process -Id ([int]$lock.pid) -ErrorAction SilentlyContinue)) { return $false } + if ($lock.pstart) { $now = Get-StartStamp ([int]$lock.pid); if ($now -and $now -ne [string]$lock.pstart) { return $false } } # PID reused + $exe = @{ codex = 'codex.exe'; claude = 'claude.exe' }[[string]$lock.kind] + if (-not $exe) { return $true } + $age = 0 + try { $age = ((Get-Date) - [datetime]$lock.started).TotalSeconds } catch { $age = 99999 } + $grace = 60; if ($lock.grace) { $grace = [int]$lock.grace } + if ($age -lt $grace) { return $true } + # Agent launcher (codex-qwen / claude-qwen): live only while its agent exe runs somewhere under it. + $all = Get-CimInstance Win32_Process -Property ProcessId, ParentProcessId, Name + $kids = @{} + foreach ($p in $all) { $k = [int]$p.ParentProcessId; if (-not $kids[$k]) { $kids[$k] = @() }; $kids[$k] += $p } + $queue = New-Object System.Collections.Queue; $queue.Enqueue([int]$lock.pid); $seen = @{} + while ($queue.Count) { + $id = $queue.Dequeue(); if ($seen[$id]) { continue }; $seen[$id] = $true + foreach ($c in @($kids[$id])) { if (-not $c) { continue }; if ($c.Name -ieq $exe) { return $true }; $queue.Enqueue([int]$c.ProcessId) } + } + return $false +} + +# Delete the lock only if it still holds exactly $expectRaw. The exclusive handle (sharing Delete only) stops anyone +# else from rewriting it between the comparison and the delete. +function Remove-LockIfUnchanged([string]$expectRaw) { + try { + $fs = [IO.File]::Open($LockPath, [IO.FileMode]::Open, [IO.FileAccess]::Read, [IO.FileShare]::Delete) + try { + $now = (New-Object IO.StreamReader($fs)).ReadToEnd() + if ($now -eq $expectRaw) { [IO.File]::Delete($LockPath) } + } finally { $fs.Dispose() } + } catch {} +} + +function Describe($lock) { "$($lock.kind) pid $($lock.pid) since $($lock.started)$(if ($lock.note) { " ($($lock.note))" })" } + +switch ($Action) { + 'status' { + $l = Read-Lock + if (-not $l) { 'free'; exit 0 } + if (Test-Live $l) { "busy: $(Describe $l)" } else { "stale: $(Describe $l)" } + exit 0 + } + 'release' { + $l = Read-Lock + if ($l -and $l.pid -and [int]$l.pid -eq $HolderPid) { Remove-LockIfUnchanged $l.raw } + exit 0 + } + 'acquire' { + if ($HolderPid -le 0) { [Console]::Error.WriteLine('qwen-lock: -HolderPid required'); exit 2 } + New-Item -ItemType Directory -Force (Split-Path $LockPath) | Out-Null + $pstart = Get-StartStamp $HolderPid + $t0 = Get-Date; $lastSaid = -999 + while ($true) { + $l = Read-Lock + if ($l -and $l.pid -and [int]$l.pid -eq $HolderPid -and (-not $l.pstart -or $l.pstart -eq $pstart)) { exit 0 } # already ours + if ($l -and -not (Test-Live $l)) { Remove-LockIfUnchanged $l.raw; $l = Read-Lock } + if (-not $l) { + $json = ([pscustomobject]@{ pid = $HolderPid; pstart = $pstart; kind = $Kind; started = (Get-Date).ToString('s'); grace = ($WaitS + 120); note = $Note } | ConvertTo-Json -Compress) + try { + $fs = [IO.File]::Open($LockPath, [IO.FileMode]::CreateNew, [IO.FileAccess]::Write, [IO.FileShare]::None) + $bytes = [Text.Encoding]::UTF8.GetBytes($json); $fs.Write($bytes, 0, $bytes.Length); $fs.Close() + exit 0 + } catch [System.IO.IOException] { continue } # lost a race: re-read + catch [System.UnauthorizedAccessException] { Start-Sleep -Milliseconds 200; continue } # file is delete-pending + } + $el = [int]((Get-Date) - $t0).TotalSeconds + if ($el -ge $WaitS) { [Console]::Error.WriteLine("qwen-lock: Qwen still busy after ${el}s: $(Describe $l)"); exit 3 } + if ($el - $lastSaid -ge 30) { [Console]::Error.WriteLine("qwen-lock: waiting for Qwen - in use by $(Describe $l) (${el}s)"); $lastSaid = $el } + Start-Sleep -Seconds 3 + } + } +} diff --git a/agents/locks/test-qwen-lock.ps1 b/agents/locks/test-qwen-lock.ps1 new file mode 100644 index 0000000..febe526 --- /dev/null +++ b/agents/locks/test-qwen-lock.ps1 @@ -0,0 +1,56 @@ +# Tests for qwen-lock.ps1 against a scratch lock file (never the live C:\AI\locks\qwen-engine.lock). +$ErrorActionPreference = 'Continue' # the lock prints waiting lines on stderr; PS 5.1 would turn them into errors +$script = Join-Path $PSScriptRoot 'qwen-lock.ps1' +$dir = Join-Path $env:LOCALAPPDATA "Temp\qwen-lock-test-$PID" +New-Item -ItemType Directory -Force $dir | Out-Null +$env:QWEN_LOCK_PATH = Join-Path $dir 'test.lock' +$fails = 0 +function Check($name, $ok) { if ($ok) { "ok $name" } else { "FAIL $name"; $script:fails++ } } +function Lock { param([Parameter(ValueFromRemainingArguments = $true)]$a) & powershell -NoProfile -ExecutionPolicy Bypass -File $script @a 2>$null; return $LASTEXITCODE } +function Status { (& powershell -NoProfile -ExecutionPolicy Bypass -File $script status) | Select-Object -Last 1 } +function Put($obj) { [IO.File]::WriteAllText($env:QWEN_LOCK_PATH, ($obj | ConvertTo-Json -Compress)) } +$me = $PID +$meStart = (Get-Process -Id $me).StartTime.ToUniversalTime().ToString('o') +try { + Check 'free at start' ((Status) -eq 'free') + Check 'acquire free lock' ((Lock acquire -Kind runner -HolderPid $me -WaitS 5) -eq 0) + Check 'status busy while holder lives' ((Status) -like 'busy: runner*') + Check 'lock records the holder start time' ((Get-Content $env:QWEN_LOCK_PATH -Raw | ConvertFrom-Json).pstart -eq $meStart) + Check 're-acquire by the same holder is a no-op' ((Lock acquire -Kind runner -HolderPid $me -WaitS 5) -eq 0) + $other = Start-Process powershell -ArgumentList '-NoProfile', '-Command', 'Start-Sleep 60' -WindowStyle Hidden -PassThru + Check 'another holder waits and times out (exit 3)' ((Lock acquire -Kind runner -HolderPid $other.Id -WaitS 4) -eq 3) + Check 'release by a non-owner does nothing' ((Lock release -HolderPid $other.Id) -eq 0 -and (Test-Path $env:QWEN_LOCK_PATH)) + Check 'release by the owner frees it' ((Lock release -HolderPid $me) -eq 0 -and -not (Test-Path $env:QWEN_LOCK_PATH)) + + Put @{ pid = 999999; kind = 'runner'; started = (Get-Date).ToString('s') } + Check 'dead holder is stale and taken over' ((Lock acquire -Kind runner -HolderPid $other.Id -WaitS 5) -eq 0 -and ((Get-Content $env:QWEN_LOCK_PATH -Raw | ConvertFrom-Json).pid -eq $other.Id)) + Remove-Item $env:QWEN_LOCK_PATH + + Put @{ pid = $me; pstart = '2001-01-01T00:00:00.0000000Z'; kind = 'runner'; started = (Get-Date).ToString('s') } + Check 'reused PID (start time differs) is stale' ((Status) -like 'stale:*') + Remove-Item $env:QWEN_LOCK_PATH + + $old = (Get-Date).AddSeconds(-300).ToString('s') + Put @{ pid = $me; pstart = $meStart; kind = 'codex'; started = $old; grace = 720 } + Check 'codex holder inside its grace (preflight slot wait) stays live' ((Status) -like 'busy:*') + Put @{ pid = $me; pstart = $meStart; kind = 'codex'; started = $old; grace = 60 } + Check 'codex holder past grace with no codex.exe child is stale' ((Status) -like 'stale:*') + Put @{ pid = $me; pstart = $meStart; kind = 'codex'; started = $old } + Check 'old-format codex lock keeps the 60 s rule' ((Status) -like 'stale:*') + Remove-Item $env:QWEN_LOCK_PATH + + # race: two waiters on the same stale lock - exactly one may win + Put @{ pid = 999999; kind = 'runner'; started = (Get-Date).ToString('s') } + $h1 = Start-Process powershell -ArgumentList '-NoProfile', '-Command', 'Start-Sleep 60' -WindowStyle Hidden -PassThru + $h2 = Start-Process powershell -ArgumentList '-NoProfile', '-Command', 'Start-Sleep 60' -WindowStyle Hidden -PassThru + $j1 = Start-Job { param($s, $p, $l) $env:QWEN_LOCK_PATH = $l; & powershell -NoProfile -ExecutionPolicy Bypass -File $s acquire -Kind runner -HolderPid $p -WaitS 6 2>$null; $LASTEXITCODE } -ArgumentList $script, $h1.Id, $env:QWEN_LOCK_PATH + $j2 = Start-Job { param($s, $p, $l) $env:QWEN_LOCK_PATH = $l; & powershell -NoProfile -ExecutionPolicy Bypass -File $s acquire -Kind runner -HolderPid $p -WaitS 6 2>$null; $LASTEXITCODE } -ArgumentList $script, $h2.Id, $env:QWEN_LOCK_PATH + $r = @(Receive-Job $j1 -Wait -AutoRemoveJob | Select-Object -Last 1) + @(Receive-Job $j2 -Wait -AutoRemoveJob | Select-Object -Last 1) + $winner = (Get-Content $env:QWEN_LOCK_PATH -Raw | ConvertFrom-Json).pid + Check "stale takeover race: one winner, one waiter (exit codes $($r -join ','))" ((@($r | Where-Object { $_ -eq 0 }).Count -eq 1) -and (@($r | Where-Object { $_ -eq 3 }).Count -eq 1) -and ($winner -in @($h1.Id, $h2.Id))) + foreach ($p in @($other, $h1, $h2)) { Stop-Process -Id $p.Id -Force -ErrorAction SilentlyContinue } +} finally { + Remove-Item -Recurse -Force $dir -ErrorAction SilentlyContinue + Remove-Item Env:QWEN_LOCK_PATH -ErrorAction SilentlyContinue +} +if ($fails) { "$fails FAILED"; exit 1 } else { 'QWEN_LOCK_TESTS_PASS'; exit 0 } diff --git a/bench/ab-20261018/A0-f16-32k.result.json b/bench/ab-20261018/A0-f16-32k.result.json new file mode 100644 index 0000000..5b00894 --- /dev/null +++ b/bench/ab-20261018/A0-f16-32k.result.json @@ -0,0 +1,51 @@ +{ + "label": "A0-f16-32k", + "kv": "f16", + "ctx": 32768, + "exe": "C:\\AI\\llama.cpp\\vulkan-intelfa\\llama-server.exe", + "extra": "", + "env": "GGML_VK_FORCE_MMVQ=1", + "load_s": 16.2, + "healthy": true, + "dedicated_gib": 20.08, + "shared_gib": 0.75, + "adapter_used_gib": 22.17, + "free_gib": 1.73, + "pp": [ + { + "prompt_n": 2076, + "prompt_tps": 471.2 + }, + { + "prompt_n": 8199, + "prompt_tps": 520.1 + } + ], + "tps": [ + 38.95, + 43.01, + 44.16 + ], + "ttft_s": [ + 1.128, + 0.382, + 0.391 + ], + "draft_accept": [ + 0.622, + 0.683, + 0.713 + ], + "rounds": [ + 461.0, + 423.0, + 413.0 + ], + "ms_per_round": [ + 128.3, + 126.6, + 126.3 + ], + "tps_mean": 42.04, + "shared_gib_after": 0.99 +} diff --git a/bench/ab-20261018/A0-f16-32k.sustained.jsonl b/bench/ab-20261018/A0-f16-32k.sustained.jsonl new file mode 100644 index 0000000..51c2d6e --- /dev/null +++ b/bench/ab-20261018/A0-f16-32k.sustained.jsonl @@ -0,0 +1,3 @@ +{"context": 32768, "finish_reason": "length", "label": "A0-f16-32k", "latency": {"first_content_s": 1.127670499998203, "headers_s": 0.5401423000002978}, "long_enough": true, "native_counter_deltas": {"n_decode_total": 493.0, "prompt_tokens_total": 189.0, "spec_decode_num_accepted_tokens_total": 1812.0, "spec_decode_num_draft_tokens_total": 2915.0, "spec_decode_num_drafts_total": 461.0, "tokens_predicted_seconds_total": 59.128198, "tokens_predicted_total": 2304.0}, "output_executed": false, "quality_acceptance": "not evaluated; capped outputs are not completed code", "run": 1, "speed_floor_met": false, "streaming": true, "timings": {"cache_n": 0, "draft_n": 2915, "draft_n_accepted": 1812, "predicted_ms": 59128.151, "predicted_n": 2304, "predicted_per_second": 38.94929844838206, "predicted_per_token_ms": 25.67440338688667, "prompt_ms": 607.911, "prompt_n": 189, "prompt_per_second": 310.90077330398697, "prompt_per_token_ms": 3.2164603174603172}, "usage": {"completion_tokens": 2304, "prompt_tokens": 189, "prompt_tokens_details": {"cached_tokens": 0}, "total_tokens": 2493}, "utc": "2026-10-18T00:14:18.073531+00:00", "wall_s": 60.257} +{"context": 32768, "finish_reason": "length", "label": "A0-f16-32k", "latency": {"first_content_s": 0.38193150000006426, "headers_s": 0.23589070000161882}, "long_enough": true, "native_counter_deltas": {"n_decode_total": 438.0, "prompt_tokens_total": 4.0, "spec_decode_num_accepted_tokens_total": 1866.0, "spec_decode_num_draft_tokens_total": 2734.0, "spec_decode_num_drafts_total": 423.0, "tokens_predicted_seconds_total": 53.5408, "tokens_predicted_total": 2304.0}, "output_executed": false, "quality_acceptance": "not evaluated; capped outputs are not completed code", "run": 2, "speed_floor_met": true, "streaming": true, "timings": {"cache_n": 185, "draft_n": 2734, "draft_n_accepted": 1866, "predicted_ms": 53541.1, "predicted_n": 2304, "predicted_per_second": 43.01368481409609, "predicted_per_token_ms": 23.24841511072514, "prompt_ms": 161.496, "prompt_n": 4, "prompt_per_second": 24.76841531678803, "prompt_per_token_ms": 40.374}, "usage": {"completion_tokens": 2304, "prompt_tokens": 189, "prompt_tokens_details": {"cached_tokens": 185}, "total_tokens": 2493}, "utc": "2026-10-18T00:15:12.000552+00:00", "wall_s": 53.924} +{"context": 32768, "finish_reason": "length", "label": "A0-f16-32k", "latency": {"first_content_s": 0.3914587999970536, "headers_s": 0.24501880000025267}, "long_enough": true, "native_counter_deltas": {"n_decode_total": 428.0, "prompt_tokens_total": 4.0, "spec_decode_num_accepted_tokens_total": 1876.0, "spec_decode_num_draft_tokens_total": 2631.0, "spec_decode_num_drafts_total": 413.0, "tokens_predicted_seconds_total": 52.152, "tokens_predicted_total": 2304.0}, "output_executed": false, "quality_acceptance": "not evaluated; capped outputs are not completed code", "run": 3, "speed_floor_met": true, "streaming": true, "timings": {"cache_n": 185, "draft_n": 2631, "draft_n_accepted": 1876, "predicted_ms": 52152.167, "predicted_n": 2304, "predicted_per_second": 44.15923886729386, "predicted_per_token_ms": 22.64531784628745, "prompt_ms": 161.43, "prompt_n": 4, "prompt_per_second": 24.77854178281608, "prompt_per_token_ms": 40.3575}, "usage": {"completion_tokens": 2304, "prompt_tokens": 189, "prompt_tokens_details": {"cached_tokens": 185}, "total_tokens": 2493}, "utc": "2026-10-18T00:16:04.547160+00:00", "wall_s": 52.544} diff --git a/bench/ab-20261018/A1-q8kv-32k.result.json b/bench/ab-20261018/A1-q8kv-32k.result.json new file mode 100644 index 0000000..acd9ca9 --- /dev/null +++ b/bench/ab-20261018/A1-q8kv-32k.result.json @@ -0,0 +1,51 @@ +{ + "label": "A1-q8kv-32k", + "kv": "q8_0", + "ctx": 32768, + "exe": "C:\\AI\\llama.cpp\\vulkan-intelfa\\llama-server.exe", + "extra": "", + "env": "GGML_VK_FORCE_MMVQ=1", + "load_s": 16.2, + "healthy": true, + "dedicated_gib": 19.14, + "shared_gib": 0.75, + "adapter_used_gib": 21.24, + "free_gib": 2.66, + "pp": [ + { + "prompt_n": 2076, + "prompt_tps": 432.5 + }, + { + "prompt_n": 8199, + "prompt_tps": 380.5 + } + ], + "tps": [ + 34.34, + 33.62, + 37.52 + ], + "ttft_s": [ + 0.957, + 0.310, + 0.283 + ], + "draft_accept": [ + 0.606, + 0.593, + 0.672 + ], + "rounds": [ + 474.0, + 485.0, + 436.0 + ], + "ms_per_round": [ + 141.5, + 141.3, + 140.8 + ], + "tps_mean": 35.16, + "shared_gib_after": 0.98 +} diff --git a/bench/ab-20261018/A1-q8kv-32k.sustained.jsonl b/bench/ab-20261018/A1-q8kv-32k.sustained.jsonl new file mode 100644 index 0000000..4ae9066 --- /dev/null +++ b/bench/ab-20261018/A1-q8kv-32k.sustained.jsonl @@ -0,0 +1,3 @@ +{"context": 32768, "finish_reason": "length", "label": "A1-q8kv-32k", "latency": {"first_content_s": 0.9567925000010291, "headers_s": 0.3535379000022658}, "long_enough": true, "native_counter_deltas": {"n_decode_total": 499.0, "prompt_tokens_total": 189.0, "spec_decode_num_accepted_tokens_total": 1806.0, "spec_decode_num_draft_tokens_total": 2980.0, "spec_decode_num_drafts_total": 474.0, "tokens_predicted_seconds_total": 67.06349800000001, "tokens_predicted_total": 2304.0}, "output_executed": false, "quality_acceptance": "not evaluated; capped outputs are not completed code", "run": 1, "speed_floor_met": false, "streaming": true, "timings": {"cache_n": 0, "draft_n": 2980, "draft_n_accepted": 1806, "predicted_ms": 67063.461, "predicted_n": 2304, "predicted_per_second": 34.340607622383224, "predicted_per_token_ms": 29.120043855840205, "prompt_ms": 629.307, "prompt_n": 189, "prompt_per_second": 300.33036339973967, "prompt_per_token_ms": 3.3296666666666668}, "usage": {"completion_tokens": 2304, "prompt_tokens": 189, "prompt_tokens_details": {"cached_tokens": 0}, "total_tokens": 2493}, "utc": "2026-10-18T00:18:54.854882+00:00", "wall_s": 68.02} +{"context": 32768, "finish_reason": "length", "label": "A1-q8kv-32k", "latency": {"first_content_s": 0.31021599999803584, "headers_s": 0.15322849999938626}, "long_enough": true, "native_counter_deltas": {"n_decode_total": 512.0, "prompt_tokens_total": 4.0, "spec_decode_num_accepted_tokens_total": 1792.0, "spec_decode_num_draft_tokens_total": 3020.0, "spec_decode_num_drafts_total": 485.0, "tokens_predicted_seconds_total": 68.5085, "tokens_predicted_total": 2304.0}, "output_executed": false, "quality_acceptance": "not evaluated; capped outputs are not completed code", "run": 2, "speed_floor_met": false, "streaming": true, "timings": {"cache_n": 185, "draft_n": 3020, "draft_n_accepted": 1792, "predicted_ms": 68508.244, "predicted_n": 2304, "predicted_per_second": 33.61639221113301, "predicted_per_token_ms": 29.74739209726444, "prompt_ms": 173.921, "prompt_n": 4, "prompt_per_second": 22.998947798138236, "prompt_per_token_ms": 43.48025}, "usage": {"completion_tokens": 2304, "prompt_tokens": 189, "prompt_tokens_details": {"cached_tokens": 185}, "total_tokens": 2493}, "utc": "2026-10-18T00:20:03.676668+00:00", "wall_s": 68.819} +{"context": 32768, "finish_reason": "length", "label": "A1-q8kv-32k", "latency": {"first_content_s": 0.28343519999907585, "headers_s": 0.1306546999985585}, "long_enough": true, "native_counter_deltas": {"n_decode_total": 454.0, "prompt_tokens_total": 4.0, "spec_decode_num_accepted_tokens_total": 1850.0, "spec_decode_num_draft_tokens_total": 2751.0, "spec_decode_num_drafts_total": 436.0, "tokens_predicted_seconds_total": 61.379999999999995, "tokens_predicted_total": 2304.0}, "output_executed": false, "quality_acceptance": "not evaluated; capped outputs are not completed code", "run": 3, "speed_floor_met": false, "streaming": true, "timings": {"cache_n": 185, "draft_n": 2751, "draft_n_accepted": 1850, "predicted_ms": 61379.899, "predicted_n": 2304, "predicted_per_second": 37.52042667909897, "predicted_per_token_ms": 26.65214893617021, "prompt_ms": 167.68, "prompt_n": 4, "prompt_per_second": 23.85496183206107, "prompt_per_token_ms": 41.92}, "usage": {"completion_tokens": 2304, "prompt_tokens": 189, "prompt_tokens_details": {"cached_tokens": 185}, "total_tokens": 2493}, "utc": "2026-10-18T00:21:05.343218+00:00", "wall_s": 61.664} diff --git a/bench/ab-20261018/B1-perflog-32k.result.json b/bench/ab-20261018/B1-perflog-32k.result.json new file mode 100644 index 0000000..2920d54 --- /dev/null +++ b/bench/ab-20261018/B1-perflog-32k.result.json @@ -0,0 +1,34 @@ +{ + "label": "B1-perflog-32k", + "kv": "f16", + "ctx": 32768, + "exe": "C:\\AI\\llama.cpp\\vulkan-intelfa\\llama-server.exe", + "extra": "", + "env": "GGML_VK_FORCE_MMVQ=1", + "load_s": 16.2, + "healthy": true, + "dedicated_gib": 20.08, + "shared_gib": 0.75, + "adapter_used_gib": 22.17, + "free_gib": 1.73, + "pp": [ + + ], + "tps": [ + 17.10 + ], + "ttft_s": [ + 0.926 + ], + "draft_accept": [ + 0.622 + ], + "rounds": [ + 461.0 + ], + "ms_per_round": [ + 292.2 + ], + "tps_mean": 17.1, + "shared_gib_after": 0.97 +} diff --git a/bench/ab-20261018/B1-perflog-summary.txt b/bench/ab-20261018/B1-perflog-summary.txt new file mode 100644 index 0000000..0e35778 --- /dev/null +++ b/bench/ab-20261018/B1-perflog-summary.txt @@ -0,0 +1,15 @@ +Test B (18 Oct 2026 11:23) - DFlash per-round attribution, production Vulkan 11526, f16 KV, ctx 32768, seed 4242, 2304 tokens. +GGML_VK_PERF_LOGGER=1 (frequency 1); logger serialises submissions, so its own wall (292 ms/round, 17.1 tok/s) is not a speed figure. +Same seed without logger (A0 run 1): 128.3 ms/round, 461 rounds, acceptance 0.622, 38.95 tok/s - identical rounds/acceptance. +Parsed with parse_perflog.py (raw 2.8 MB log not kept): + target verify graph (497 matmuls, 48 GDN, 16 FA), 1.00/round ... 101.2 ms/round GPU + MUL_MAT_VEC q4_K 17408x5120 n=8 22.62 | q4_K 5120x17408 n=8 12.61 | CPY 6.42 | q6_K 17408x5120 5.48 + q6_K 5120x6144 4.53 | q6_K lm_head 248320x5120 n=8 4.48 | q4_K 10240x5120 4.46 | q4_K 6144x5120 2.83 + draft graph (69 matmuls, 5 FA), 1.07/round ........................ 17.6 ms/round GPU + q6_K lm_head 248320x5120 n=8 6.08 | FLASH_ATTN_EXT 2.97 | q4_K 17408x5120 2.92 | ... + feature inject graph, 1.07/round ................................... 0.9 ms/round GPU + single-token / prompt graphs ....................................... 5.4 ms/round GPU + GPU total 125.2 ms/round vs wall 128.3 ms/round -> host readback/injection/sync gap ~3.1 ms/round +Conclusion: the round is GPU-kernel bound, not host/sync bound (gap < 5 ms, directive threshold). The verify mat-vec +(n=8 columns) reads ~16 GB of weights per round in ~101 ms = ~160 GB/s, about 35 % of the B60's 456 GB/s: kernel +efficiency at n=8 on Xe2 is the real lever (engine work, scratch build), not the DFlash bridge. diff --git a/bench/ab-20261018/B2-perflog-kq2.result.json b/bench/ab-20261018/B2-perflog-kq2.result.json new file mode 100644 index 0000000..0314b74 --- /dev/null +++ b/bench/ab-20261018/B2-perflog-kq2.result.json @@ -0,0 +1,35 @@ +{ + "label": "B2-perflog-kq2", + "kv": "f16", + "ctx": 32768, + "exe": "D:\\build\\vk-tune-20261018-build\\bin\\llama-server.exe", + "extra": "", + "env": "GGML_VK_FORCE_MMVQ=1", + "load_s": 16.2, + "healthy": true, + "dedicated_gib": 20.08, + "shared_gib": 0.75, + "adapter_used_gib": 22.26, + "free_gib": 1.64, + "pp": [ + + ], + "tps": [ + 19.14 + ], + "ttft_s": [ + 1.003 + ], + "draft_accept": [ + 0.622 + ], + "rounds": [ + 461.0 + ], + "ms_per_round": [ + 261.1 + ], + "tps_mean": 19.14, + "oc": "freq_offset=0.0 volt_offset=0.0 power=100.0 temp_limit=100.0 vram=19.000 | clock=2400MHz temp=59.0C vram_clock=2375 vram_eff=19.0", + "shared_gib_after": 0.98 +} diff --git a/bench/ab-20261018/K0-scratch-default.result.json b/bench/ab-20261018/K0-scratch-default.result.json new file mode 100644 index 0000000..bed5aae --- /dev/null +++ b/bench/ab-20261018/K0-scratch-default.result.json @@ -0,0 +1,65 @@ +{ + "label": "K0-scratch-default", + "kv": "f16", + "ctx": 32768, + "exe": "D:\\build\\vk-tune-20261018-build\\bin\\llama-server.exe", + "extra": "", + "env": "GGML_VK_FORCE_MMVQ=1", + "load_s": 18.2, + "healthy": true, + "dedicated_gib": 20.08, + "shared_gib": 0.75, + "adapter_used_gib": 22.16, + "free_gib": 1.74, + "pp": [ + { + "prompt_n": 2076, + "prompt_tps": 451.7 + }, + { + "prompt_n": 8199, + "prompt_tps": 518.6 + } + ], + "tps": [ + 38.80, + 43.24, + 44.17 + ], + "ttft_s": [ + 1.561, + 0.374, + 0.345 + ], + "draft_accept": [ + 0.622, + 0.683, + 0.713 + ], + "rounds": [ + 461.0, + 423.0, + 413.0 + ], + "ms_per_round": [ + 128.8, + 125.9, + 126.3 + ], + "tps_mean": 42.07, + "greedy": { + "label": "K0-scratch-default", + "hashes": [ + "cb262bd4ed63eae7", + "ddce5fe8551d4957", + "22220fe1d4624289" + ], + "tps": [ + 44.57, + 20.83, + 61.86 + ] + }, + "oc": "freq_offset=0.0 volt_offset=0.0 power=100.0 temp_limit=100.0 vram=19.000 | clock=2250MHz temp=64.0C vram_clock=2375 vram_eff=19.0", + "shared_gib_after": 0.99 +} diff --git a/bench/ab-20261018/K0-scratch-default.sustained.jsonl b/bench/ab-20261018/K0-scratch-default.sustained.jsonl new file mode 100644 index 0000000..74996e6 --- /dev/null +++ b/bench/ab-20261018/K0-scratch-default.sustained.jsonl @@ -0,0 +1,3 @@ +{"context": 32768, "finish_reason": "length", "label": "K0-scratch-default", "latency": {"first_content_s": 1.5613729000033345, "headers_s": 0.8891530000037164}, "long_enough": true, "native_counter_deltas": {"n_decode_total": 493.0, "prompt_tokens_total": 189.0, "spec_decode_num_accepted_tokens_total": 1812.0, "spec_decode_num_draft_tokens_total": 2915.0, "spec_decode_num_drafts_total": 461.0, "tokens_predicted_seconds_total": 59.354198, "tokens_predicted_total": 2304.0}, "output_executed": false, "quality_acceptance": "not evaluated; capped outputs are not completed code", "run": 1, "speed_floor_met": false, "streaming": true, "timings": {"cache_n": 0, "draft_n": 2915, "draft_n_accepted": 1812, "predicted_ms": 59354.169, "predicted_n": 2304, "predicted_per_second": 38.8009812756371, "predicted_per_token_ms": 25.772544072948328, "prompt_ms": 636.559, "prompt_n": 189, "prompt_per_second": 296.90884898336213, "prompt_per_token_ms": 3.3680370370370367}, "usage": {"completion_tokens": 2304, "prompt_tokens": 189, "prompt_tokens_details": {"cached_tokens": 0}, "total_tokens": 2493}, "utc": "2026-10-18T01:25:55.884629+00:00", "wall_s": 60.817} +{"context": 32768, "finish_reason": "length", "label": "K0-scratch-default", "latency": {"first_content_s": 0.37364070000330685, "headers_s": 0.21866070000396576}, "long_enough": true, "native_counter_deltas": {"n_decode_total": 438.0, "prompt_tokens_total": 4.0, "spec_decode_num_accepted_tokens_total": 1866.0, "spec_decode_num_draft_tokens_total": 2734.0, "spec_decode_num_drafts_total": 423.0, "tokens_predicted_seconds_total": 53.262800000000006, "tokens_predicted_total": 2304.0}, "output_executed": false, "quality_acceptance": "not evaluated; capped outputs are not completed code", "run": 2, "speed_floor_met": true, "streaming": true, "timings": {"cache_n": 185, "draft_n": 2734, "draft_n_accepted": 1866, "predicted_ms": 53262.348, "predicted_n": 2304, "predicted_per_second": 43.23879976151258, "predicted_per_token_ms": 23.12737646547981, "prompt_ms": 193.375, "prompt_n": 4, "prompt_per_second": 20.685197155785392, "prompt_per_token_ms": 48.34375}, "usage": {"completion_tokens": 2304, "prompt_tokens": 189, "prompt_tokens_details": {"cached_tokens": 185}, "total_tokens": 2493}, "utc": "2026-10-18T01:26:49.524241+00:00", "wall_s": 53.637} +{"context": 32768, "finish_reason": "length", "label": "K0-scratch-default", "latency": {"first_content_s": 0.3453756000017165, "headers_s": 0.19328360000508837}, "long_enough": true, "native_counter_deltas": {"n_decode_total": 428.0, "prompt_tokens_total": 4.0, "spec_decode_num_accepted_tokens_total": 1876.0, "spec_decode_num_draft_tokens_total": 2631.0, "spec_decode_num_drafts_total": 413.0, "tokens_predicted_seconds_total": 52.14399999999999, "tokens_predicted_total": 2304.0}, "output_executed": false, "quality_acceptance": "not evaluated; capped outputs are not completed code", "run": 3, "speed_floor_met": true, "streaming": true, "timings": {"cache_n": 185, "draft_n": 2631, "draft_n_accepted": 1876, "predicted_ms": 52144.064, "predicted_n": 2304, "predicted_per_second": 44.16610105418711, "predicted_per_token_ms": 22.641799392097266, "prompt_ms": 167.265, "prompt_n": 4, "prompt_per_second": 23.914148207933522, "prompt_per_token_ms": 41.81625}, "usage": {"completion_tokens": 2304, "prompt_tokens": 189, "prompt_tokens_details": {"cached_tokens": 185}, "total_tokens": 2493}, "utc": "2026-10-18T01:27:42.027818+00:00", "wall_s": 52.49} diff --git a/bench/ab-20261018/K1-kq2-wg3.result.json b/bench/ab-20261018/K1-kq2-wg3.result.json new file mode 100644 index 0000000..026f298 --- /dev/null +++ b/bench/ab-20261018/K1-kq2-wg3.result.json @@ -0,0 +1,65 @@ +{ + "label": "K1-kq2-wg3", + "kv": "f16", + "ctx": 32768, + "exe": "D:\\build\\vk-tune-20261018-build\\bin\\llama-server.exe", + "extra": "", + "env": "GGML_VK_FORCE_MMVQ=1", + "load_s": 20.2, + "healthy": true, + "dedicated_gib": 20.08, + "shared_gib": 0.75, + "adapter_used_gib": 22.12, + "free_gib": 1.78, + "pp": [ + { + "prompt_n": 2076, + "prompt_tps": 269.0 + }, + { + "prompt_n": 8199, + "prompt_tps": 364.3 + } + ], + "tps": [ + 35.48, + 43.36, + 45.36 + ], + "ttft_s": [ + 1.052, + 0.354, + 0.299 + ], + "draft_accept": [ + 0.629, + 0.581, + 0.597 + ], + "rounds": [ + 461.0, + 500.0, + 484.0 + ], + "ms_per_round": [ + 140.8, + 106.2, + 104.9 + ], + "tps_mean": 41.4, + "greedy": { + "label": "K1-kq2-wg3", + "hashes": [ + "cb262bd4ed63eae7", + "da57d6f7cbde26a2", + "22220fe1d4624289" + ], + "tps": [ + 51.98, + 23.8, + 72.93 + ] + }, + "oc": "freq_offset=0.0 volt_offset=0.0 power=100.0 temp_limit=100.0 vram=19.000 | clock=2400MHz temp=64.0C vram_clock=2375 vram_eff=19.0", + "shared_gib_after": 0.99 +} diff --git a/bench/ab-20261018/K1-kq2-wg3.sustained.jsonl b/bench/ab-20261018/K1-kq2-wg3.sustained.jsonl new file mode 100644 index 0000000..2921712 --- /dev/null +++ b/bench/ab-20261018/K1-kq2-wg3.sustained.jsonl @@ -0,0 +1,3 @@ +{"context": 32768, "finish_reason": "length", "label": "K1-kq2-wg3", "latency": {"first_content_s": 1.0519152999986545, "headers_s": 0.48180510000383947}, "long_enough": true, "native_counter_deltas": {"n_decode_total": 477.0, "prompt_tokens_total": 189.0, "spec_decode_num_accepted_tokens_total": 1828.0, "spec_decode_num_draft_tokens_total": 2904.0, "spec_decode_num_drafts_total": 461.0, "tokens_predicted_seconds_total": 64.91279800000001, "tokens_predicted_total": 2304.0}, "output_executed": false, "quality_acceptance": "not evaluated; capped outputs are not completed code", "run": 1, "speed_floor_met": false, "streaming": true, "timings": {"cache_n": 0, "draft_n": 2904, "draft_n_accepted": 1828, "predicted_ms": 64912.758, "predicted_n": 2304, "predicted_per_second": 35.4783877770222, "predicted_per_token_ms": 28.186173686495877, "prompt_ms": 580.584, "prompt_n": 189, "prompt_per_second": 325.53428961183914, "prompt_per_token_ms": 3.0718730158730154}, "usage": {"completion_tokens": 2304, "prompt_tokens": 189, "prompt_tokens_details": {"cached_tokens": 0}, "total_tokens": 2493}, "utc": "2026-10-18T01:30:18.715685+00:00", "wall_s": 66.278} +{"context": 32768, "finish_reason": "length", "label": "K1-kq2-wg3", "latency": {"first_content_s": 0.35365810000075726, "headers_s": 0.2071529000022565}, "long_enough": true, "native_counter_deltas": {"n_decode_total": 522.0, "prompt_tokens_total": 4.0, "spec_decode_num_accepted_tokens_total": 1782.0, "spec_decode_num_draft_tokens_total": 3065.0, "spec_decode_num_drafts_total": 500.0, "tokens_predicted_seconds_total": 53.11619999999999, "tokens_predicted_total": 2304.0}, "output_executed": false, "quality_acceptance": "not evaluated; capped outputs are not completed code", "run": 2, "speed_floor_met": true, "streaming": true, "timings": {"cache_n": 185, "draft_n": 3065, "draft_n_accepted": 1782, "predicted_ms": 53116.319, "predicted_n": 2304, "predicted_per_second": 43.35767318514673, "predicted_per_token_ms": 23.063968302214505, "prompt_ms": 178.974, "prompt_n": 4, "prompt_per_second": 22.349615027881146, "prompt_per_token_ms": 44.7435}, "usage": {"completion_tokens": 2304, "prompt_tokens": 189, "prompt_tokens_details": {"cached_tokens": 185}, "total_tokens": 2493}, "utc": "2026-10-18T01:31:12.189453+00:00", "wall_s": 53.471} +{"context": 32768, "finish_reason": "length", "label": "K1-kq2-wg3", "latency": {"first_content_s": 0.29897770000388846, "headers_s": 0.17095179999887478}, "long_enough": true, "native_counter_deltas": {"n_decode_total": 502.0, "prompt_tokens_total": 4.0, "spec_decode_num_accepted_tokens_total": 1802.0, "spec_decode_num_draft_tokens_total": 3018.0, "spec_decode_num_drafts_total": 484.0, "tokens_predicted_seconds_total": 50.769000000000005, "tokens_predicted_total": 2304.0}, "output_executed": false, "quality_acceptance": "not evaluated; capped outputs are not completed code", "run": 3, "speed_floor_met": true, "streaming": true, "timings": {"cache_n": 185, "draft_n": 3018, "draft_n_accepted": 1802, "predicted_ms": 50769.141, "predicted_n": 2304, "predicted_per_second": 45.362201420740995, "predicted_per_token_ms": 22.044785497177596, "prompt_ms": 143.222, "prompt_n": 4, "prompt_per_second": 27.92867017636955, "prompt_per_token_ms": 35.8055}, "usage": {"completion_tokens": 2304, "prompt_tokens": 189, "prompt_tokens_details": {"cached_tokens": 185}, "total_tokens": 2493}, "utc": "2026-10-18T01:32:03.260620+00:00", "wall_s": 51.069} diff --git a/bench/ab-20261018/K2-kq2.result.json b/bench/ab-20261018/K2-kq2.result.json new file mode 100644 index 0000000..756a488 --- /dev/null +++ b/bench/ab-20261018/K2-kq2.result.json @@ -0,0 +1,65 @@ +{ + "label": "K2-kq2", + "kv": "f16", + "ctx": 32768, + "exe": "D:\\build\\vk-tune-20261018-build\\bin\\llama-server.exe", + "extra": "", + "env": "GGML_VK_FORCE_MMVQ=1", + "load_s": 18.2, + "healthy": true, + "dedicated_gib": 20.08, + "shared_gib": 0.75, + "adapter_used_gib": 22.12, + "free_gib": 1.78, + "pp": [ + { + "prompt_n": 2076, + "prompt_tps": 366.4 + }, + { + "prompt_n": 8199, + "prompt_tps": 412.9 + } + ], + "tps": [ + 41.96, + 52.28, + 53.35 + ], + "ttft_s": [ + 1.097, + 0.355, + 0.318 + ], + "draft_accept": [ + 0.622, + 0.683, + 0.713 + ], + "rounds": [ + 461.0, + 423.0, + 413.0 + ], + "ms_per_round": [ + 119.0, + 104.1, + 104.5 + ], + "tps_mean": 49.2, + "greedy": { + "label": "K2-kq2", + "hashes": [ + "cb262bd4ed63eae7", + "ddce5fe8551d4957", + "22220fe1d4624289" + ], + "tps": [ + 53.87, + 24.4, + 74.47 + ] + }, + "oc": "freq_offset=0.0 volt_offset=0.0 power=100.0 temp_limit=100.0 vram=19.000 | clock=2400MHz temp=64.0C vram_clock=2375 vram_eff=19.0", + "shared_gib_after": 0.99 +} diff --git a/bench/ab-20261018/K2-kq2.sustained.jsonl b/bench/ab-20261018/K2-kq2.sustained.jsonl new file mode 100644 index 0000000..adf6c1a --- /dev/null +++ b/bench/ab-20261018/K2-kq2.sustained.jsonl @@ -0,0 +1,3 @@ +{"context": 32768, "finish_reason": "length", "label": "K2-kq2", "latency": {"first_content_s": 1.0966207000019494, "headers_s": 0.5059246000018902}, "long_enough": true, "native_counter_deltas": {"n_decode_total": 493.0, "prompt_tokens_total": 189.0, "spec_decode_num_accepted_tokens_total": 1812.0, "spec_decode_num_draft_tokens_total": 2915.0, "spec_decode_num_drafts_total": 461.0, "tokens_predicted_seconds_total": 54.879998, "tokens_predicted_total": 2304.0}, "output_executed": false, "quality_acceptance": "not evaluated; capped outputs are not completed code", "run": 1, "speed_floor_met": true, "streaming": true, "timings": {"cache_n": 0, "draft_n": 2915, "draft_n_accepted": 1812, "predicted_ms": 54880.037, "predicted_n": 2304, "predicted_per_second": 41.96425742205677, "predicted_per_token_ms": 23.82980330004342, "prompt_ms": 598.155, "prompt_n": 189, "prompt_per_second": 315.97161270908043, "prompt_per_token_ms": 3.16484126984127}, "usage": {"completion_tokens": 2304, "prompt_tokens": 189, "prompt_tokens_details": {"cached_tokens": 0}, "total_tokens": 2493}, "utc": "2026-10-18T01:34:19.801675+00:00", "wall_s": 55.994} +{"context": 32768, "finish_reason": "length", "label": "K2-kq2", "latency": {"first_content_s": 0.3546950999952969, "headers_s": 0.218173499997647}, "long_enough": true, "native_counter_deltas": {"n_decode_total": 438.0, "prompt_tokens_total": 4.0, "spec_decode_num_accepted_tokens_total": 1866.0, "spec_decode_num_draft_tokens_total": 2734.0, "spec_decode_num_drafts_total": 423.0, "tokens_predicted_seconds_total": 44.048899999999996, "tokens_predicted_total": 2304.0}, "output_executed": false, "quality_acceptance": "not evaluated; capped outputs are not completed code", "run": 2, "speed_floor_met": true, "streaming": true, "timings": {"cache_n": 185, "draft_n": 2734, "draft_n_accepted": 1866, "predicted_ms": 44048.817, "predicted_n": 2304, "predicted_per_second": 52.28290239894524, "predicted_per_token_ms": 19.12671168041685, "prompt_ms": 169.275, "prompt_n": 4, "prompt_per_second": 23.630187564613795, "prompt_per_token_ms": 42.31875}, "usage": {"completion_tokens": 2304, "prompt_tokens": 189, "prompt_tokens_details": {"cached_tokens": 185}, "total_tokens": 2493}, "utc": "2026-10-18T01:35:04.209105+00:00", "wall_s": 44.405} +{"context": 32768, "finish_reason": "length", "label": "K2-kq2", "latency": {"first_content_s": 0.31763019999925746, "headers_s": 0.1892398999989382}, "long_enough": true, "native_counter_deltas": {"n_decode_total": 428.0, "prompt_tokens_total": 4.0, "spec_decode_num_accepted_tokens_total": 1876.0, "spec_decode_num_draft_tokens_total": 2631.0, "spec_decode_num_drafts_total": 413.0, "tokens_predicted_seconds_total": 43.16409999999999, "tokens_predicted_total": 2304.0}, "output_executed": false, "quality_acceptance": "not evaluated; capped outputs are not completed code", "run": 3, "speed_floor_met": true, "streaming": true, "timings": {"cache_n": 185, "draft_n": 2631, "draft_n_accepted": 1876, "predicted_ms": 43164.274, "predicted_n": 2304, "predicted_per_second": 53.354308704462404, "predicted_per_token_ms": 18.742628745115066, "prompt_ms": 143.475, "prompt_n": 4, "prompt_per_second": 27.879421502003833, "prompt_per_token_ms": 35.86875}, "usage": {"completion_tokens": 2304, "prompt_tokens": 189, "prompt_tokens_details": {"cached_tokens": 185}, "total_tokens": 2493}, "utc": "2026-10-18T01:35:47.694339+00:00", "wall_s": 43.483} diff --git a/bench/ab-20261018/P1-ctx49k-t8.result.json b/bench/ab-20261018/P1-ctx49k-t8.result.json new file mode 100644 index 0000000..c1cd183 --- /dev/null +++ b/bench/ab-20261018/P1-ctx49k-t8.result.json @@ -0,0 +1,48 @@ +{ + "label": "P1-ctx49k-t8", + "kv": "f16", + "ctx": 49152, + "exe": "C:\\AI\\llama.cpp\\vulkan-intelfa-kq2-20261018\\llama-server.exe", + "extra": "", + "env": "GGML_VK_FORCE_MMVQ=1", + "load_s": 16.2, + "healthy": true, + "dedicated_gib": 20.15, + "shared_gib": 1.69, + "adapter_used_gib": 22.3, + "free_gib": 1.6, + "pp": [ + + ], + "tps": [ + 26.40 + ], + "ttft_s": [ + 0.760 + ], + "draft_accept": [ + 0.622 + ], + "rounds": [ + 461.0 + ], + "ms_per_round": [ + 189.3 + ], + "tps_mean": 26.4, + "greedy": { + "label": "P1-ctx49k-t8", + "hashes": [ + "cb262bd4ed63eae7", + "ddce5fe8551d4957", + "22220fe1d4624289" + ], + "tps": [ + 30.48, + 13.12, + 41.82 + ] + }, + "oc": "freq_offset=0.0 volt_offset=0.0 power=100.0 temp_limit=100.0 vram=19.000 | clock=2400MHz temp=62.0C vram_clock=2375 vram_eff=19.0", + "shared_gib_after": 1.92 +} diff --git a/bench/ab-20261018/P1-ctx49k-t8.sustained.jsonl b/bench/ab-20261018/P1-ctx49k-t8.sustained.jsonl new file mode 100644 index 0000000..03d0a46 --- /dev/null +++ b/bench/ab-20261018/P1-ctx49k-t8.sustained.jsonl @@ -0,0 +1 @@ +{"context": 49152, "finish_reason": "length", "label": "P1-ctx49k-t8", "latency": {"first_content_s": 0.7600506000017049, "headers_s": 0.20806550000270363}, "long_enough": true, "native_counter_deltas": {"n_decode_total": 493.0, "prompt_tokens_total": 189.0, "spec_decode_num_accepted_tokens_total": 1812.0, "spec_decode_num_draft_tokens_total": 2915.0, "spec_decode_num_drafts_total": 461.0, "tokens_predicted_seconds_total": 87.25094, "tokens_predicted_total": 2304.0}, "output_executed": false, "quality_acceptance": "not evaluated; capped outputs are not completed code", "run": 1, "speed_floor_met": false, "streaming": true, "timings": {"cache_n": 0, "draft_n": 2915, "draft_n_accepted": 1812, "predicted_ms": 87250.915, "predicted_n": 2304, "predicted_per_second": 26.39513866416186, "predicted_per_token_ms": 37.88576422058185, "prompt_ms": 572.888, "prompt_n": 189, "prompt_per_second": 329.90741645836533, "prompt_per_token_ms": 3.031153439153439}, "usage": {"completion_tokens": 2304, "prompt_tokens": 189, "prompt_tokens_details": {"cached_tokens": 0}, "total_tokens": 2493}, "utc": "2026-10-18T02:23:47.314387+00:00", "wall_s": 88.012} diff --git a/bench/ab-20261018/P2-ctx32k-t14.result.json b/bench/ab-20261018/P2-ctx32k-t14.result.json new file mode 100644 index 0000000..7e6a53c --- /dev/null +++ b/bench/ab-20261018/P2-ctx32k-t14.result.json @@ -0,0 +1,48 @@ +{ + "label": "P2-ctx32k-t14", + "kv": "f16", + "ctx": 32768, + "exe": "C:\\AI\\llama.cpp\\vulkan-intelfa-kq2-20261018\\llama-server.exe", + "extra": "-t 14 -tb 14", + "env": "GGML_VK_FORCE_MMVQ=1", + "load_s": 16.1, + "healthy": true, + "dedicated_gib": 20.08, + "shared_gib": 0.75, + "adapter_used_gib": 22.22, + "free_gib": 1.68, + "pp": [ + + ], + "tps": [ + 47.15 + ], + "ttft_s": [ + 0.737 + ], + "draft_accept": [ + 0.622 + ], + "rounds": [ + 461.0 + ], + "ms_per_round": [ + 105.9 + ], + "tps_mean": 47.15, + "greedy": { + "label": "P2-ctx32k-t14", + "hashes": [ + "cb262bd4ed63eae7", + "ddce5fe8551d4957", + "22220fe1d4624289" + ], + "tps": [ + 55.19, + 25.13, + 75.78 + ] + }, + "oc": "freq_offset=0.0 volt_offset=0.0 power=100.0 temp_limit=100.0 vram=19.000 | clock=1800MHz temp=64.0C vram_clock=2375 vram_eff=19.0", + "shared_gib_after": 0.98 +} diff --git a/bench/ab-20261018/P2-ctx32k-t14.sustained.jsonl b/bench/ab-20261018/P2-ctx32k-t14.sustained.jsonl new file mode 100644 index 0000000..eae309d --- /dev/null +++ b/bench/ab-20261018/P2-ctx32k-t14.sustained.jsonl @@ -0,0 +1 @@ +{"context": 32768, "finish_reason": "length", "label": "P2-ctx32k-t14", "latency": {"first_content_s": 0.7366442999991705, "headers_s": 0.19116359999316046}, "long_enough": true, "native_counter_deltas": {"n_decode_total": 493.0, "prompt_tokens_total": 189.0, "spec_decode_num_accepted_tokens_total": 1812.0, "spec_decode_num_draft_tokens_total": 2915.0, "spec_decode_num_drafts_total": 461.0, "tokens_predicted_seconds_total": 48.8412, "tokens_predicted_total": 2304.0}, "output_executed": false, "quality_acceptance": "not evaluated; capped outputs are not completed code", "run": 1, "speed_floor_met": true, "streaming": true, "timings": {"cache_n": 0, "draft_n": 2915, "draft_n_accepted": 1812, "predicted_ms": 48841.178, "predicted_n": 2304, "predicted_per_second": 47.1528348476771, "predicted_per_token_ms": 21.207632653061225, "prompt_ms": 566.336, "prompt_n": 189, "prompt_per_second": 333.72414962142614, "prompt_per_token_ms": 2.9964867724867728}, "usage": {"completion_tokens": 2304, "prompt_tokens": 189, "prompt_tokens_details": {"cached_tokens": 0}, "total_tokens": 2493}, "utc": "2026-10-18T02:25:47.985779+00:00", "wall_s": 49.579} diff --git a/bench/ab-20261018/P3-ctx40k-t8.result.json b/bench/ab-20261018/P3-ctx40k-t8.result.json new file mode 100644 index 0000000..b88aa15 --- /dev/null +++ b/bench/ab-20261018/P3-ctx40k-t8.result.json @@ -0,0 +1,48 @@ +{ + "label": "P3-ctx40k-t8", + "kv": "f16", + "ctx": 40960, + "exe": "C:\\AI\\llama.cpp\\vulkan-intelfa-kq2-20261018\\llama-server.exe", + "extra": "", + "env": "GGML_VK_FORCE_MMVQ=1", + "load_s": 18.1, + "healthy": true, + "dedicated_gib": 19.65, + "shared_gib": 1.69, + "adapter_used_gib": 21.79, + "free_gib": 2.11, + "pp": [ + + ], + "tps": [ + 26.43 + ], + "ttft_s": [ + 0.754 + ], + "draft_accept": [ + 0.622 + ], + "rounds": [ + 461.0 + ], + "ms_per_round": [ + 189.0 + ], + "tps_mean": 26.43, + "greedy": { + "label": "P3-ctx40k-t8", + "hashes": [ + "cb262bd4ed63eae7", + "ddce5fe8551d4957", + "22220fe1d4624289" + ], + "tps": [ + 30.32, + 13.18, + 42.07 + ] + }, + "oc": "freq_offset=0.0 volt_offset=0.0 power=100.0 temp_limit=100.0 vram=19.000 | clock=2400MHz temp=63.0C vram_clock=2375 vram_eff=19.0", + "shared_gib_after": 1.92 +} diff --git a/bench/ab-20261018/P3-ctx40k-t8.sustained.jsonl b/bench/ab-20261018/P3-ctx40k-t8.sustained.jsonl new file mode 100644 index 0000000..5f6c174 --- /dev/null +++ b/bench/ab-20261018/P3-ctx40k-t8.sustained.jsonl @@ -0,0 +1 @@ +{"context": 40960, "finish_reason": "length", "label": "P3-ctx40k-t8", "latency": {"first_content_s": 0.7536398000011104, "headers_s": 0.1860677000004216}, "long_enough": true, "native_counter_deltas": {"n_decode_total": 493.0, "prompt_tokens_total": 189.0, "spec_decode_num_accepted_tokens_total": 1812.0, "spec_decode_num_draft_tokens_total": 2915.0, "spec_decode_num_drafts_total": 461.0, "tokens_predicted_seconds_total": 87.14221, "tokens_predicted_total": 2304.0}, "output_executed": false, "quality_acceptance": "not evaluated; capped outputs are not completed code", "run": 1, "speed_floor_met": false, "streaming": true, "timings": {"cache_n": 0, "draft_n": 2915, "draft_n_accepted": 1812, "predicted_ms": 87142.198, "predicted_n": 2304, "predicted_per_second": 26.428068752638072, "predicted_per_token_ms": 37.83855753365176, "prompt_ms": 593.073, "prompt_n": 189, "prompt_per_second": 318.6791507959391, "prompt_per_token_ms": 3.137952380952381}, "usage": {"completion_tokens": 2304, "prompt_tokens": 189, "prompt_tokens_details": {"cached_tokens": 0}, "total_tokens": 2493}, "utc": "2026-10-18T02:28:15.147911+00:00", "wall_s": 87.897} diff --git a/bench/ab-20261018/S1-kq2-baked.result.json b/bench/ab-20261018/S1-kq2-baked.result.json new file mode 100644 index 0000000..6222b02 --- /dev/null +++ b/bench/ab-20261018/S1-kq2-baked.result.json @@ -0,0 +1,65 @@ +{ + "label": "S1-kq2-baked", + "kv": "f16", + "ctx": 32768, + "exe": "D:\\build\\vk-tune-20261018-build\\bin\\llama-server.exe", + "extra": "", + "env": "GGML_VK_FORCE_MMVQ=1", + "load_s": 16.2, + "healthy": true, + "dedicated_gib": 20.08, + "shared_gib": 0.75, + "adapter_used_gib": 22.25, + "free_gib": 1.65, + "pp": [ + { + "prompt_n": 2076, + "prompt_tps": 492.4 + }, + { + "prompt_n": 8199, + "prompt_tps": 524.4 + } + ], + "tps": [ + 47.34, + 52.35, + 53.87 + ], + "ttft_s": [ + 0.936, + 0.364, + 0.350 + ], + "draft_accept": [ + 0.622, + 0.683, + 0.713 + ], + "rounds": [ + 461.0, + 423.0, + 413.0 + ], + "ms_per_round": [ + 105.5, + 104.0, + 103.5 + ], + "tps_mean": 51.19, + "greedy": { + "label": "S1-kq2-baked", + "hashes": [ + "cb262bd4ed63eae7", + "ddce5fe8551d4957", + "22220fe1d4624289" + ], + "tps": [ + 55.09, + 24.65, + 74.6 + ] + }, + "oc": "freq_offset=0.0 volt_offset=0.0 power=100.0 temp_limit=100.0 vram=19.000 | clock=2400MHz temp=64.0C vram_clock=2375 vram_eff=19.0", + "shared_gib_after": 0.99 +} diff --git a/bench/ab-20261018/S1-kq2-baked.sustained.jsonl b/bench/ab-20261018/S1-kq2-baked.sustained.jsonl new file mode 100644 index 0000000..3dbf6b0 --- /dev/null +++ b/bench/ab-20261018/S1-kq2-baked.sustained.jsonl @@ -0,0 +1,3 @@ +{"context": 32768, "finish_reason": "length", "label": "S1-kq2-baked", "latency": {"first_content_s": 0.9357574000023305, "headers_s": 0.378991199999291}, "long_enough": true, "native_counter_deltas": {"n_decode_total": 493.0, "prompt_tokens_total": 189.0, "spec_decode_num_accepted_tokens_total": 1812.0, "spec_decode_num_draft_tokens_total": 2915.0, "spec_decode_num_drafts_total": 461.0, "tokens_predicted_seconds_total": 48.65224, "tokens_predicted_total": 2304.0}, "output_executed": false, "quality_acceptance": "not evaluated; capped outputs are not completed code", "run": 1, "speed_floor_met": true, "streaming": true, "timings": {"cache_n": 0, "draft_n": 2915, "draft_n_accepted": 1812, "predicted_ms": 48652.251, "predicted_n": 2304, "predicted_per_second": 47.33593929703274, "predicted_per_token_ms": 21.125597481545807, "prompt_ms": 581.655, "prompt_n": 189, "prompt_per_second": 324.93488408076956, "prompt_per_token_ms": 3.0775396825396824}, "usage": {"completion_tokens": 2304, "prompt_tokens": 189, "prompt_tokens_details": {"cached_tokens": 0}, "total_tokens": 2493}, "utc": "2026-10-18T02:00:34.466793+00:00", "wall_s": 49.617} +{"context": 32768, "finish_reason": "length", "label": "S1-kq2-baked", "latency": {"first_content_s": 0.3641344999996363, "headers_s": 0.224633999998332}, "long_enough": true, "native_counter_deltas": {"n_decode_total": 438.0, "prompt_tokens_total": 4.0, "spec_decode_num_accepted_tokens_total": 1866.0, "spec_decode_num_draft_tokens_total": 2734.0, "spec_decode_num_drafts_total": 423.0, "tokens_predicted_seconds_total": 43.9946, "tokens_predicted_total": 2304.0}, "output_executed": false, "quality_acceptance": "not evaluated; capped outputs are not completed code", "run": 2, "speed_floor_met": true, "streaming": true, "timings": {"cache_n": 185, "draft_n": 2734, "draft_n_accepted": 1866, "predicted_ms": 43994.637, "predicted_n": 2304, "predicted_per_second": 52.347289511673885, "predicted_per_token_ms": 19.103185844550588, "prompt_ms": 154.624, "prompt_n": 4, "prompt_per_second": 25.869205298013245, "prompt_per_token_ms": 38.656}, "usage": {"completion_tokens": 2304, "prompt_tokens": 189, "prompt_tokens_details": {"cached_tokens": 185}, "total_tokens": 2493}, "utc": "2026-10-18T02:01:18.828987+00:00", "wall_s": 44.36} +{"context": 32768, "finish_reason": "length", "label": "S1-kq2-baked", "latency": {"first_content_s": 0.34999779999634484, "headers_s": 0.21425369999633403}, "long_enough": true, "native_counter_deltas": {"n_decode_total": 428.0, "prompt_tokens_total": 4.0, "spec_decode_num_accepted_tokens_total": 1876.0, "spec_decode_num_draft_tokens_total": 2631.0, "spec_decode_num_drafts_total": 413.0, "tokens_predicted_seconds_total": 42.7542, "tokens_predicted_total": 2304.0}, "output_executed": false, "quality_acceptance": "not evaluated; capped outputs are not completed code", "run": 3, "speed_floor_met": true, "streaming": true, "timings": {"cache_n": 185, "draft_n": 2631, "draft_n_accepted": 1876, "predicted_ms": 42754.206, "predicted_n": 2304, "predicted_per_second": 53.86604536639039, "predicted_per_token_ms": 18.56457056013895, "prompt_ms": 150.795, "prompt_n": 4, "prompt_per_second": 26.52607845087702, "prompt_per_token_ms": 37.69875}, "usage": {"completion_tokens": 2304, "prompt_tokens": 189, "prompt_tokens_details": {"cached_tokens": 185}, "total_tokens": 2493}, "utc": "2026-10-18T02:02:01.936274+00:00", "wall_s": 43.105} diff --git a/bench/ab-20261018/S2-kq2-baked.result.json b/bench/ab-20261018/S2-kq2-baked.result.json new file mode 100644 index 0000000..f1c8b95 --- /dev/null +++ b/bench/ab-20261018/S2-kq2-baked.result.json @@ -0,0 +1,65 @@ +{ + "label": "S2-kq2-baked", + "kv": "f16", + "ctx": 32768, + "exe": "D:\\build\\vk-tune-20261018-build\\bin\\llama-server.exe", + "extra": "", + "env": "GGML_VK_FORCE_MMVQ=1", + "load_s": 16.2, + "healthy": true, + "dedicated_gib": 20.08, + "shared_gib": 0.75, + "adapter_used_gib": 22.23, + "free_gib": 1.67, + "pp": [ + { + "prompt_n": 2076, + "prompt_tps": 486.8 + }, + { + "prompt_n": 8199, + "prompt_tps": 520.0 + } + ], + "tps": [ + 47.35, + 52.50, + 53.82 + ], + "ttft_s": [ + 0.981, + 0.308, + 0.311 + ], + "draft_accept": [ + 0.622, + 0.683, + 0.713 + ], + "rounds": [ + 461.0, + 423.0, + 413.0 + ], + "ms_per_round": [ + 105.5, + 103.7, + 103.6 + ], + "tps_mean": 51.22, + "greedy": { + "label": "S2-kq2-baked", + "hashes": [ + "cb262bd4ed63eae7", + "ddce5fe8551d4957", + "22220fe1d4624289" + ], + "tps": [ + 54.34, + 25.14, + 75.88 + ] + }, + "oc": "freq_offset=0.0 volt_offset=0.0 power=100.0 temp_limit=100.0 vram=19.000 | clock=2400MHz temp=65.0C vram_clock=2375 vram_eff=19.0", + "shared_gib_after": 0.99 +} diff --git a/bench/ab-20261018/S2-kq2-baked.sustained.jsonl b/bench/ab-20261018/S2-kq2-baked.sustained.jsonl new file mode 100644 index 0000000..51555a1 --- /dev/null +++ b/bench/ab-20261018/S2-kq2-baked.sustained.jsonl @@ -0,0 +1,3 @@ +{"context": 32768, "finish_reason": "length", "label": "S2-kq2-baked", "latency": {"first_content_s": 0.9806173000033596, "headers_s": 0.4102299000005587}, "long_enough": true, "native_counter_deltas": {"n_decode_total": 493.0, "prompt_tokens_total": 189.0, "spec_decode_num_accepted_tokens_total": 1812.0, "spec_decode_num_draft_tokens_total": 2915.0, "spec_decode_num_drafts_total": 461.0, "tokens_predicted_seconds_total": 48.63362, "tokens_predicted_total": 2304.0}, "output_executed": false, "quality_acceptance": "not evaluated; capped outputs are not completed code", "run": 1, "speed_floor_met": true, "streaming": true, "timings": {"cache_n": 0, "draft_n": 2915, "draft_n_accepted": 1812, "predicted_ms": 48633.614, "predicted_n": 2304, "predicted_per_second": 47.354079012100556, "predicted_per_token_ms": 21.117504993486758, "prompt_ms": 587.016, "prompt_n": 189, "prompt_per_second": 321.96737397277076, "prompt_per_token_ms": 3.1059047619047617}, "usage": {"completion_tokens": 2304, "prompt_tokens": 189, "prompt_tokens_details": {"cached_tokens": 0}, "total_tokens": 2493}, "utc": "2026-10-18T02:04:11.021518+00:00", "wall_s": 49.936} +{"context": 32768, "finish_reason": "length", "label": "S2-kq2-baked", "latency": {"first_content_s": 0.30794759999844246, "headers_s": 0.18043939999915892}, "long_enough": true, "native_counter_deltas": {"n_decode_total": 438.0, "prompt_tokens_total": 4.0, "spec_decode_num_accepted_tokens_total": 1866.0, "spec_decode_num_draft_tokens_total": 2734.0, "spec_decode_num_drafts_total": 423.0, "tokens_predicted_seconds_total": 43.86280000000001, "tokens_predicted_total": 2304.0}, "output_executed": false, "quality_acceptance": "not evaluated; capped outputs are not completed code", "run": 2, "speed_floor_met": true, "streaming": true, "timings": {"cache_n": 185, "draft_n": 2734, "draft_n_accepted": 1866, "predicted_ms": 43862.842, "predicted_n": 2304, "predicted_per_second": 52.504577792747675, "predicted_per_token_ms": 19.045958315240988, "prompt_ms": 142.544, "prompt_n": 4, "prompt_per_second": 28.061510831743178, "prompt_per_token_ms": 35.636}, "usage": {"completion_tokens": 2304, "prompt_tokens": 189, "prompt_tokens_details": {"cached_tokens": 185}, "total_tokens": 2493}, "utc": "2026-10-18T02:04:55.195530+00:00", "wall_s": 44.172} +{"context": 32768, "finish_reason": "length", "label": "S2-kq2-baked", "latency": {"first_content_s": 0.3114348000017344, "headers_s": 0.18594029999803752}, "long_enough": true, "native_counter_deltas": {"n_decode_total": 428.0, "prompt_tokens_total": 4.0, "spec_decode_num_accepted_tokens_total": 1876.0, "spec_decode_num_draft_tokens_total": 2631.0, "spec_decode_num_drafts_total": 413.0, "tokens_predicted_seconds_total": 42.792100000000005, "tokens_predicted_total": 2304.0}, "output_executed": false, "quality_acceptance": "not evaluated; capped outputs are not completed code", "run": 3, "speed_floor_met": true, "streaming": true, "timings": {"cache_n": 185, "draft_n": 2631, "draft_n_accepted": 1876, "predicted_ms": 42792.04, "predicted_n": 2304, "predicted_per_second": 53.818420435202434, "predicted_per_token_ms": 18.58099869735128, "prompt_ms": 140.712, "prompt_n": 4, "prompt_per_second": 28.42685769515038, "prompt_per_token_ms": 35.178}, "usage": {"completion_tokens": 2304, "prompt_tokens": 189, "prompt_tokens_details": {"cached_tokens": 185}, "total_tokens": 2493}, "utc": "2026-10-18T02:05:38.302092+00:00", "wall_s": 43.104} diff --git a/bench/ab-20261018/S3-kq2-baked.result.json b/bench/ab-20261018/S3-kq2-baked.result.json new file mode 100644 index 0000000..8e525be --- /dev/null +++ b/bench/ab-20261018/S3-kq2-baked.result.json @@ -0,0 +1,65 @@ +{ + "label": "S3-kq2-baked", + "kv": "f16", + "ctx": 32768, + "exe": "D:\\build\\vk-tune-20261018-build\\bin\\llama-server.exe", + "extra": "", + "env": "GGML_VK_FORCE_MMVQ=1", + "load_s": 16.2, + "healthy": true, + "dedicated_gib": 20.08, + "shared_gib": 0.75, + "adapter_used_gib": 22.23, + "free_gib": 1.67, + "pp": [ + { + "prompt_n": 2076, + "prompt_tps": 491.7 + }, + { + "prompt_n": 8199, + "prompt_tps": 523.7 + } + ], + "tps": [ + 47.17, + 52.27, + 53.83 + ], + "ttft_s": [ + 0.942, + 0.381, + 0.357 + ], + "draft_accept": [ + 0.622, + 0.683, + 0.713 + ], + "rounds": [ + 461.0, + 423.0, + 413.0 + ], + "ms_per_round": [ + 105.9, + 104.2, + 103.6 + ], + "tps_mean": 51.09, + "greedy": { + "label": "S3-kq2-baked", + "hashes": [ + "cb262bd4ed63eae7", + "ddce5fe8551d4957", + "22220fe1d4624289" + ], + "tps": [ + 53.96, + 24.4, + 75.62 + ] + }, + "oc": "freq_offset=0.0 volt_offset=0.0 power=100.0 temp_limit=100.0 vram=19.000 | clock=2400MHz temp=65.0C vram_clock=2375 vram_eff=19.0", + "shared_gib_after": 0.99 +} diff --git a/bench/ab-20261018/S3-kq2-baked.sustained.jsonl b/bench/ab-20261018/S3-kq2-baked.sustained.jsonl new file mode 100644 index 0000000..b5b4cc6 --- /dev/null +++ b/bench/ab-20261018/S3-kq2-baked.sustained.jsonl @@ -0,0 +1,3 @@ +{"context": 32768, "finish_reason": "length", "label": "S3-kq2-baked", "latency": {"first_content_s": 0.9423896000007517, "headers_s": 0.3858946000036667}, "long_enough": true, "native_counter_deltas": {"n_decode_total": 493.0, "prompt_tokens_total": 189.0, "spec_decode_num_accepted_tokens_total": 1812.0, "spec_decode_num_draft_tokens_total": 2915.0, "spec_decode_num_drafts_total": 461.0, "tokens_predicted_seconds_total": 48.82074, "tokens_predicted_total": 2304.0}, "output_executed": false, "quality_acceptance": "not evaluated; capped outputs are not completed code", "run": 1, "speed_floor_met": true, "streaming": true, "timings": {"cache_n": 0, "draft_n": 2915, "draft_n_accepted": 1812, "predicted_ms": 48820.712, "predicted_n": 2304, "predicted_per_second": 47.17260166136045, "predicted_per_token_ms": 21.198745983499784, "prompt_ms": 577.392, "prompt_n": 189, "prompt_per_second": 327.333942971153, "prompt_per_token_ms": 3.0549841269841274}, "usage": {"completion_tokens": 2304, "prompt_tokens": 189, "prompt_tokens_details": {"cached_tokens": 0}, "total_tokens": 2493}, "utc": "2026-10-18T02:07:47.492251+00:00", "wall_s": 49.783} +{"context": 32768, "finish_reason": "length", "label": "S3-kq2-baked", "latency": {"first_content_s": 0.38113370000064606, "headers_s": 0.22653359999821987}, "long_enough": true, "native_counter_deltas": {"n_decode_total": 438.0, "prompt_tokens_total": 4.0, "spec_decode_num_accepted_tokens_total": 1866.0, "spec_decode_num_draft_tokens_total": 2734.0, "spec_decode_num_drafts_total": 423.0, "tokens_predicted_seconds_total": 44.0612, "tokens_predicted_total": 2304.0}, "output_executed": false, "quality_acceptance": "not evaluated; capped outputs are not completed code", "run": 2, "speed_floor_met": true, "streaming": true, "timings": {"cache_n": 185, "draft_n": 2734, "draft_n_accepted": 1866, "predicted_ms": 44061.236, "predicted_n": 2304, "predicted_per_second": 52.268166058709745, "predicted_per_token_ms": 19.132104211897524, "prompt_ms": 172.689, "prompt_n": 4, "prompt_per_second": 23.163027176021636, "prompt_per_token_ms": 43.17225}, "usage": {"completion_tokens": 2304, "prompt_tokens": 189, "prompt_tokens_details": {"cached_tokens": 185}, "total_tokens": 2493}, "utc": "2026-10-18T02:08:31.938063+00:00", "wall_s": 44.443} +{"context": 32768, "finish_reason": "length", "label": "S3-kq2-baked", "latency": {"first_content_s": 0.3574349000045913, "headers_s": 0.2198980000030133}, "long_enough": true, "native_counter_deltas": {"n_decode_total": 428.0, "prompt_tokens_total": 4.0, "spec_decode_num_accepted_tokens_total": 1876.0, "spec_decode_num_draft_tokens_total": 2631.0, "spec_decode_num_drafts_total": 413.0, "tokens_predicted_seconds_total": 42.78670000000001, "tokens_predicted_total": 2304.0}, "output_executed": false, "quality_acceptance": "not evaluated; capped outputs are not completed code", "run": 3, "speed_floor_met": true, "streaming": true, "timings": {"cache_n": 185, "draft_n": 2631, "draft_n_accepted": 1876, "predicted_ms": 42786.791, "predicted_n": 2304, "predicted_per_second": 53.82502277396779, "predicted_per_token_ms": 18.578719496309162, "prompt_ms": 152.479, "prompt_n": 4, "prompt_per_second": 26.23312062644692, "prompt_per_token_ms": 38.11975}, "usage": {"completion_tokens": 2304, "prompt_tokens": 189, "prompt_tokens_details": {"cached_tokens": 185}, "total_tokens": 2493}, "utc": "2026-10-18T02:09:15.085819+00:00", "wall_s": 43.145} diff --git a/bench/ab-20261018/W0-production.result.json b/bench/ab-20261018/W0-production.result.json new file mode 100644 index 0000000..1da08fe --- /dev/null +++ b/bench/ab-20261018/W0-production.result.json @@ -0,0 +1,65 @@ +{ + "label": "W0-production", + "kv": "f16", + "ctx": 32768, + "exe": "C:\\AI\\llama.cpp\\vulkan-intelfa\\llama-server.exe", + "extra": "", + "env": "GGML_VK_FORCE_MMVQ=1", + "load_s": 18.2, + "healthy": true, + "dedicated_gib": 20.08, + "shared_gib": 0.75, + "adapter_used_gib": 22.12, + "free_gib": 1.78, + "pp": [ + { + "prompt_n": 2076, + "prompt_tps": 490.1 + }, + { + "prompt_n": 8199, + "prompt_tps": 520.3 + } + ], + "tps": [ + 39.11, + 43.19, + 44.06 + ], + "ttft_s": [ + 0.977, + 0.353, + 0.551 + ], + "draft_accept": [ + 0.622, + 0.683, + 0.713 + ], + "rounds": [ + 461.0, + 423.0, + 413.0 + ], + "ms_per_round": [ + 127.7, + 126.1, + 126.6 + ], + "tps_mean": 42.12, + "greedy": { + "label": "W0-production", + "hashes": [ + "cb262bd4ed63eae7", + "ddce5fe8551d4957", + "22220fe1d4624289" + ], + "tps": [ + 42.91, + 16.98, + 54.6 + ] + }, + "oc": "freq_offset=0.0 volt_offset=0.0 power=100.0 temp_limit=100.0 vram=19.000 | clock=2400MHz temp=64.0C vram_clock=2375 vram_eff=19.0", + "shared_gib_after": 0.99 +} diff --git a/bench/ab-20261018/W0-production.sustained.jsonl b/bench/ab-20261018/W0-production.sustained.jsonl new file mode 100644 index 0000000..4e84a18 --- /dev/null +++ b/bench/ab-20261018/W0-production.sustained.jsonl @@ -0,0 +1,3 @@ +{"context": 32768, "finish_reason": "length", "label": "W0-production", "latency": {"first_content_s": 0.9773362999985693, "headers_s": 0.39182959999743616}, "long_enough": true, "native_counter_deltas": {"n_decode_total": 493.0, "prompt_tokens_total": 189.0, "spec_decode_num_accepted_tokens_total": 1812.0, "spec_decode_num_draft_tokens_total": 2915.0, "spec_decode_num_drafts_total": 461.0, "tokens_predicted_seconds_total": 58.88416, "tokens_predicted_total": 2304.0}, "output_executed": false, "quality_acceptance": "not evaluated; capped outputs are not completed code", "run": 1, "speed_floor_met": false, "streaming": true, "timings": {"cache_n": 0, "draft_n": 2915, "draft_n_accepted": 1812, "predicted_ms": 58884.186, "predicted_n": 2304, "predicted_per_second": 39.110670562721204, "predicted_per_token_ms": 25.56846982197134, "prompt_ms": 600.871, "prompt_n": 189, "prompt_per_second": 314.5433878486397, "prompt_per_token_ms": 3.17921164021164}, "usage": {"completion_tokens": 2304, "prompt_tokens": 189, "prompt_tokens_details": {"cached_tokens": 0}, "total_tokens": 2493}, "utc": "2026-10-18T01:38:23.366875+00:00", "wall_s": 59.863} +{"context": 32768, "finish_reason": "length", "label": "W0-production", "latency": {"first_content_s": 0.3534375999952317, "headers_s": 0.20555079999758163}, "long_enough": true, "native_counter_deltas": {"n_decode_total": 438.0, "prompt_tokens_total": 4.0, "spec_decode_num_accepted_tokens_total": 1866.0, "spec_decode_num_draft_tokens_total": 2734.0, "spec_decode_num_drafts_total": 423.0, "tokens_predicted_seconds_total": 53.3274, "tokens_predicted_total": 2304.0}, "output_executed": false, "quality_acceptance": "not evaluated; capped outputs are not completed code", "run": 2, "speed_floor_met": true, "streaming": true, "timings": {"cache_n": 185, "draft_n": 2734, "draft_n_accepted": 1866, "predicted_ms": 53326.994, "predicted_n": 2304, "predicted_per_second": 43.18638324147804, "predicted_per_token_ms": 23.15544680851064, "prompt_ms": 162.843, "prompt_n": 4, "prompt_per_second": 24.563536658008022, "prompt_per_token_ms": 40.71075}, "usage": {"completion_tokens": 2304, "prompt_tokens": 189, "prompt_tokens_details": {"cached_tokens": 185}, "total_tokens": 2493}, "utc": "2026-10-18T01:39:17.052999+00:00", "wall_s": 53.682} +{"context": 32768, "finish_reason": "length", "label": "W0-production", "latency": {"first_content_s": 0.551316199998837, "headers_s": 0.345927299997129}, "long_enough": true, "native_counter_deltas": {"n_decode_total": 428.0, "prompt_tokens_total": 4.0, "spec_decode_num_accepted_tokens_total": 1876.0, "spec_decode_num_draft_tokens_total": 2631.0, "spec_decode_num_drafts_total": 413.0, "tokens_predicted_seconds_total": 52.266000000000005, "tokens_predicted_total": 2304.0}, "output_executed": false, "quality_acceptance": "not evaluated; capped outputs are not completed code", "run": 3, "speed_floor_met": true, "streaming": true, "timings": {"cache_n": 185, "draft_n": 2631, "draft_n_accepted": 1876, "predicted_ms": 52266.349, "predicted_n": 2304, "predicted_per_second": 44.06276780495993, "predicted_per_token_ms": 22.694897524967434, "prompt_ms": 226.705, "prompt_n": 4, "prompt_per_second": 17.644074899097944, "prompt_per_token_ms": 56.67625}, "usage": {"completion_tokens": 2304, "prompt_tokens": 189, "prompt_tokens_details": {"cached_tokens": 185}, "total_tokens": 2493}, "utc": "2026-10-18T01:40:09.871968+00:00", "wall_s": 52.816} diff --git a/bench/ab-20261018/W1-kq2-wg3.result.json b/bench/ab-20261018/W1-kq2-wg3.result.json new file mode 100644 index 0000000..eaedf7a --- /dev/null +++ b/bench/ab-20261018/W1-kq2-wg3.result.json @@ -0,0 +1,65 @@ +{ + "label": "W1-kq2-wg3", + "kv": "f16", + "ctx": 32768, + "exe": "D:\\build\\vk-tune-20261018-build\\bin\\llama-server.exe", + "extra": "", + "env": "GGML_VK_FORCE_MMVQ=1", + "load_s": 18.2, + "healthy": true, + "dedicated_gib": 20.08, + "shared_gib": 0.75, + "adapter_used_gib": 22.12, + "free_gib": 1.78, + "pp": [ + { + "prompt_n": 2076, + "prompt_tps": 487.2 + }, + { + "prompt_n": 8199, + "prompt_tps": 519.6 + } + ], + "tps": [ + 47.59, + 43.86, + 45.51 + ], + "ttft_s": [ + 1.010, + 0.316, + 0.355 + ], + "draft_accept": [ + 0.629, + 0.581, + 0.597 + ], + "rounds": [ + 461.0, + 500.0, + 484.0 + ], + "ms_per_round": [ + 105.0, + 105.0, + 104.5 + ], + "tps_mean": 45.65, + "greedy": { + "label": "W1-kq2-wg3", + "hashes": [ + "cb262bd4ed63eae7", + "da57d6f7cbde26a2", + "22220fe1d4624289" + ], + "tps": [ + 53.29, + 24.54, + 74.24 + ] + }, + "oc": "freq_offset=0.0 volt_offset=0.0 power=100.0 temp_limit=100.0 vram=19.000 | clock=2400MHz temp=64.0C vram_clock=2375 vram_eff=19.0", + "shared_gib_after": 0.99 +} diff --git a/bench/ab-20261018/W1-kq2-wg3.sustained.jsonl b/bench/ab-20261018/W1-kq2-wg3.sustained.jsonl new file mode 100644 index 0000000..0a71142 --- /dev/null +++ b/bench/ab-20261018/W1-kq2-wg3.sustained.jsonl @@ -0,0 +1,3 @@ +{"context": 32768, "finish_reason": "length", "label": "W1-kq2-wg3", "latency": {"first_content_s": 1.0097389000002295, "headers_s": 0.4148951999959536}, "long_enough": true, "native_counter_deltas": {"n_decode_total": 477.0, "prompt_tokens_total": 189.0, "spec_decode_num_accepted_tokens_total": 1828.0, "spec_decode_num_draft_tokens_total": 2904.0, "spec_decode_num_drafts_total": 461.0, "tokens_predicted_seconds_total": 48.39502, "tokens_predicted_total": 2304.0}, "output_executed": false, "quality_acceptance": "not evaluated; capped outputs are not completed code", "run": 1, "speed_floor_met": true, "streaming": true, "timings": {"cache_n": 0, "draft_n": 2904, "draft_n_accepted": 1828, "predicted_ms": 48395.04, "predicted_n": 2304, "predicted_per_second": 47.58752136582592, "predicted_per_token_ms": 21.013912288319585, "prompt_ms": 591.266, "prompt_n": 189, "prompt_per_second": 319.65308338379003, "prompt_per_token_ms": 3.1283915343915343}, "usage": {"completion_tokens": 2304, "prompt_tokens": 189, "prompt_tokens_details": {"cached_tokens": 0}, "total_tokens": 2493}, "utc": "2026-10-18T01:42:29.383944+00:00", "wall_s": 49.403} +{"context": 32768, "finish_reason": "length", "label": "W1-kq2-wg3", "latency": {"first_content_s": 0.31583340000361204, "headers_s": 0.17645980000088457}, "long_enough": true, "native_counter_deltas": {"n_decode_total": 522.0, "prompt_tokens_total": 4.0, "spec_decode_num_accepted_tokens_total": 1782.0, "spec_decode_num_draft_tokens_total": 3065.0, "spec_decode_num_drafts_total": 500.0, "tokens_predicted_seconds_total": 52.506499999999996, "tokens_predicted_total": 2304.0}, "output_executed": false, "quality_acceptance": "not evaluated; capped outputs are not completed code", "run": 2, "speed_floor_met": true, "streaming": true, "timings": {"cache_n": 185, "draft_n": 3065, "draft_n_accepted": 1782, "predicted_ms": 52506.923, "predicted_n": 2304, "predicted_per_second": 43.86088287824445, "predicted_per_token_ms": 22.799358662613983, "prompt_ms": 154.462, "prompt_n": 4, "prompt_per_second": 25.896336963136566, "prompt_per_token_ms": 38.6155}, "usage": {"completion_tokens": 2304, "prompt_tokens": 189, "prompt_tokens_details": {"cached_tokens": 185}, "total_tokens": 2493}, "utc": "2026-10-18T01:43:22.210688+00:00", "wall_s": 52.824} +{"context": 32768, "finish_reason": "length", "label": "W1-kq2-wg3", "latency": {"first_content_s": 0.3548345999952289, "headers_s": 0.21223189999727765}, "long_enough": true, "native_counter_deltas": {"n_decode_total": 502.0, "prompt_tokens_total": 4.0, "spec_decode_num_accepted_tokens_total": 1802.0, "spec_decode_num_draft_tokens_total": 3018.0, "spec_decode_num_drafts_total": 484.0, "tokens_predicted_seconds_total": 50.601, "tokens_predicted_total": 2304.0}, "output_executed": false, "quality_acceptance": "not evaluated; capped outputs are not completed code", "run": 3, "speed_floor_met": true, "streaming": true, "timings": {"cache_n": 185, "draft_n": 3018, "draft_n_accepted": 1802, "predicted_ms": 50600.951, "predicted_n": 2304, "predicted_per_second": 45.51297859994766, "predicted_per_token_ms": 21.971754667824577, "prompt_ms": 158.074, "prompt_n": 4, "prompt_per_second": 25.304604172729228, "prompt_per_token_ms": 39.5185}, "usage": {"completion_tokens": 2304, "prompt_tokens": 189, "prompt_tokens_details": {"cached_tokens": 185}, "total_tokens": 2493}, "utc": "2026-10-18T01:44:13.169436+00:00", "wall_s": 50.956} diff --git a/bench/ab-20261018/W2-kq2.result.json b/bench/ab-20261018/W2-kq2.result.json new file mode 100644 index 0000000..b77e35c --- /dev/null +++ b/bench/ab-20261018/W2-kq2.result.json @@ -0,0 +1,65 @@ +{ + "label": "W2-kq2", + "kv": "f16", + "ctx": 32768, + "exe": "D:\\build\\vk-tune-20261018-build\\bin\\llama-server.exe", + "extra": "", + "env": "GGML_VK_FORCE_MMVQ=1", + "load_s": 16.2, + "healthy": true, + "dedicated_gib": 20.08, + "shared_gib": 0.75, + "adapter_used_gib": 22.12, + "free_gib": 1.78, + "pp": [ + { + "prompt_n": 2076, + "prompt_tps": 499.5 + }, + { + "prompt_n": 8199, + "prompt_tps": 520.1 + } + ], + "tps": [ + 47.16, + 52.57, + 53.92 + ], + "ttft_s": [ + 1.010, + 0.391, + 0.332 + ], + "draft_accept": [ + 0.622, + 0.683, + 0.713 + ], + "rounds": [ + 461.0, + 423.0, + 413.0 + ], + "ms_per_round": [ + 105.9, + 103.6, + 103.4 + ], + "tps_mean": 51.22, + "greedy": { + "label": "W2-kq2", + "hashes": [ + "cb262bd4ed63eae7", + "ddce5fe8551d4957", + "22220fe1d4624289" + ], + "tps": [ + 55.16, + 24.98, + 75.78 + ] + }, + "oc": "freq_offset=0.0 volt_offset=0.0 power=100.0 temp_limit=100.0 vram=19.000 | clock=2400MHz temp=63.0C vram_clock=2375 vram_eff=19.0", + "shared_gib_after": 0.99 +} diff --git a/bench/ab-20261018/W2-kq2.sustained.jsonl b/bench/ab-20261018/W2-kq2.sustained.jsonl new file mode 100644 index 0000000..5cb0d22 --- /dev/null +++ b/bench/ab-20261018/W2-kq2.sustained.jsonl @@ -0,0 +1,3 @@ +{"context": 32768, "finish_reason": "length", "label": "W2-kq2", "latency": {"first_content_s": 1.0096504999964964, "headers_s": 0.41911480000271695}, "long_enough": true, "native_counter_deltas": {"n_decode_total": 493.0, "prompt_tokens_total": 189.0, "spec_decode_num_accepted_tokens_total": 1812.0, "spec_decode_num_draft_tokens_total": 2915.0, "spec_decode_num_drafts_total": 461.0, "tokens_predicted_seconds_total": 48.83529, "tokens_predicted_total": 2304.0}, "output_executed": false, "quality_acceptance": "not evaluated; capped outputs are not completed code", "run": 1, "speed_floor_met": true, "streaming": true, "timings": {"cache_n": 0, "draft_n": 2915, "draft_n_accepted": 1812, "predicted_ms": 48835.326, "predicted_n": 2304, "predicted_per_second": 47.15848523259576, "predicted_per_token_ms": 21.205091619626575, "prompt_ms": 595.415, "prompt_n": 189, "prompt_per_second": 317.425661093523, "prompt_per_token_ms": 3.1503439153439152}, "usage": {"completion_tokens": 2304, "prompt_tokens": 189, "prompt_tokens_details": {"cached_tokens": 0}, "total_tokens": 2493}, "utc": "2026-10-18T01:46:21.506575+00:00", "wall_s": 49.903} +{"context": 32768, "finish_reason": "length", "label": "W2-kq2", "latency": {"first_content_s": 0.3906575000000885, "headers_s": 0.24982380000437843}, "long_enough": true, "native_counter_deltas": {"n_decode_total": 438.0, "prompt_tokens_total": 4.0, "spec_decode_num_accepted_tokens_total": 1866.0, "spec_decode_num_draft_tokens_total": 2734.0, "spec_decode_num_drafts_total": 423.0, "tokens_predicted_seconds_total": 43.8118, "tokens_predicted_total": 2304.0}, "output_executed": false, "quality_acceptance": "not evaluated; capped outputs are not completed code", "run": 2, "speed_floor_met": true, "streaming": true, "timings": {"cache_n": 185, "draft_n": 2734, "draft_n_accepted": 1866, "predicted_ms": 43811.776, "predicted_n": 2304, "predicted_per_second": 52.56577592289342, "predicted_per_token_ms": 19.023784628745116, "prompt_ms": 156.35, "prompt_n": 4, "prompt_per_second": 25.583626479053407, "prompt_per_token_ms": 39.0875}, "usage": {"completion_tokens": 2304, "prompt_tokens": 189, "prompt_tokens_details": {"cached_tokens": 185}, "total_tokens": 2493}, "utc": "2026-10-18T01:47:05.712802+00:00", "wall_s": 44.204} +{"context": 32768, "finish_reason": "length", "label": "W2-kq2", "latency": {"first_content_s": 0.33197759999893606, "headers_s": 0.2044480000040494}, "long_enough": true, "native_counter_deltas": {"n_decode_total": 428.0, "prompt_tokens_total": 4.0, "spec_decode_num_accepted_tokens_total": 1876.0, "spec_decode_num_draft_tokens_total": 2631.0, "spec_decode_num_drafts_total": 413.0, "tokens_predicted_seconds_total": 42.71199999999999, "tokens_predicted_total": 2304.0}, "output_executed": false, "quality_acceptance": "not evaluated; capped outputs are not completed code", "run": 3, "speed_floor_met": true, "streaming": true, "timings": {"cache_n": 185, "draft_n": 2631, "draft_n_accepted": 1876, "predicted_ms": 42711.798, "predicted_n": 2304, "predicted_per_second": 53.91952827647293, "predicted_per_token_ms": 18.54615631784629, "prompt_ms": 142.724, "prompt_n": 4, "prompt_per_second": 28.02612034416076, "prompt_per_token_ms": 35.681}, "usage": {"completion_tokens": 2304, "prompt_tokens": 189, "prompt_tokens_details": {"cached_tokens": 185}, "total_tokens": 2493}, "utc": "2026-10-18T01:47:48.759523+00:00", "wall_s": 43.045} diff --git a/bench/ab-20261018/bench-session.ps1 b/bench/ab-20261018/bench-session.ps1 new file mode 100644 index 0000000..a5ebf9c --- /dev/null +++ b/bench/ab-20261018/bench-session.ps1 @@ -0,0 +1,23 @@ +# start|stop a benchmark session: hold the engine lock with a sleeper process and switch the governor OFF / back to AUTO. +param([ValidateSet('start', 'stop')][string]$Action) +$flag = 'C:\AI\locks\bench.flag' +$lock = 'C:\AI\locks\qwen-lock.ps1' +if ($Action -eq 'start') { + Set-Content $flag (Get-Date -Format s) + $holder = Start-Process powershell -ArgumentList '-NoProfile', '-Command', "while (Test-Path '$flag') { Start-Sleep 5 }" -WindowStyle Hidden -PassThru + & powershell -NoProfile -ExecutionPolicy Bypass -File $lock acquire -Kind bench -HolderPid $holder.Id -WaitS 900 -Note 'Phase 4 A/B benchmarks (Claude)' + if ($LASTEXITCODE -ne 0) { Remove-Item $flag; throw 'could not take the engine lock' } + & C:\AI\governor\qwen.ps1 mode off + $t0 = Get-Date + while (((Get-Date) - $t0).TotalSeconds -lt 120) { Start-Sleep 5; if (-not (Get-Process llama-server -ErrorAction SilentlyContinue | ? { $_.Path -like 'C:\AI\llama.cpp\*' })) { break } } + if (Get-Process llama-server -ErrorAction SilentlyContinue | ? { $_.Path -like 'C:\AI\llama.cpp\*' }) { & C:\AI\governor\qwen.ps1 unload; Start-Sleep 10 } + "llama-server running: $([bool](Get-Process llama-server -ErrorAction SilentlyContinue))" + "lock: $(& powershell -NoProfile -File $lock status)" + $a = (Get-Counter '\GPU Adapter Memory(*)\Dedicated Usage').CounterSamples | measure CookedValue -Maximum + "adapter dedicated used now: $([math]::Round($a.Maximum/1GB,2)) GiB (others only)" +} else { + Remove-Item $flag -ErrorAction SilentlyContinue + Start-Sleep 7 + & C:\AI\governor\qwen.ps1 mode auto + "lock: $(& powershell -NoProfile -File $lock status)" +} diff --git a/bench/ab-20261018/ctx-probe.log b/bench/ab-20261018/ctx-probe.log new file mode 100644 index 0000000..a71970c --- /dev/null +++ b/bench/ab-20261018/ctx-probe.log @@ -0,0 +1,7 @@ +llama-server running: False +lock: busy: bench pid 24988 since 2026-10-18T13:21:25 (Phase 4 A/B benchmarks (Claude)) +adapter dedicated used now: 2.14 GiB (others only) +13:24:30 P1-ctx49k-t8: tps=26.40 ms/round=189.3 ded=20.15 shared=1.69/1.92 adapter=22.3 greedy=cb262bd4ed63eae7,ddce5fe8551d4957,22220fe1d4624289 +13:26:14 P2-ctx32k-t14: tps=47.15 ms/round=105.9 ded=20.08 shared=0.75/0.98 adapter=22.22 greedy=cb262bd4ed63eae7,ddce5fe8551d4957,22220fe1d4624289 +13:28:58 P3-ctx40k-t8: tps=26.43 ms/round=189.0 ded=19.65 shared=1.69/1.92 adapter=21.79 greedy=cb262bd4ed63eae7,ddce5fe8551d4957,22220fe1d4624289 +probe done diff --git a/bench/ab-20261018/ctx-probe.ps1 b/bench/ab-20261018/ctx-probe.ps1 new file mode 100644 index 0000000..5e4e9d0 --- /dev/null +++ b/bench/ab-20261018/ctx-probe.ps1 @@ -0,0 +1,15 @@ +# Production-slowness probe (18 Oct 2026): governor MAX loads ctx 49152 / -t 14 and runs ~30 tok/s vs 51 in the bench. +# Separates the two differences: context size (VRAM spill to shared memory) vs thread count. +$ErrorActionPreference = 'Continue' +$d = 'C:\AI\bench\ab-20261018' +$exe = 'C:\AI\llama.cpp\vulkan-intelfa-kq2-20261018\llama-server.exe' +$log = "$d\ctx-probe.log" +& "$d\bench-session.ps1" start | Add-Content $log +function Row($label) { + $j = Get-Content "$d\$label.result.json" -Raw | ConvertFrom-Json + "{0} {1}: tps={2} ms/round={8} ded={3} shared={4}/{5} adapter={6} greedy={7}" -f (Get-Date -Format HH:mm:ss), $label, (($j.tps) -join '/'), $j.dedicated_gib, $j.shared_gib, $j.shared_gib_after, $j.adapter_used_gib, (($j.greedy.hashes) -join ','), (($j.ms_per_round) -join '/') | Add-Content $log +} +& "$d\run-ab.ps1" -Label P1-ctx49k-t8 -Ctx 49152 -Exe $exe -Runs 1 -SkipPP -Greedy | Out-Null; Row P1-ctx49k-t8 +& "$d\run-ab.ps1" -Label P2-ctx32k-t14 -Ctx 32768 -Exe $exe -Runs 1 -SkipPP -Greedy -Extra @('-t', '14', '-tb', '14') | Out-Null; Row P2-ctx32k-t14 +& "$d\run-ab.ps1" -Label P3-ctx40k-t8 -Ctx 40960 -Exe $exe -Runs 1 -SkipPP -Greedy | Out-Null; Row P3-ctx40k-t8 +'probe done' | Add-Content $log diff --git a/bench/ab-20261018/greedy_check.py b/bench/ab-20261018/greedy_check.py new file mode 100644 index 0000000..9a9b174 --- /dev/null +++ b/bench/ab-20261018/greedy_check.py @@ -0,0 +1,20 @@ +"""Greedy fingerprint: fixed prompts at temperature 0 (DFlash is lossless under greedy verify), prints a sha256 of each +reply. Any difference from the stock fingerprint means the hardware/engine changed the maths. Usage: greedy_check.py