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
36 changes: 31 additions & 5 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ jobs:
# its own. It runs on push only; on merge_group it is skipped at t=0, which the verdict blocks
# below read as `skipped:::skipped` = "x86-main + determinism ran".
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
runs-on: [self-hosted, Linux, X64, clean-room]
runs-on: [self-hosted, Linux, clean-room]
timeout-minutes: 10
permissions:
contents: read
Expand Down Expand Up @@ -316,7 +316,7 @@ jobs:
x86-main-advisories:
needs: [mg-reuse]
if: ${{ !cancelled() && needs.mg-reuse.outputs.x86 == '1' }}
runs-on: [self-hosted, Linux, X64, clean-room]
runs-on: [self-hosted, Linux, clean-room]
timeout-minutes: 30
permissions:
contents: read
Expand Down Expand Up @@ -439,12 +439,35 @@ jobs:
# failure, never a pass.
# ==========================================================================
# The workspace tests, one shard per job (nextest hash partition N/12 plus the
# explicit runner's round-robin N/12), in parallel on the X64 clean-room pool.
# explicit runner's round-robin N/12), in parallel on the clean-room pool (arch-neutral, PMAT-3138).
# The section body is ci/sections.yml `workspace-test-shard`, unchanged.
# #5882: which tier this run owes decides WHERE the shards may run. The full tier's Σ-executed fan-in
# compares every shard with ONE universe list, and arch-gated tests (target_arch cfgs) differ per
# arch, so a full tier needs one architecture: X64. The quick/PR tier owes no Σ and stays
# arch-neutral. The tier is only knowable from the diff, so it is decided HERE, by the same script
# the shards run (scripts/ci/decide_tier.sh), and workspace-test-shard reads it in its runs-on.
# scripts/ci/sigma_arch_uniform.sh in the fan-in is the backstop: a mixed full tier is RED.
workspace-test-arch:
runs-on: [self-hosted, Linux, clean-room]
timeout-minutes: 15
outputs:
tier: ${{ steps.tier.outputs.tier }}
steps:
- uses: actions/checkout@v7
with:
fetch-depth: 0
- name: Decide the test tier (the shards' own step, one script)
id: tier
env:
GH_TOKEN: ${{ github.token }}
MG_BASE_SHA: ${{ github.event.merge_group.base_sha }}
run: bash scripts/ci/decide_tier.sh
workspace-test-shard:
needs: [workspace-test-arch]
if: ${{ github.event.pull_request.draft != true }}
# same lanes as x86-main: clean-room for pull_request/push, mq for a merge_group entry
runs-on: ${{ github.event_name == 'merge_group' && fromJSON('["self-hosted","Linux","X64","mq"]') || fromJSON('["self-hosted","Linux","X64","clean-room"]') }}
# arch-neutral (operator 2026-10-21 14:18Z) EXCEPT the full tier, which needs one arch for the Σ (#5882, workspace-test-arch)
# clean-room for pull_request/push, mq for a merge_group entry
runs-on: ${{ needs.workspace-test-arch.outputs.tier == 'full' && (github.event_name == 'merge_group' && fromJSON('["self-hosted","Linux","X64","mq"]') || fromJSON('["self-hosted","Linux","X64","clean-room"]')) || (github.event_name == 'merge_group' && fromJSON('["self-hosted","Linux","mq"]') || fromJSON('["self-hosted","Linux","clean-room"]')) }}
timeout-minutes: 180
strategy:
fail-fast: false
Expand Down Expand Up @@ -523,6 +546,7 @@ jobs:
set -euo pipefail
d="$RUNNER_TEMP/sigma"
python3 scripts/ci/sigma_executed.py --self-test
bash scripts/ci/sigma_arch_uniform.sh --self-test
# ONE shard count: the pins in ci/sections.yml (check_shard_count_single_source.sh)
SHARDS="$(awk -v ev="$GITHUB_EVENT_NAME" '/^matrix-pins:/{p=1;next} p&&/^ workspace-test-shard:/{k="pr";next} p&&/^ workspace-test-shard-merge_group:/{k="mg";next} p&&/^ [a-z]/{k=""} k&&/^ - \{shard:/{c[k]++} END{print (ev=="merge_group"&&c["mg"]?c["mg"]:c["pr"])+0}' ci/sections.yml)"
[ "${SHARDS:-0}" -ge 1 ] 2>/dev/null || { echo "::error::Σ: no workspace-test-shard pins"; exit 1; }
Expand All @@ -539,6 +563,8 @@ jobs:
[ "$#" -eq "$SHARDS" ] || { echo "::error::Σ: $# tier files for $SHARDS shards:$tiers"; exit 1; }
for t in "$@"; do [ "$t" = "$1" ] || { echo "::error::Σ: the shards disagree on the tier:$tiers"; exit 1; }; done
[ "$1" = full ] || { echo "every shard ran tier '$1': the lib/explicit Σ is not owed"; exit 0; }
# #5882: a full tier on two architectures is RED (arch-gated tests, one universe): placement is workspace-test-arch's, this is the backstop
bash scripts/ci/sigma_arch_uniform.sh "$d" "$SHARDS"
j=() l=()
for n in $(seq 1 "$SHARDS"); do
j+=(--junit "$d/sigma-shard-$n/lib.junit.xml")
Expand Down
62 changes: 2 additions & 60 deletions ci/sections.yml
Original file line number Diff line number Diff line change
Expand Up @@ -378,66 +378,7 @@ jobs:
GH_TOKEN: ${{ github.token }}
MG_BASE_SHA: ${{ github.event.merge_group.base_sha }}
run: |
set -euo pipefail
args=(--event "${GITHUB_EVENT_NAME}")
# PMAT-1098 67-E2: the queue and a push to main re-derive their own
# diff from HEAD's FIRST PARENT (HEAD^1..HEAD is the PR's diff on the
# new base). actions/checkout is shallow, so that parent is not in the
# object store until we deepen -- and without it ci_test_tier.sh falls
# closed to `full` every single time, which would make the whole
# optimisation inert while looking like it worked. Best effort by
# design: if the deepen fails the decision still falls closed, and the
# warning below says so instead of the run silently paying the hour.
case "${GITHUB_EVENT_NAME}" in
merge_group)
# Operator 2026-10-17: the queue runs the quick tier over the entry's diff (base_sha = prior entry's head),
# MG_BASE_SHA..HEAD. Fetch the base; if that fails the tier falls closed to full.
bash scripts/ci/fetch_p6.sh --no-tags --depth=1 origin "${GITHUB_SHA}" "${MG_BASE_SHA}" 2>/dev/null \
|| bash scripts/ci/fetch_p6.sh --no-tags --depth=1 origin "${MG_BASE_SHA}" 2>/dev/null \
|| true
git cat-file -e "${MG_BASE_SHA}^{commit}" 2>/dev/null \
|| printf '::warning::merge_group base sha unavailable -- the tier falls closed to full\n'
;;
push)
bash scripts/ci/fetch_p6.sh --no-tags --depth=2 origin "${GITHUB_SHA}" 2>/dev/null \
|| bash scripts/ci/fetch_p6.sh --no-tags --deepen=1 origin 2>/dev/null \
|| true
if git rev-parse -q --verify 'HEAD^1' >/dev/null 2>&1; then
printf 'first parent available: %s\n' "$(git rev-parse HEAD^1)"
else
printf '::warning::first parent unavailable after deepen -- the tier falls closed to full\n'
fi
;;
esac
case "${GITHUB_EVENT_NAME}" in
pull_request)
bash scripts/ci/fetch_p6.sh --no-tags --depth=1 origin "+refs/heads/${GITHUB_BASE_REF}:refs/remotes/origin/${GITHUB_BASE_REF}"
# #5391: the PR's change is the diff from merge-base(base, HEAD), not the
# base tip -- main's later commits are not the PR's. --no-renames (#3664)
# lives in the helper.
bash scripts/ci/pr_touched_paths.sh "origin/${GITHUB_BASE_REF}" HEAD > "$RUNNER_TEMP/touched.txt"
args+=(--diff-from "$RUNNER_TEMP/touched.txt")
;;
merge_group)
# Operator 2026-10-17 (cop window), verbatim: "only gating on tags/release".
# ci_test_tier.sh diffs MG_BASE_SHA..HEAD (env above) and selects like a PR.
;;
push)
# T36: the merge queue already tested this very sha. Hand its
# workspace-test result to the tier script, which reuses it only
# on a success for HEAD itself. A failed lookup is the push's own
# tier, as before -- never a reuse, never a red step.
mg=$(bash scripts/ci_mg_workspace_result.sh "${GITHUB_REPOSITORY}" "${GITHUB_SHA}") || mg=""
if [ -n "$mg" ]; then
mapfile -t mgargs <<<"$mg"
args+=("${mgargs[@]}")
else
printf 'no merge_group workspace-test result for %s: the tier is decided from the push diff\n' "${GITHUB_SHA}"
fi
;;
esac
bash scripts/ci_test_tier.sh "${args[@]}" | tee "$RUNNER_TEMP/tier.txt"
grep -E '^(tier|crates|targets|check_workspace|reason|cite)=' "$RUNNER_TEMP/tier.txt" >> "$GITHUB_OUTPUT"
bash scripts/ci/decide_tier.sh
# #4502 row 2: lint_passes_on_real_contracts (aprender-contracts) requires the
# refinement gate to RUN whenever CI is set, and that gate compares HEAD with
# merge-base(HEAD, origin/main), else the origin/main tip. This section clones at
Expand Down Expand Up @@ -774,6 +715,7 @@ jobs:
sig="$RUNNER_TEMP/sigma"
mkdir -p sigma-shard
printf '%s\n' "$TIER" > sigma-shard/tier
uname -m > sigma-shard/arch
if [ "$TIER" = full ]; then
cp "$sig/lib.junit.xml" sigma-shard/lib.junit.xml
cp "${FAT_SECTION_LOG:?the fat driver sets FAT_SECTION_LOG}" sigma-shard/section.log
Expand Down
22 changes: 21 additions & 1 deletion crates/aprender-serve/src/kernel_registry_parity.rs
Original file line number Diff line number Diff line change
Expand Up @@ -743,6 +743,7 @@ fn committed() -> Vec<(serde_json::Value, serde_json::Value)> {
#[test]
fn committed_parity_receipts_hold_on_this_host() {
let r = registry().expect("registry");
let mut no_arch_receipt = Vec::new();
for (entry, rc) in committed() {
let id = rc["kernel_id"].as_str().expect("kernel_id");
let path = entry["receipt"].as_str().expect("receipt path");
Expand Down Expand Up @@ -789,8 +790,22 @@ fn committed_parity_receipts_hold_on_this_host() {
seed: wl["seed"].as_u64().expect("seed"),
trials: dim("trials"),
};
let bound = rc["tolerance_rel"].as_f64().expect("tolerance_rel");
let now = measure(kernel(id), w, false);
// A receipt's `tolerance_rel` is the bound measured on its own `host_arch`; libm and FMA
// contraction move the last ulps between architectures. Any other arch must carry its own
// measured bound under `per_arch.<arch>.tolerance_rel` -- never a borrowed one, never a skip.
let bound = if rc["host_arch"] == host_arch() {
rc["tolerance_rel"].as_f64().expect("tolerance_rel")
} else if let Some(b) = rc["per_arch"][host_arch()]["tolerance_rel"].as_f64() {
b
} else {
no_arch_receipt.push(format!(
"{path}: no {} receipt (host measured max_rel_err {})",
host_arch(),
now.max_rel_err
));
continue;
};
assert_eq!(
rc["margin"]["verdict"], "pass",
"{path}: KTEST-02 margin verdict (max ≤ 1 under EM-DOT)"
Expand Down Expand Up @@ -842,6 +857,11 @@ fn committed_parity_receipts_hold_on_this_host() {
p => panic!("{id}: no precision check for {p}"),
}
}
assert!(
no_arch_receipt.is_empty(),
"committed receipts lack a bound for this arch:\n{}",
no_arch_receipt.join("\n")
);
}

/// `KREG_INPUT_SETS_OUT`: the input-set hashes recomputed from the tree at `KREG_GIT_SHA`, one
Expand Down
9 changes: 9 additions & 0 deletions evidence/kreg/parity/cpu.matvec.apr_q4.json
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,15 @@
},
"oracle": "apr_format_decode_f64",
"oracle_independent": true,
"per_arch": {
"aarch64": {
"host": "gx10-pool1",
"max_rel_err": 5.568608963671898e-07,
"source": "CI job 119289824035 (PR #5871 shard 1), same seed and workload",
"tolerance_rel": 2e-6,
"ts": "2026-10-21T14:51:19Z"
}
},
"quantized_activation_oracle": null,
"registry_precision": "f32",
"schema": "kernel-parity-receipt/v1",
Expand Down
9 changes: 9 additions & 0 deletions evidence/kreg/parity/cpu.matvec.apr_q8.json
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,15 @@
},
"oracle": "apr_format_decode_f64",
"oracle_independent": true,
"per_arch": {
"aarch64": {
"host": "gx10-pool1",
"max_rel_err": 5.982009671170112e-07,
"source": "CI job 119289824035 (PR #5871 shard 1), same seed and workload",
"tolerance_rel": 2e-6,
"ts": "2026-10-21T14:51:19Z"
}
},
"quantized_activation_oracle": null,
"registry_precision": "f32",
"schema": "kernel-parity-receipt/v1",
Expand Down
9 changes: 9 additions & 0 deletions evidence/kreg/parity/cpu.matvec.bf16.json
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,15 @@
},
"oracle": "le_decode_half_f64",
"oracle_independent": true,
"per_arch": {
"aarch64": {
"host": "gx10-pool1",
"max_rel_err": 4.068146011742945e-07,
"source": "CI job 119289824035 (PR #5871 shard 1), same seed and workload",
"tolerance_rel": 9e-7,
"ts": "2026-10-21T14:51:19Z"
}
},
"quantized_activation_oracle": null,
"registry_precision": "f32",
"schema": "kernel-parity-receipt/v1",
Expand Down
9 changes: 9 additions & 0 deletions evidence/kreg/parity/cpu.matvec.f16.json
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,15 @@
},
"oracle": "le_decode_half_f64",
"oracle_independent": true,
"per_arch": {
"aarch64": {
"host": "gx10-pool1",
"max_rel_err": 3.920968817889049e-07,
"source": "CI job 119289824035 (PR #5871 shard 1), same seed and workload",
"tolerance_rel": 8e-7,
"ts": "2026-10-21T14:51:19Z"
}
},
"quantized_activation_oracle": null,
"registry_precision": "f32",
"schema": "kernel-parity-receipt/v1",
Expand Down
9 changes: 9 additions & 0 deletions evidence/kreg/parity/cpu.matvec.f32.json
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,15 @@
},
"oracle": "le_decode_half_f64",
"oracle_independent": true,
"per_arch": {
"aarch64": {
"host": "gx10-pool1",
"max_rel_err": 7.356022484897627e-07,
"source": "CI job 119289824035 (PR #5871 shard 1), same seed and workload",
"tolerance_rel": 2e-6,
"ts": "2026-10-21T14:51:19Z"
}
},
"quantized_activation_oracle": null,
"registry_precision": "f32",
"schema": "kernel-parity-receipt/v1",
Expand Down
9 changes: 9 additions & 0 deletions evidence/kreg/parity/cpu.matvec.q4_0.json
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,15 @@
},
"oracle": "in_tree_dequant_f64",
"oracle_independent": false,
"per_arch": {
"aarch64": {
"host": "gx10-pool1",
"max_rel_err": 0.003859434297246209,
"source": "CI job 119289824035 (PR #5871 shard 1), same seed and workload",
"tolerance_rel": 0.008,
"ts": "2026-10-21T14:51:19Z"
}
},
"quantized_activation_oracle": {
"max_rel_err": 1.69613194525447e-7
},
Expand Down
9 changes: 9 additions & 0 deletions evidence/kreg/parity/cpu.matvec.q4_k.json
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,15 @@
},
"oracle": "in_tree_dequant_f64",
"oracle_independent": false,
"per_arch": {
"aarch64": {
"host": "gx10-pool1",
"max_rel_err": 0.005569836531516333,
"source": "CI job 119289824035 (PR #5871 shard 1), same seed and workload",
"tolerance_rel": 0.02,
"ts": "2026-10-21T14:51:19Z"
}
},
"quantized_activation_oracle": {
"max_rel_err": 1.3720446505396093e-7
},
Expand Down
9 changes: 9 additions & 0 deletions evidence/kreg/parity/cpu.matvec.q5_k.json
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,15 @@
},
"oracle": "in_tree_dequant_f64",
"oracle_independent": false,
"per_arch": {
"aarch64": {
"host": "gx10-pool1",
"max_rel_err": 1.3110594897372703e-06,
"source": "CI job 119289824035 (PR #5871 shard 1), same seed and workload",
"tolerance_rel": 3e-6,
"ts": "2026-10-21T14:51:19Z"
}
},
"quantized_activation_oracle": null,
"registry_precision": "f32",
"schema": "kernel-parity-receipt/v1",
Expand Down
9 changes: 9 additions & 0 deletions evidence/kreg/parity/cpu.matvec.q6_k.json
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,15 @@
},
"oracle": "in_tree_dequant_f64",
"oracle_independent": false,
"per_arch": {
"aarch64": {
"host": "gx10-pool1",
"max_rel_err": 1.6505971099429934e-6,
"source": "CI job 119280981403 (PR #5871 shard 1), same seed and workload",
"tolerance_rel": 4e-6,
"ts": "2026-10-21T14:37:43Z"
}
},
"quantized_activation_oracle": null,
"registry_precision": "f32",
"schema": "kernel-parity-receipt/v1",
Expand Down
9 changes: 9 additions & 0 deletions evidence/kreg/parity/cpu.matvec.q8_0.json
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,15 @@
},
"oracle": "in_tree_dequant_f64",
"oracle_independent": false,
"per_arch": {
"aarch64": {
"host": "gx10-pool1",
"max_rel_err": 0.003738839019401381,
"source": "CI job 119289824035 (PR #5871 shard 1), same seed and workload",
"tolerance_rel": 0.008,
"ts": "2026-10-21T14:51:19Z"
}
},
"quantized_activation_oracle": {
"max_rel_err": 2.0240994602880252e-7
},
Expand Down
7 changes: 5 additions & 2 deletions scripts/check_ci_push_reuse.sh
Original file line number Diff line number Diff line change
Expand Up @@ -285,10 +285,13 @@ hasnt "D11 pull_request ignores --mg-*: never reuse" "tier=reuse" "$OUT"

# -- W: the CI wiring ------------------------------------------------------------------------------
SEC="$ROOT/ci/sections.yml"
DT="$ROOT/scripts/ci/decide_tier.sh" # the tier step body lives in one script (#5882): the section step and workspace-test-arch both run it
want "W0 the section step runs the shared decide_tier.sh" 1 \
"$(grep -cF "bash scripts/ci/decide_tier.sh" "$SEC")"
want "W1 the tier step's push arm calls the lookup for GITHUB_SHA" 1 \
"$(grep -cF 'bash scripts/ci_mg_workspace_result.sh "${GITHUB_REPOSITORY}" "${GITHUB_SHA}"' "$SEC")"
"$(grep -cF 'bash scripts/ci_mg_workspace_result.sh "${GITHUB_REPOSITORY}" "${GITHUB_SHA}"' "$DT")"
want "W2 a failed lookup is not fatal to the step (it falls to today's tier)" 1 \
"$(grep -cF '"${GITHUB_SHA}") || mg=""' "$SEC")"
"$(grep -cF '"${GITHUB_SHA}") || mg=""' "$DT")"
W3PAT="push) printf 'cited merge_group run: %s"
if grep -qF "$W3PAT" "$SEC"; then w3=1; else w3=0; fi
want "W3 the reuse step labels a push citation as a merge_group run, not a PR head" 1 "$w3"
Expand Down
Loading
Loading