Skip to content

perf(cpu): schedule Cortex-A76 Q8 dot with AAPCS64 SDOT - #79

Open
richiejp wants to merge 7 commits into
mudler:mainfrom
richiejp:row/KERNEL-CPU-A76-Q8-DOT
Open

perf(cpu): schedule Cortex-A76 Q8 dot with AAPCS64 SDOT#79
richiejp wants to merge 7 commits into
mudler:mainfrom
richiejp:row/KERNEL-CPU-A76-Q8-DOT

Conversation

@richiejp

@richiejp richiejp commented Aug 6, 2026

Copy link
Copy Markdown
Contributor

Row

KERNEL-CPU-A76-Q8-DOT — one row per PR.

Stacked on #65 (BACKEND-CPU). Review range after #65 is
16c848326..9044c2a7d. Until #65 lands, GitHub temporarily shows its parent
commits in this PR and the combined diff exceeds the 900-line cap. Keep this
PR draft; if #65 is squash-merged, rebase this branch onto the resulting
main before marking it ready.

What changed

Adds the first optimized Q8_0 x Q8_0 provider above the portable C++ fallback:
an exact-order GCC/ACLE SDOT control and a hand-scheduled AAPCS64 Cortex-A76
leaf. Runtime HWCAP and MIDR selection enables assembly by default only on
Cortex-A76 with DotProd; unsupported CPUs retain the portable implementation.
It also adds explicit benchmark variants, direct exactness/edge tests, QEMU
ARM64 gates, and the binding physical-Pi compiler-gap evidence.

Evidence

  • scripts/agent-preflight.sh passes. The branch-specific record and
    checkpoint checks pass; full preflight retains two unrelated failures
    already present on upstream/main: MiniMax-H3 merged-GEMM routing and
    four undocumented DFlash/H3 tuning variables.
  • Tests covering this change:
    • x86 build-rpi5-cpu/tests/test_ops_quant_dot: 20/20 cases, 150,139
      assertions
      .
    • Docker buildx/QEMU ARM64 test_ops_quant_dot: 20/20 cases, 150,258
      assertions
      , followed by an explicit a76-asm smoke with the expected
      checksum.
    • Exact exported artifact hashes and all physical-Pi commands/raw hashes are
      indexed in
      docs/bench-evidence/rpi5-a76-q8-dot-20260806.md.
  • Same-change checkpoint surfaces updated: docs/STATUS.md,
    docs/BENCHMARKS.md, docs/FEATURES.md, roadmap, backend/feature/kernel
    matrices, state and parity ledger. check-agent-record.py,
    check-doc-checkpoint.py, check-now-current.py,
    check-model-checklist.py, and check-readme-structure.py pass.
  • scripts/check-pr-size.py --base 16c848326 --head 9044c2a7d --branch row/KERNEL-CPU-A76-Q8-DOT: 387 non-exempt lines across eight
    files
    , within the 900-line cap for the eventual kernel-only range.

Speed claims

  • The authorized series ran uncontended on the execution-only Raspberry Pi
    5, with randomized/interleaved arms, throttled=0x0 throughout, exact
    checksums/tokens, and binding results recorded in docs/BENCHMARKS.md.

Assembly versus compiler SDOT is 3.66% faster at M=1/T1, 5.08% faster at
M=128/T1
, and 3.69% faster at M=128/T4. In the recursive 64-token
Qwen3.5-2B gate it lowers median TTFT 1.55% and E2E 0.13%, with TPOT
neutral and every output byte-identical to the x86 golden.

Honest gaps

M=1/T4 is 2.43% slower than compiler SDOT (and 13.4% slower than portable),
so the row remains GATING, not DONE. The threadpool partition, dominant BF16
GEMM, peak memory, concurrent serving, and same-file Raspberry Pi llama.cpp
floor remain open. This PR makes no whole-engine competitor-parity claim.

FOLLOWING_AGENTS_PROTOCOL
Assisted-by: Codex:gpt-5 [Codex]
Pin the Q8_K_XL vehicle, observed Pi hardware and PMU surface, recursive optimization method, correctness gates, and same-file llama.cpp floor before implementation. Record Pi evidence as pending without changing the binding 20-core Arm result.

FOLLOWING_AGENTS_PROTOCOL

Assisted-by: Codex:gpt-5 [Codex]
Add a review-capped vt-op harness with deterministic quant GEMM fixtures, calibrated timing, cache-pressure profiles, JSON output, affinity and system metadata, plus grouped generic and Cortex-A76 perf_event_open counters. Keep unsupported and multiplexed events explicit and preserve the legacy quant benchmark.

CPU-gated with GCC warning-as-error, clang-format, CTest CLI/schema checks, deterministic checksums, and direct 1-thread and 4-thread PMU runs. Pi execution and every performance claim remain pending.

FOLLOWING_AGENTS_PROTOCOL

Assisted-by: Codex:gpt-5 [Codex]
Build ARM64 artifacts under buildx/QEMU, verify the exported binaries and exact Qwen3.5-2B tokens on Cortex-A76, and record the PMU-ranked portable baseline that selects Q8 SDOT as the first assembly candidate.

FOLLOWING_AGENTS_PROTOCOL

Assisted-by: Codex:gpt-5 [Codex]
Inventory the measured Q8_0 DotProd opportunity, bind compiler-SDOT versus scheduled AAPCS64 gates, and claim the independent kernel row before implementation.

FOLLOWING_AGENTS_PROTOCOL

Assisted-by: Codex:gpt-5 [Codex]
Add runtime-gated exact-order compiler and AAPCS64 variants, QEMU gates, and bind the physical-Pi compiler-gap result.

FOLLOWING_AGENTS_PROTOCOL
Assisted-by: Codex:gpt-5 [Codex]
Record the same-file Raspberry Pi 5 speed, memory, and exact-output comparison, including the reproducible b9892 reconstruction and void intrusive-sampler attempt.

FOLLOWING_AGENTS_PROTOCOL
Assisted-by: Codex:gpt-5 [Codex]
@richiejp
richiejp marked this pull request as ready for review August 7, 2026 12:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant