Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 33 additions & 0 deletions config/llama-mirror-hold.config
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
# Copyright 2026 bong-water-water-bong
# SPDX-License-Identifier: Apache-2.0
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
# The commit of 1bit-MONSTER/llama.cpp `1bit/hrx-vulkan` (our mirror of AMD's HRX line) that the daily
# bump-hrx run must not move away from. While a commit is named here, bump-hrx does not move the mirror,
# does not merge AMD's llama.cpp pin into `1bit/hrx-vulkan-patched`, reports the hold in the run summary and
# succeeds. Delete the commit line to lift the hold.
#
# The hold is for one situation only: AMD rewrote its line, so its pin no longer descends from the mirror,
# and taking it is a hand merge that has not been done yet. The run FAILS, naming this file, when the file
# is out of date (the mirror is no longer the named commit) or no longer needed (AMD's pin contains the
# named commit again), so a hold cannot outlive the state it describes.
#
# No commit is named below, so nothing is held. Naming one is the owner's decision. The state it would
# record, as of 2026-11-11 (engine#1945):
# mirror 1bit/hrx-vulkan 44ee5710d19f7f3af79b99bbcbe5fd13979d1f67 (AMD's line before its rebase)
# AMD pin 9bf5871310a8d7de74f4cb0c57009835fbf91c27 (the rebased line, 1777 upstream commits newer)
# merge into 1bit/hrx-vulkan-patched, against the last AMD commit our line took (43b0ec2c41cc):
# 149 conflicted files, 538 hunks (65 files / 83 hunks in the HRX backend)
# To hold, put the mirror's commit on a line of its own:
# 44ee5710d19f7f3af79b99bbcbe5fd13979d1f67
12 changes: 12 additions & 0 deletions docs/hrx.md
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,18 @@ fails a pin that leaves a gate model's node off HRX.
`ggml/src/ggml-hrx` keep our side; a conflict anywhere else fails the run and names the files;
- merges AMD's hrx-system pin into our `1bit/main` the same way;
- opens a PR here moving the submodules, listing the llama.cpp commits new to the engine.
- **The mirror hold.** A rewrite of AMD's line that the rules above cannot merge leaves the daily run with
nothing to do but fail, every day, until somebody does the merge by hand. While
[`config/llama-mirror-hold.config`](../config/llama-mirror-hold.config) names the mirror's commit, the run
instead reports the hold in its summary (`mirror 1bit/hrx-vulkan HELD at …; AMD's pin is …, on a line that
does not contain it`), moves nothing and succeeds; the engine's pin still follows our own line. The hold
describes one state and fails the run when that state ends, so it cannot be forgotten: **stale** when the
mirror is no longer the named commit, **unneeded** when AMD's pin contains the named commit again (an ordinary
sync would work). `scripts/bump-hrx-sync.sh llama-hold <repo> <mirror> <pin>` prints the decision alone
(`none`, `held`, `stale`, `unneeded`). The file ships naming no commit, so it holds nothing; naming one is
the owner's decision. It was added for AMD's 2026-11-09 rebase (engine#1945): taking that pin is a merge of
149 conflicted files (538 hunks) into `1bit/hrx-vulkan-patched`, measured against the last AMD commit our
line took.
- **The hold.** While [`config/hrx-system-hold.config`](../config/hrx-system-hold.config)
names a commit, the run does not merge AMD's hrx-system, keeps `third_party/hrx-system`
where it is, and takes only AMD's llama.cpp changes outside the HRX backend paths
Expand Down
51 changes: 51 additions & 0 deletions scripts/bump-hrx-sync.sh
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,8 @@
# A mirror commit that is on no AMD branch fails the run and is named, as one of two
# things (off_branch_commits): AMD's own commit from a line AMD rebased and dropped, to be
# merged by hand, or a commit that is not AMD's, to be moved to our line.
# - the mirror is held (config/llama-mirror-hold.config names its commit): the run reports the hold and
# moves nothing. For a rewrite that cannot be merged by rule (engine#1945); see llama_hold_decision.
# - hrx-system is held (config/hrx-system-hold.config). AMD's ggml-hrx is written against
# AMD's hrx-system (e.g. #139 moved the kernel corpus to the `multiple_of` predicate that
# our held hrx-system cannot parse), so only AMD's changes OUTSIDE the HRX backend paths
Expand All @@ -48,6 +50,7 @@ set -euo pipefail
cmd=${1:-}
DRY_RUN=${DRY_RUN:-0}
HOLD_FILE=${HOLD_FILE:-config/hrx-system-hold.config}
LLAMA_HOLD_FILE=${LLAMA_HOLD_FILE:-config/llama-mirror-hold.config}
ENGINE_DIR=$(pwd)
# The HRX backend paths of the llama.cpp tree (what AMD's hrx-graph line adds on top of ggml).
# tests/CMakeLists.txt belongs here: it is where the HRX test targets are registered, so it moves
Expand Down Expand Up @@ -85,6 +88,34 @@ hold_sha() {
grep -v '^[[:space:]]*#' "$ENGINE_DIR/$HOLD_FILE" | grep -oE '^[0-9a-f]{40}' | head -n1 || true
}

# The commit 1bit/hrx-vulkan (our mirror of AMD's line) is held at, or empty. Same file shape as the hrx-system hold.
llama_hold_sha() {
local f=$LLAMA_HOLD_FILE
case "$f" in /*) ;; *) f=$ENGINE_DIR/$f ;; esac # relative to the engine checkout unless given whole
[ -f "$f" ] || return 0
grep -v '^[[:space:]]*#' "$f" | grep -oE '^[0-9a-f]{40}' | head -n1 || true
}

# What a mirror hold means for this run. Reads repo $1; $2 is the held commit (may be empty), $3 the mirror tip,
# $4 AMD's pin. One word:
# none no commit is held: the sync runs as usual
# held the mirror is the held commit and AMD's pin does not descend from it: report it, move nothing
# stale a commit is held but the mirror is somewhere else: somebody moved the mirror, the file is out of date
# unneeded the mirror is the held commit and AMD's pin contains it: an ordinary fast-forward would work
# 2026-11-10 (engine#1945): AMD re-committed its HRX series on a base 1777 upstream commits newer. Taking that
# pin is a merge of about 150 conflicted files into our line, which is days of work for the lanes that own
# those files, and until it is done the daily run can only fail. A failure that is known, sized and assigned
# is not news; a hold says so in the run's summary and lets the run stay green for everything else it checks.
# The hold is deliberately narrow: `stale` and `unneeded` both FAIL the run, so the file cannot outlive the
# state it describes -- the day AMD's pin is reachable again, or the mirror moves, the run says to delete it.
llama_hold_decision() {
local repo=$1 hold=$2 mirror=$3 pin=$4
if [ -z "$hold" ]; then echo none; return; fi
if [ "$hold" != "$mirror" ]; then echo stale; return; fi
if [ "$mirror" = "$pin" ] || git -C "$repo" merge-base --is-ancestor "$mirror" "$pin" 2>/dev/null; then echo unneeded; return; fi
echo held
}

# Why a mirror commit is on no AMD branch. Reads repo $1 (commits only are enough), whose refs/amd/*
# are AMD's branches; $2 is the mirror tip and $3 AMD's new pin. One line per such commit:
# rebased <old> <new> <subject> the new pin holds a commit with the same author, author date and
Expand Down Expand Up @@ -128,6 +159,24 @@ sync_llama() {
patched=$(git rev-parse refs/remotes/fork/patched)
echo "AMD pin $pin, mirror 1bit/hrx-vulkan $mirror, our line 1bit/hrx-vulkan-patched $patched"

# 0. A mirror hold (config/llama-mirror-hold.config): the run reports it and moves nothing.
local lhold; lhold=$(llama_hold_sha)
case "$(llama_hold_decision . "$lhold" "$mirror" "$pin")" in
stale)
die "$LLAMA_HOLD_FILE holds 1bit/hrx-vulkan at ${lhold:0:12}, but the mirror is ${mirror:0:12}: the hold is out of date. Name the mirror's commit in it, or delete the commit line to let the sync run." ;;
unneeded)
die "$LLAMA_HOLD_FILE holds 1bit/hrx-vulkan at ${lhold:0:12}, and AMD's pin ${pin:0:12} contains that commit: an ordinary sync would work. Delete the commit line." ;;
held)
note "1bit/hrx-vulkan is held at ${mirror:0:12} by $LLAMA_HOLD_FILE: AMD's pin ${pin:0:12} does not descend from it (AMD rewrote its line). Nothing was moved; the merge is tracked where the hold file says."
summary "- llama.cpp: mirror \`1bit/hrx-vulkan\` HELD at \`${mirror:0:12}\` ($LLAMA_HOLD_FILE); AMD's pin is \`${pin:0:12}\`, on a line that does not contain it. Not merged."
output "rebased=$patched"
output "llama_held=1bit/hrx-vulkan HELD at \`${mirror:0:12}\` by \`$LLAMA_HOLD_FILE\` (AMD's pin is \`${pin:0:12}\`)."
output "patches<<EOF
$(git log --format='- `%h` %s' "${OURS_LLAMA:-$patched}..$patched" 2>/dev/null || true)
EOF"
return 0 ;;
esac

# 1. The mirror. It holds AMD's commits only; ours live on 1bit/hrx-vulkan-patched.
local rewritten=0
if [ "$mirror" != "$pin" ] && ! git merge-base --is-ancestor "$mirror" "$pin"; then
Expand Down Expand Up @@ -293,5 +342,7 @@ case "$cmd" in
hrx) sync_hrx ;;
# For tests/bump_hrx_sync_test.sh: the classification alone, on a local repository, no network.
off-branch) off_branch_commits "${2:?repo}" "${3:?mirror}" "${4:?pin}" ;;
# The mirror-hold decision alone, on a local repository: llama-hold <repo> <mirror> <pin>, hold file from LLAMA_HOLD_FILE.
llama-hold) llama_hold_decision "${2:?repo}" "$(llama_hold_sha)" "${3:?mirror}" "${4:?pin}" ;;
*) echo "usage: $0 llama|hrx" >&2; exit 2 ;;
esac
31 changes: 31 additions & 0 deletions tests/bump_hrx_sync_test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -102,5 +102,36 @@ other=$(g rev-parse HEAD)
expect "the same subject and author at another author date is foreign" "$(run "$other" "$pin" | head -n1)" \
"foreign $(g rev-parse --short "$other") hrx: something new"

# ---- the mirror hold (config/llama-mirror-hold.config): what a named commit means for a run -------------------
holdf=$work/hold.config
hold() { LLAMA_HOLD_FILE=$holdf bash "$script" llama-hold "$repo" "$1" "$2"; }
# a pin that descends from the mirror: build one
g checkout -q --detach "$mirror"
commit "$amd" "$amd_mail" 2026-11-10T00:00:00Z 2026-11-10T00:00:00Z "hrx: one more on the old line"
desc=$(g rev-parse HEAD)

rm -f "$holdf"
expect "no hold file: the sync runs as usual" "$(hold "$mirror" "$pin")" "none"
printf '# a comment\n# %s\n' "$mirror" > "$holdf"
expect "a commit that is only mentioned in a comment holds nothing" "$(hold "$mirror" "$pin")" "none"
printf '# held\n%s\n' "$mirror" > "$holdf"
expect "the mirror is the held commit and AMD's pin is on a rewritten line: held" "$(hold "$mirror" "$pin")" "held"
expect "the mirror has moved away from the held commit: the file is stale" "$(hold "$ours" "$pin")" "stale"
expect "AMD's pin contains the held commit again: the hold is not needed" "$(hold "$mirror" "$desc")" "unneeded"
expect "the pin IS the held commit: not needed either" "$(hold "$mirror" "$mirror")" "unneeded"
printf 'not-a-sha\n%s extra words\n' "$mirror" > "$holdf"
expect "the commit line may carry a trailing note; a line that is not a commit is ignored" "$(hold "$mirror" "$pin")" "held"
printf '%s\n' "${mirror:0:12}" > "$holdf"
expect "a short hash is not a hold: forty hex digits or nothing" "$(hold "$mirror" "$pin")" "none"

# The file shipped in the tree names no commit, so merging it holds nothing.
shipped=$(cd "$(dirname "$script")/.." && pwd)/config/llama-mirror-hold.config
if [ -f "$shipped" ]; then
expect "the shipped hold file holds nothing until a commit line is added" \
"$(LLAMA_HOLD_FILE=$shipped bash "$script" llama-hold "$repo" "$mirror" "$pin")" "none"
else
fail "config/llama-mirror-hold.config is in the tree"
fi

if [ "$fails" -ne 0 ]; then echo "$fails check(s) failed"; exit 1; fi
echo "bump_hrx_sync: ok"
Loading