Skip to content

serve: gpu-hold honours the box thermal brake and a cross-label cool-down - #502

Merged
bong-water-water-bong merged 3 commits into
mainfrom
1bit/gpu-hold-thermal-cooldown
Oct 23, 2026
Merged

bong-water-water-bong merged 3 commits into
mainfrom
1bit/gpu-hold-thermal-cooldown

Conversation

@bong-water-water-bong

Copy link
Copy Markdown
Collaborator

strixhalo was reaching 93 C with the queue still starting new claims on a soaked enclosure, so the heat never came down. Two gates in scripts/gpu-hold, both default-on, both env-dismissable.

THERMAL-BRAKE GATE. While strixhalo-thermal-guard's ~/THERMAL-HOLD exists with a live pid, a claim that is first in the queue does not START: it logs the reading and keeps waiting. Holds already running are untouched (they still abort at 93 C). GPU_HOLD_IGNORE_THERMAL_HOLD=1 starts anyway. A flag whose pid is gone is ignored, so a killed guard cannot stall the queue.

CROSS-LABEL COOL-DOWN. A hold that ends at or above GPU_HOLD_COOLDOWN_TCTL (default 85 C) stamps $QUEUE/.cooldown, and no claim of ANY label starts for GPU_HOLD_COOLDOWN (default 180 s) after it. The stamp is written before the token is released, so a waiting ticket cannot slip in through the gap. GPU_HOLD_COOLDOWN=0 disables it.

Why 85 C / 180 s: measured on the box on 2026-10-22, after the enclosure sensor peaked at 87 C it fell to 80 C in 10 s, 75 C in 14 s, 70 C in 34 s and 65 C in 158 s, and compile-shaped load runs at 0.72 C/W against 0.45 C/W for GPU-shaped load, so a claim that starts immediately after a hot hold climbs straight back to the trip point.

Nothing else changes: the 75 C start gate and the 93 C abort are untouched, no new files outside the queue directory, no kills.

Tests (bash -n plus fixture runs against a throwaway queue dir and token): a hold ending hot writes the stamp, the next other label logs cooling down after a hot hold (Ns to go) and starts once the window passes; a hold ending cool writes no stamp and the next label starts at once; a junk or 10-minute-old stamp is ignored; GPU_HOLD_COOLDOWN=0 never waits; the per-label GPU_HOLD_RELEASE_WAIT and the THERMAL-HOLD gate still behave as before. tools/copyright.py --check passes.

…l-down

strixhalo's compilers took the die to 93 C and the queue then started the next claim on a soaked enclosure,
so the heat never came down. Two gates in scripts/gpu-hold, both default-on and both removable by env:

- THERMAL-BRAKE GATE: while strixhalo-thermal-guard's ~/THERMAL-HOLD exists with a live pid, a claim that is
  first in the queue does not START (it logs the reading and keeps waiting). Running holds are untouched - they
  still abort at 93 C - and GPU_HOLD_IGNORE_THERMAL_HOLD=1 starts anyway. A flag whose pid is gone is ignored,
  so a killed guard cannot stall the queue.
- CROSS-LABEL COOL-DOWN: a hold that ends at or above GPU_HOLD_COOLDOWN_TCTL (85 C) stamps $QUEUE/.cooldown and
  no claim of ANY label starts for GPU_HOLD_COOLDOWN (180 s) after it. The stamp is written before the token is
  released, so a waiting ticket cannot slip in. Measured on the box 2026-10-22: EC 87 -> 70 C in 34 s,
  -> 65 C in 158 s, which is what the window buys.

Both are read-only with respect to everything else: no new files outside the queue dir, no kills, no change to
the start gate (75 C) or the 93 C abort.
@github-actions

github-actions Bot commented Oct 22, 2026 •

Copy link
Copy Markdown

PR Reviewer Guide 🔍

(Review updated until commit 33065be)

Here are some key observations to aid the review process:

⏱️ Estimated effort to review: 3 🔵🔵🔵⚪⚪
🧪 No relevant tests
🔒 No security concerns identified
⚡ Recommended focus areas for review

Possible race condition in cooldown stamping

The cooldown stamp is written to "$QUEUE/.cooldown" before the token is released, which is good to prevent a waiting ticket from slipping in. However, if the process is interrupted between writing the stamp and releasing the token, or if multiple processes race to write the stamp, it could lead to inconsistent state. This is especially concerning in a multi-process environment where the queue is shared.

printf '%s %s\n' "$(date +%s)" "$t" > "$COOLDOWN_STAMP"
Thermal brake may not work as intended

The thermal brake logic checks if the THERMAL_FLAG file exists and if the PID inside it is still valid. However, if the strixhalo-thermal-guard process dies and its PID is reused by another process, the check may incorrectly allow a new claim to start, even though the thermal condition still holds. This could lead to the system overheating.

elif [ -e "$THERMAL_FLAG" ] && [ "${GPU_HOLD_IGNORE_THERMAL_HOLD:-0}" != 1 ] &&
     kill -0 "$(head -n 1 "$THERMAL_FLAG" 2> /dev/null)" 2> /dev/null; then
    # strixhalo-thermal-guard has the box hot and the compilers paused: a new claim would only add heat.
    if [ "$waited" = 0 ]; then
        log "first in the queue, holding off: $(head -n 2 "$THERMAL_FLAG" | paste -sd' ') is up"
    fi

@github-actions

Copy link
Copy Markdown

Persistent review updated to latest commit 19c7a9f

@github-actions

Copy link
Copy Markdown

Persistent review updated to latest commit 33065be

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant