Skip to content

ggml-hrx: support Gemma routed IDs and expert scales - #180

Merged
AaronStGeorge merged 2 commits into
hrx-graph-develop-v2from
users/astgeorg/gemma-hrx-bringup
Nov 5, 2026
Merged

AaronStGeorge merged 2 commits into
hrx-graph-develop-v2from
users/astgeorg/gemma-hrx-bringup

Conversation

@AaronStGeorge

@AaronStGeorge AaronStGeorge commented Nov 5, 2026 •

Copy link
Copy Markdown
Collaborator

Overview

Enable Gemma 4 26B-A4B text inference on HRX after the routed K704 support merged in #177. This adds only the two remaining bringup fixes:

  • Bind router IDs to their actual view span. An eight-ID view retaining a 128-ID row stride exposes 3,616 bytes for eight tokens; the old dispatch requested 4,096 bytes and failed before prefill. Update the shared router view extent and both standalone/fused bindings without changing route selection or the underlying allocation.
  • Add scalar F32 GET_ROWS for per-expert scales: source [1,128,T], routed IDs [8,T], output [1,8,T], with compact or padded ID rows. Existing vectorized embedding gathers are unchanged. Admission is limited to 1-2048 tokens and ID strides 8-512.

The branch starts at merged #177/#179 (0a4ac566a). It leaves REPEAT CPU fallback and weight residency unchanged.

Validation

Exact head 8f1749b522f21ce11e19d48b5773080b356ea15e rebuilt on Radeon 8060S gfx1151 with HRX 82214dfb029975205d1c3a59164b678e2e21fc41, ROCm 10.1.0 and Clang 24. The earlier Clang 23 SDK cache was removed, so this is fresh validation with the replacement toolchain.

  • 15/15 focused GPU operator checks and 5/5 backend checks pass, including scalar/router host admission, prefill512 expert table, and Q5_1 K704 controls.
  • Independent review found an unchecked expert-ID read in the initial patch. The final kernel checks signed 0 <= id < 128 before casting or reading scales; invalid IDs produce zero, consistent with the existing negative-ID gather fallback. Mixed -1, 128, INT_MIN, INT_MAX regression cases pass for compact/padded rows. The reviewer rechecked the immutable final commit and found no remaining blocking issue.
  • Full paired HRX/Vulkan runs on this exact head completed all 144 chunks / 147,312 scored targets, 31/31 layers, ctx2048, b/ub256, flash ON, F16 KV, mmap, and no compute errors. HRX PPL 20142.1478 +/-383.15903; Vulkan 20050.1927 +/-382.20831. Every cumulative chunk score exactly matches its corresponding earlier candidate result.
  • Fresh reasoning-disabled, seed42/temp0 chat on each backend produced the same correct one-sentence Rayleigh-scattering explanation after nonempty prefill and autoregressive decoding.
  • All four hosted CI checks pass. Six hardware CI jobs remain queued; no required branch checks are configured. These queued jobs are not claimed as passes.

Earlier validation of the same Gemma patch on the previous #177 integration:

  • 13/13 focused GPU operator checks, 3/3 routed backend controls, scalar-gather host admission checks, and a router host regression that fails against the original implementation. CPU-reference coverage includes route IDs/weights at T1/T2/T4/T8 and scalar gathers at T1/T2/T8 with strides 8/128 and endpoint IDs 0/127.
  • Full 144-chunk WikiText-2 runs on HRX and Vulkan, 147,312 scored targets, 31/31 layers offloaded, ctx2048, b/ub256, flash attention ON, F16 KV, one sequence. HRX PPL 20142.1478; Vulkan 20050.1927. Both completed without compute errors.
  • Repeatable seeded chat and five correct HRX short-answer checks (fact, arithmetic, ordering, exact JSON, grounded summary); Vulkan arithmetic/JSON controls also passed.

The absolute perplexity is abnormally high on HRX, Vulkan, and a bounded CPU check. This PR establishes functional execution for the tested GGUF, not expected intrinsic model quality or tokenwise equivalence. HRX retains CPU REPEAT fallback (61 graph splits versus Vulkan's 2); full layer offload is not all-operator GPU execution. No throughput, long-context, vision, non-flash-attention, or residency improvement is claimed.

Model: unsloth/gemma-4-26B-A4B-it-GGUF revision c099eb48e663fd284577b04978a94ffccb261841, gemma-4-26B-A4B-it-UD-Q4_K_M.gguf, SHA256 f2c28b3dc4776931ac6f879e11f203dec637ea0f14267a86ec8f6165f63f293f. Corpus wiki.test.raw SHA256 173c87a53759e0201f33e0ccf978e510c2042d7f2cb78229d9a50d79b9e7dd08.

Requirements

  • Contributing guidelines reviewed by the agent; the user authorized publication and merge in this AMD-Ecosystem fork.
  • AI usage disclosure: YES. Codex assisted with implementation, review, validation, and this description.

@AaronStGeorge
AaronStGeorge marked this pull request as ready for review November 5, 2026 13:20
@AaronStGeorge
AaronStGeorge merged commit 62eb8dc into hrx-graph-develop-v2 Nov 5, 2026
4 of 10 checks passed
@AaronStGeorge
AaronStGeorge deleted the users/astgeorg/gemma-hrx-bringup branch November 5, 2026 13:20
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