From e0dd8c98c636548886c589dc04cff2f89eed477a Mon Sep 17 00:00:00 2001 From: bong-water-water-bong Date: Wed, 11 Nov 2026 03:02:10 -0400 Subject: [PATCH 1/2] bump-hrx: the mirror branch is named in a config file, so a new dated mirror needs no workflow edit (Refs #1945) config/llama-mirror-branch.config: the first non-comment line names the fork branch that mirrors AMD's line; without one it is 1bit/hrx-vulkan, as before. This is step 3 of the plan for AMD's rebase (new dated mirror branch, no force-move): once that branch exists and is merged into our line, pointing the sync at it is one line in this file. Co-Authored-By: Claude Fable 5.2 --- config/llama-mirror-branch.config | 29 +++++++++++++++++++ docs/hrx.md | 7 +++++ scripts/bump-hrx-sync.sh | 48 +++++++++++++++++++++++-------- tests/bump_hrx_sync_test.sh | 22 ++++++++++++++ 4 files changed, 94 insertions(+), 12 deletions(-) create mode 100644 config/llama-mirror-branch.config diff --git a/config/llama-mirror-branch.config b/config/llama-mirror-branch.config new file mode 100644 index 000000000..ad57ae50b --- /dev/null +++ b/config/llama-mirror-branch.config @@ -0,0 +1,29 @@ +# 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 branch of 1bit-MONSTER/llama.cpp that mirrors AMD's HRX line, for the daily bump-hrx run +# (scripts/bump-hrx-sync.sh): the first line below that is not a comment. With no such line the mirror is +# `1bit/hrx-vulkan`, as it has always been. +# +# Why this is a file: no branch of the fork is ever force-moved (owner, 2026-11-10). When AMD rewrites its line +# so that its pin no longer descends from the mirror, AMD's new line is pushed to a NEW branch, named for the +# day, the old mirror is left exactly where it is, and that branch's name goes here. The workflow file is not +# edited. Order of work for such a move: +# 1. push AMD's pin to 1bit-MONSTER/llama.cpp as a new branch, e.g. 1bit/hrx-vulkan-20261110 (AMD's history +# carries workflow files, so this push needs a token with `workflow` scope); +# 2. merge that branch into 1bit/hrx-vulkan-patched by an ordinary reviewed PR on the fork; +# 3. name the branch on a line below, and delete any commit line from config/llama-mirror-hold.config. +# +# No branch is named below, so the mirror is 1bit/hrx-vulkan. diff --git a/docs/hrx.md b/docs/hrx.md index 2faf2db4d..01037f80a 100644 --- a/docs/hrx.md +++ b/docs/hrx.md @@ -110,6 +110,13 @@ fails a pin that leaves a gate model's node off HRX. 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. +- **Which branch is the mirror.** [`config/llama-mirror-branch.config`](../config/llama-mirror-branch.config) + names it; with no name there it is `1bit/hrx-vulkan`. The file exists because no branch of the fork is ever + force-moved (owner, 2026-11-10): when AMD rewrites its line, AMD's new line is pushed to a new branch named for + the day, merged into `1bit/hrx-vulkan-patched` by an ordinary reviewed PR on the fork, and then named in this + file, while the old mirror stays where it was. That needs no workflow edit. A name that is not a plain branch + name, or that is our own line, is refused. `scripts/bump-hrx-sync.sh mirror-branch` prints the branch a run + would use. - **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 diff --git a/scripts/bump-hrx-sync.sh b/scripts/bump-hrx-sync.sh index 3e9e1e80f..beaec58fe 100755 --- a/scripts/bump-hrx-sync.sh +++ b/scripts/bump-hrx-sync.sh @@ -51,6 +51,7 @@ 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} +LLAMA_MIRROR_FILE=${LLAMA_MIRROR_FILE:-config/llama-mirror-branch.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 @@ -96,6 +97,26 @@ llama_hold_sha() { grep -v '^[[:space:]]*#' "$f" | grep -oE '^[0-9a-f]{40}' | head -n1 || true } +# The branch of 1bit-MONSTER/llama.cpp that mirrors AMD's line: the first line of config/llama-mirror-branch.config +# that is not a comment, or 1bit/hrx-vulkan when the file is absent or names nothing. +# 2026-11-10 (engine#1945): AMD rebased its line, and the owner's rule is that no branch is ever force-moved. So the +# old mirror stays where it is, AMD's new line goes to a NEW branch (1bit/hrx-vulkan-), and this file is how the +# sync is pointed at it -- the workflow file is not edited, and cannot be with the token this repository's lanes have. +# A name that is not a plain branch name is refused: it ends up inside a refspec. +llama_mirror_branch() { + local f=$LLAMA_MIRROR_FILE name="" + case "$f" in /*) ;; *) f=$ENGINE_DIR/$f ;; esac + if [ -f "$f" ]; then name=$(grep -v '^[[:space:]]*#' "$f" | grep -v '^[[:space:]]*$' | head -n1 | sed -e 's/^[[:space:]]*//' -e 's/[[:space:]]*$//' || true); fi + [ -n "$name" ] || name=1bit/hrx-vulkan + case "$name" in + */hrx-vulkan-patched|1bit/hrx-vulkan-patched) die "$LLAMA_MIRROR_FILE names $name, which is our own line, not a mirror of AMD's" ;; + esac + if ! [[ "$name" =~ ^[A-Za-z0-9._/-]+$ ]] || [[ "$name" == *..* ]] || [[ "$name" == -* ]] || [[ "$name" == refs/* ]]; then + die "$LLAMA_MIRROR_FILE names '$name', which is not a plain branch name" + fi + echo "$name" +} + # 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 @@ -148,29 +169,30 @@ sync_llama() { warn "could not refresh 1bit-MONSTER/llama.cpp master: $(printf '%s' "$refresh" | head -n1); continuing with the HRX pin sync" fi + local mirror_branch; mirror_branch=$(llama_mirror_branch) rm -rf patched && git init -q patched && cd patched git remote add fork "$(remote_url 1bit-MONSTER/llama.cpp)" git remote add amd https://github.com/AMD-Ecosystem/llama.cpp.git git fetch -q --filter=blob:none amd "$AMD_LLAMA" git fetch -q --filter=blob:none fork \ - "1bit/hrx-vulkan:refs/remotes/fork/mirror" "1bit/hrx-vulkan-patched:refs/remotes/fork/patched" + "$mirror_branch:refs/remotes/fork/mirror" "1bit/hrx-vulkan-patched:refs/remotes/fork/patched" local mirror patched pin=$AMD_LLAMA mirror=$(git rev-parse refs/remotes/fork/mirror) patched=$(git rev-parse refs/remotes/fork/patched) - echo "AMD pin $pin, mirror 1bit/hrx-vulkan $mirror, our line 1bit/hrx-vulkan-patched $patched" + echo "AMD pin $pin, mirror $mirror_branch $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." ;; + die "$LLAMA_HOLD_FILE holds $mirror_branch 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." ;; + die "$LLAMA_HOLD_FILE holds $mirror_branch 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." + note "$mirror_branch 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 \`$mirror_branch\` 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 "llama_held=$mirror_branch HELD at \`${mirror:0:12}\` by \`$LLAMA_HOLD_FILE\` (AMD's pin is \`${pin:0:12}\`)." output "patches</dev/null || true) EOF" @@ -191,10 +213,10 @@ EOF" foreign=$(sed -n 's/^foreign //p' <<< "$off") rebased=$(sed -n 's/^rebased //p' <<< "$off") if [ -n "$foreign" ]; then - die "1bit/hrx-vulkan has commits that are on no branch of AMD-Ecosystem/llama.cpp and have no same-author, same-date, same-subject commit in AMD's pin; the mirror must hold AMD's commits only. Move these to 1bit/hrx-vulkan-patched by hand: $(tr '\n' ';' <<< "$foreign")" + die "$mirror_branch has commits that are on no branch of AMD-Ecosystem/llama.cpp and have no same-author, same-date, same-subject commit in AMD's pin; the mirror must hold AMD's commits only. Move these to 1bit/hrx-vulkan-patched by hand: $(tr '\n' ';' <<< "$foreign")" fi if [ -n "$rebased" ]; then - die "AMD rebased its line and dropped the old one: $(wc -l <<< "$rebased" | tr -d ' ') commit(s) of 1bit/hrx-vulkan are on no AMD branch, and each has a commit in AMD's pin ${pin:0:12} with the same author, author date and subject (old new subject: $(tr '\n' ';' <<< "$rebased")). They are AMD's commits, NOT ours: do not move them to 1bit/hrx-vulkan-patched. Merge AMD's pin into 1bit/hrx-vulkan-patched by hand, then move the mirror to the pin." + die "AMD rebased its line and dropped the old one: $(wc -l <<< "$rebased" | tr -d ' ') commit(s) of $mirror_branch are on no AMD branch, and each has a commit in AMD's pin ${pin:0:12} with the same author, author date and subject (old new subject: $(tr '\n' ';' <<< "$rebased")). They are AMD's commits, NOT ours: do not move them to 1bit/hrx-vulkan-patched. Merge AMD's pin into 1bit/hrx-vulkan-patched by hand, then move the mirror to the pin." fi # AMD rewrote history. Find the newest commit of the new pin whose tree equals a commit that # descends from the old mirror on some AMD branch (its pre-rewrite equivalent). @@ -206,7 +228,7 @@ EOF" if [ -n "$equiv" ]; then squash=$c; break; fi done < <(git -C ../amdrefs log --format='%H %T' "$pin" --not "$mirror") if [ -z "$squash" ]; then - die "AMD's pin ${pin:0:12} does not contain 1bit/hrx-vulkan ${mirror:0:12} and no AMD commit after it has the same tree as any commit of the new pin; AMD rewrote its history in a way this job cannot map. Merge AMD's pin into 1bit/hrx-vulkan-patched by hand." + die "AMD's pin ${pin:0:12} does not contain $mirror_branch ${mirror:0:12} and no AMD commit after it has the same tree as any commit of the new pin; AMD rewrote its history in a way this job cannot map. Merge AMD's pin into 1bit/hrx-vulkan-patched by hand." fi git fetch -q --filter=blob:none amd "$equiv" 2>/dev/null || git fetch -q --filter=blob:none fork "$equiv" ident replace --graft "$squash" "$equiv" @@ -290,9 +312,9 @@ parent here, so a later full merge still brings them in.") if [ "$rewritten" = 1 ]; then git tag -f "hrx-vulkan-${mirror:0:12}" "$mirror" push fork "refs/tags/hrx-vulkan-${mirror:0:12}" - push --force-with-lease="refs/heads/1bit/hrx-vulkan:$mirror" fork "$pin:refs/heads/1bit/hrx-vulkan" + push --force-with-lease="refs/heads/$mirror_branch:$mirror" fork "$pin:refs/heads/$mirror_branch" else - push fork "$pin:refs/heads/1bit/hrx-vulkan" + push fork "$pin:refs/heads/$mirror_branch" fi fi output "rebased=$rebased" @@ -344,5 +366,7 @@ case "$cmd" in off-branch) off_branch_commits "${2:?repo}" "${3:?mirror}" "${4:?pin}" ;; # The mirror-hold decision alone, on a local repository: llama-hold , hold file from LLAMA_HOLD_FILE. llama-hold) llama_hold_decision "${2:?repo}" "$(llama_hold_sha)" "${3:?mirror}" "${4:?pin}" ;; + # The mirror branch this run would use (config/llama-mirror-branch.config, or LLAMA_MIRROR_FILE). + mirror-branch) llama_mirror_branch ;; *) echo "usage: $0 llama|hrx" >&2; exit 2 ;; esac diff --git a/tests/bump_hrx_sync_test.sh b/tests/bump_hrx_sync_test.sh index 4191ec487..d374010d3 100755 --- a/tests/bump_hrx_sync_test.sh +++ b/tests/bump_hrx_sync_test.sh @@ -133,5 +133,27 @@ else fail "config/llama-mirror-hold.config is in the tree" fi +# ---- which branch is the mirror (config/llama-mirror-branch.config) ----------------------------------------- +mb=$work/mirror.config +branch() { LLAMA_MIRROR_FILE=$mb bash "$script" mirror-branch 2>&1; } +rm -f "$mb" +expect "no file: the mirror is 1bit/hrx-vulkan, as it always was" "$(branch)" "1bit/hrx-vulkan" +printf '# only comments\n\n# 1bit/hrx-vulkan-20261110\n' > "$mb" +expect "a branch that is only mentioned in a comment changes nothing" "$(branch)" "1bit/hrx-vulkan" +printf '# the dated mirror\n\n 1bit/hrx-vulkan-20261110 \n1bit/ignored-second-line\n' > "$mb" +expect "the first line that is not a comment names the mirror, spaces around it ignored" "$(branch)" "1bit/hrx-vulkan-20261110" +for bad in '1bit/hrx-vulkan-patched' 'refs/heads/1bit/x' '../x' '-x' 'a b' 'x;rm' 'x:y'; do + printf '%s\n' "$bad" > "$mb" + if out=$(branch); then fail "a mirror named '$bad' is refused (got: $out)"; else + case "$out" in *"$mb"*|*llama-mirror*|*mirror*) ok "a mirror named '$bad' is refused, naming the file" ;; *) fail "the refusal of '$bad' names the file (got: $out)" ;; esac + fi +done +shipped_mb=$(cd "$(dirname "$script")/.." && pwd)/config/llama-mirror-branch.config +if [ -f "$shipped_mb" ]; then + expect "the shipped file names no branch, so the mirror is unchanged" "$(LLAMA_MIRROR_FILE=$shipped_mb bash "$script" mirror-branch)" "1bit/hrx-vulkan" +else + fail "config/llama-mirror-branch.config is in the tree" +fi + if [ "$fails" -ne 0 ]; then echo "$fails check(s) failed"; exit 1; fi echo "bump_hrx_sync: ok" From 49079220c2900fb3c4338ce7da8b7172b92f007d Mon Sep 17 00:00:00 2001 From: bong-water-water-bong Date: Wed, 11 Nov 2026 06:44:11 -0400 Subject: [PATCH 2/2] bump-hrx: print the mirror-name refusal when the llama sync hits it llama_mirror_branch() is read inside a command substitution, so die's stdout message went into the variable and the run failed with no output. The two refusals now write to stderr, and a test drives the llama target with a bad name and asserts the ::error:: line. Co-Authored-By: Claude Fable 5.2 --- scripts/bump-hrx-sync.sh | 4 ++-- tests/bump_hrx_sync_test.sh | 12 ++++++++++++ 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/scripts/bump-hrx-sync.sh b/scripts/bump-hrx-sync.sh index 1e85e74e8..1bde316e3 100755 --- a/scripts/bump-hrx-sync.sh +++ b/scripts/bump-hrx-sync.sh @@ -109,10 +109,10 @@ llama_mirror_branch() { if [ -f "$f" ]; then name=$(grep -v '^[[:space:]]*#' "$f" | grep -v '^[[:space:]]*$' | head -n1 | sed -e 's/^[[:space:]]*//' -e 's/[[:space:]]*$//' || true); fi [ -n "$name" ] || name=1bit/hrx-vulkan case "$name" in - */hrx-vulkan-patched|1bit/hrx-vulkan-patched) die "$LLAMA_MIRROR_FILE names $name, which is our own line, not a mirror of AMD's" ;; + */hrx-vulkan-patched|1bit/hrx-vulkan-patched) die "$LLAMA_MIRROR_FILE names $name, which is our own line, not a mirror of AMD's" >&2 ;; esac if ! [[ "$name" =~ ^[A-Za-z0-9._/-]+$ ]] || [[ "$name" == *..* ]] || [[ "$name" == -* ]] || [[ "$name" == refs/* ]]; then - die "$LLAMA_MIRROR_FILE names '$name', which is not a plain branch name" + die "$LLAMA_MIRROR_FILE names '$name', which is not a plain branch name" >&2 fi echo "$name" } diff --git a/tests/bump_hrx_sync_test.sh b/tests/bump_hrx_sync_test.sh index fe1bc1b45..7333d91af 100755 --- a/tests/bump_hrx_sync_test.sh +++ b/tests/bump_hrx_sync_test.sh @@ -151,6 +151,18 @@ for bad in '1bit/hrx-vulkan-patched' 'refs/heads/1bit/x' '../x' '-x' 'a b' 'x;rm case "$out" in *"$mb"*|*llama-mirror*|*mirror*) ok "a mirror named '$bad' is refused, naming the file" ;; *) fail "the refusal of '$bad' names the file (got: $out)" ;; esac fi done +# The same refusal through the path the workflow runs: `llama` reads the name inside a command substitution, where a +# message written to stdout is captured into the variable and never printed. The run must fail AND say why. +printf 'x;rm\n' > "$mb" +mkdir -p "$work/empty-scratch" +if out=$(cd "$work/empty-scratch" && env -u GH_TOKEN -u GITHUB_TOKEN DRY_RUN=1 LLAMA_MIRROR_FILE=$mb AMD_LLAMA=$(printf "a%.0s" $(seq 40)) OURS_HRX=$(printf "b%.0s" $(seq 40)) bash "$script" llama 2>&1); then + fail "the llama sync with a mirror named 'x;rm' fails (it exited 0: $out)" +else + case "$out" in + *"::error::"*"not a plain branch name"*) ok "the llama sync refuses a bad mirror name with its ::error:: line, not silently" ;; + *) fail "the llama sync's refusal of a bad mirror name is printed (got: '$out')" ;; + esac +fi shipped_mb=$(cd "$(dirname "$script")/.." && pwd)/config/llama-mirror-branch.config if [ -f "$shipped_mb" ]; then expect "the shipped file names no branch, so the mirror is unchanged" "$(LLAMA_MIRROR_FILE=$shipped_mb bash "$script" mirror-branch)" "1bit/hrx-vulkan"