Skip to content

hyperloom custom: every measurement runs HRX with SVM off (engine #715) - #718

Merged
bong-water-water-bong merged 6 commits into
mainfrom
1bit/hyperloom-nosvm
Nov 1, 2026
Merged

bong-water-water-bong merged 6 commits into
mainfrom
1bit/hyperloom-nosvm

Conversation

@bong-water-water-bong

@bong-water-water-bong bong-water-water-bong commented Nov 1, 2026 •

Copy link
Copy Markdown
Collaborator

Why

Two things the Hyperloom custom-workload entrypoint got wrong on a rebuilt box, both of which invalidate a measurement rather than merely annoy:

  1. SVM. The box now runs the nightly libhsa, which page-faults on an HRX allocation unless SVM is off (engine hrx: gfxhub permission page faults (UTCL2 client CPF) on the rebuilt box with the TheRock nightly libhsa — the no-SVM env trio is the only fault-free arm #715). Every HRX launch here carries HSA_USE_SVM=0 HSA_USERPTR_FOR_PAGED_MEM=0 HRX_ALLOW_NO_SVM=1. benchmark.py starts the HRX legs itself, so those have to be set before the exec — otherwise the container rule is not what the measurement ran under and its numbers are not attributable.
  2. The GPU FIFO. Hyperloom runs the entrypoint under a fresh HOME (its preflight writes into ~/.claude/config.json), and gpu-hold defaults GPU_TOKEN_FILE/GPU_QUEUE_DIR to $HOME. Under that sandbox the claim was taken on a private token in a private queue — inside no queue at all, which is the one thing the claim exists to guarantee. This was live: the 2026-10-31 23:02 attempt held ~/hyperloom-ws/hl-home-26030/GPU-TOKEN while another lane held the box token.

What

  • tools/hyperloom/custom/custom_strixhalo.sh
    • defaults the three SVM variables right after the IREE_HAL_AMDGPU_LIBHSA_PATH block (an explicit setting still wins, so the lever stays measurable);
    • resolves the real home from the password database and pins GPU_TOKEN_FILE/GPU_QUEUE_DIR to it, still overridable from the environment.
  • tools/hyperloom/custom/README.md: the SVM requirement as a prerequisite bullet, so the launch line is reproducible off this box.

Verification

  • bash -n on the entrypoint — clean.
  • After the fix, on the rebuilt box (2026-10-31, --max-hours 1, Qwen3.8-27B UD-Q4_K_XL on HRX0): the run's first measurement shows gpu-hold hyperloom on the real ~/GPU-TOKEN, and the baseline passes the gate: KLD 0.000e+00 with greedy texts identical to the stored 30 Oct reference, score 44.69 geomean (pp512 371.78, tg128 11.75, serve code 20.44; the 30 Oct baseline was 46.09 = 397.18 / 11.52 / 21.41, inside this box's 4.5 % noise floor).
  • The same run's warm-recipe replay measured 50.64 with the same gate result — the pre-reinstall DFlash win (+13 %) is reproducible on the rebuilt stack.

Not merged, main untouched.

bong-water-water-bong and others added 5 commits October 31, 2026 22:51
The nightly libhsa page-faults on an HRX allocation unless HSA_USE_SVM=0,
HSA_USERPTR_FOR_PAGED_MEM=0 and HRX_ALLOW_NO_SVM=1 are set, so the
entrypoint defaults all three before it claims the GPU FIFO. An explicit
setting still wins, which leaves the lever available to a candidate.
…ndbox's

Hyperloom runs the entrypoint under a fresh HOME (its preflight writes into
~/.claude/config.json), and gpu-hold defaults GPU_TOKEN_FILE/GPU_QUEUE_DIR to
$HOME. Under that sandbox the claim was therefore taken on a private token
in a private queue -- outside the box's fair queue, which is exactly what the
claim exists to guarantee. Pin both paths to the password database's home,
still overridable from the environment.
… 8192)

Without -c, 1bit serve sizes the KV cache for the model's own context
(262144 on Qwen3.8-27B: 16.1 GiB of KV) and then aborts on its own fit check
unless the box is nearly idle. With another lane holding GTT that check
rejected every candidate of the 2026-10-31 run for a reason unrelated to the
lever under test. Pin the context so a measurement is reproducible; HL_CTX
overrides it and is echoed into the report with the other levers.

@bong-water-water-bong bong-water-water-bong left a comment

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

VERDICT: READY

At c3dfad5a (+18 −0, tools/hyperloom/custom/README.md + benchmark.py).

Both halves check out. The README sentence asserts that the entrypoint defaults the three no-SVM variables and that an explicit setting still wins — that is true at this head, in the file the sentence points at:

custom_strixhalo.sh:75  export HSA_USE_SVM=${HSA_USE_SVM:-0}
custom_strixhalo.sh:76  export HSA_USERPTR_FOR_PAGED_MEM=${HSA_USERPTR_FOR_PAGED_MEM:-0}
custom_strixhalo.sh:77  export HRX_ALLOW_NO_SVM=${HRX_ALLOW_NO_SVM:-1}

so the documented behaviour exists and is overridable, which is what the sentence claims (``${VAR:-default}` keeps an explicit setting).

The -c change is the right kind of fix, and it is written as a measurement condition rather than a lever, which is the honest framing: without it serve sizes the KV cache for the model's own context (262144 on Qwen3.8-27B → 16.1 GiB), which fails whenever another lane holds GTT, so candidates die for a reason unrelated to the lever under test. HL_CTX overrides, and it is added to levers() so a run that changes it records it.

Checked: python3 -m py_compile clean; env_int exists at line 72; serve_batch_args() is the function the serve leg actually uses (line 180) so the flag is not dead; HL_CTX appears only as the documented default and in the levers tuple.

One thing to keep in mind rather than fix: 8192 is now the default context for every serve-leg measurement, so any future flag that needs a longer prompt (a 16k-context comparison, for instance) must set HL_CTX explicitly or the candidate aborts on prompt length — worth a line in the runbook next to the other HL_* knobs.

tprs-ready applied.

@bong-water-water-bong bong-water-water-bong added the tprs-ready TPRS: review verdict READY posted by the standing reviewer; merge gate satisfied label Nov 1, 2026
@github-actions

github-actions Bot commented Nov 1, 2026

Copy link
Copy Markdown

PR Reviewer Guide 🔍

Here are some key observations to aid the review process:

🎫 Ticket compliance analysis 🔶

715 - Partially compliant

Compliant requirements:

  • Engine sets the trio itself when it detects unfavourable capability lines (XNACK enabled: NO / Coherent Host Access: FALSE) — per process, including test-backend-ops, not per harness arm
  • Log the libhsa path + sha256 in the HRX init line of every run

Non-compliant requirements:

  • Fail loudly at init with the recipe (a precondition check), so no lane can measure off a faulting path
  • Settle the release-runtime question (pin the nightly in the bundle, or make libhsa selection explicit and loud at init)

Requires further human verification:

  • Verification that the engine indeed detects the unfavourable capability lines and sets the trio accordingly
  • Verification that the libhsa path and sha256 are logged in the HRX init line
⏱️ Estimated effort to review: 3 🔵🔵🔵⚪⚪
🧪 No relevant tests
🔒 No security concerns identified
⚡ Recommended focus areas for review

Incorrect Home Path Resolution

The script attempts to resolve the real home directory using getent passwd "$(id -u)" | cut -d: -f6, which may not be reliable on all systems. If getent is not available or the user entry is malformed, this could lead to an incorrect or empty REAL_HOME value, potentially causing GPU_TOKEN_FILE and GPU_QUEUE_DIR to be set incorrectly.

REAL_HOME=${REAL_HOME:-$(getent passwd "$(id -u)" | cut -d: -f6)}
export GPU_TOKEN_FILE=${GPU_TOKEN_FILE:-${REAL_HOME:-$HOME}/GPU-TOKEN}
export GPU_QUEUE_DIR=${GPU_QUEUE_DIR:-${REAL_HOME:-$HOME}/GPU-QUEUE}
Missing Context Size in Serve Args

The serve_batch_args function now includes -c with a context size, but the default value is not explicitly documented or validated. If HL_CTX is not set, it defaults to 8192, which may not be appropriate for all models or use cases, potentially leading to unexpected behavior or resource exhaustion.

args = ["-c", str(env_int("HL_CTX", 8192))]

@bong-water-water-bong bong-water-water-bong left a comment

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

VERDICT: READY

At 2a4fcde0. My earlier READY was at c3dfad5a and the author patch has genuinely grown since (patch-id 8dfa608a83b9 -> 2c84e1f04abc), so this is a re-read, not a carry: the diff is now three files, +25 −2, and the third one is the entrypoint.

The new part is the best part of the PR. custom_strixhalo.sh now pins the FIFO to the real home:

REAL_HOME=${REAL_HOME:-$(getent passwd "$(id -u)" | cut -d: -f6)}
export GPU_TOKEN_FILE=${GPU_TOKEN_FILE:-${REAL_HOME:-$HOME}/GPU-TOKEN}
export GPU_QUEUE_DIR=${GPU_QUEUE_DIR:-${REAL_HOME:-$HOME}/GPU-QUEUE}

I checked both ends of that claim rather than the comment: gpu-hold reads exactly those two variables (QUEUE=${GPU_QUEUE_DIR:-$HOME/GPU-QUEUE}, TOKEN=${GPU_TOKEN_FILE:-$HOME/GPU-TOKEN}, lines 57-58 of ~/.local/bin/gpu-hold), and REAL_HOME resolves to /home/bcloud here, which is where the live ~/GPU-QUEUE and ~/GPU-TOKEN actually are. So under a sandboxed HOME the tickets now land in the real queue instead of a private directory that is "inside no queue at all" — which is the one property this entrypoint exists to guarantee.

The rest, re-verified at this head:

  • the three no-SVM exports are :--guarded (HSA_USE_SVM, HSA_USERPTR_FOR_PAGED_MEM, HRX_ALLOW_NO_SVM), so the README's "the entrypoint defaults all three … and an explicit setting still wins" is true of the code as it stands;
  • HL_CTX/-c 8192 in benchmark.py — py_compile clean, env_int exists, serve_batch_args() is what the serve leg calls, and HL_CTX appears as the documented default plus an entry in levers() so a run that changes it records it;
  • bash -n clean on custom_strixhalo.sh.

One thing to keep in mind (not a defect): 8192 is now the default serve-leg context, so a future candidate that needs a longer prompt must set HL_CTX explicitly or it will abort on prompt length — worth a line beside the other HL_* knobs in the runbook.

tprs-ready stands. Nothing here needs a GPU run to be judged: the entrypoint's job is to join the queue correctly, and I verified it against the queue implementation itself.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Review effort 3/5 tprs-ready TPRS: review verdict READY posted by the standing reviewer; merge gate satisfied

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant