Skip to content

zaya: run on HRX and ROCm as well as Vulkan - #5

Merged
bong-water-water-bong merged 1 commit into
1bit/hrx-vulkan-patchedfrom
1bit/zaya-gpu
Sep 26, 2026
Merged

bong-water-water-bong merged 1 commit into
1bit/hrx-vulkan-patchedfrom
1bit/zaya-gpu

Conversation

@bong-water-water-bong

Copy link
Copy Markdown

Follow-up to #2, which was merged before this last commit landed. ZAYA1 already ran on Vulkan and the CPU; this commit makes it run on HRX0 and ROCm0 too. Each change below was found by the op or kernel that stopped one of those backends:

  • Recurrent state as two whole rows per sequence. The conv state goes in r (n_embd_r = 2·n_qk) and the previous hidden state in s (n_embd_s = n_embd), the way the gated-delta-net models keep theirs. HRX has no copy into part of a row.
  • Grouped-conv weights stored tap-major, {IC_G, n_qk, 2}. The conv becomes one batched matmul per tap on the shifted depthwise output, with no concat of strided views. The converter writes this layout, so GGUFs converted with model: ZAYA1 (Zyphra) with a converter (HRX and ROCm follow in #5) #2's converter must be reconverted.
  • q/k normalised with rms_norm. It is the same value as l2_norm × √head_dim, in one op every backend has.
  • The router's EDA term is built before its down projection. HRX fuses that projection with the bias and EDA adds into one kernel, which must find the term already written. Without this, HRX0 failed with reads transient value ... before write.
  • Router scores made contiguous before argsort. ROCm requires it.
  • ggml-cuda/HIP: ssm_conv with a 2-tap kernel.
  • llama-quantize keeps cca_conv_grp in F16, as it does ssm_conv1d.

Checks (strixhalo, Radeon 8060S)

Accuracy against transformers FP32, teacher-forced (96 positions): the F16 GGUF agrees on the top-1 token at 95/96, unchanged from #2.

test-llama-archs -a zaya: Vulkan NMSE 9.6e-8 and ROCm 8.1e-14 vs the CPU; roundtrip OK.

Speed, ZAYA1-8B Q4_K_M:

Device Prefill (pp512) Decode (tg128) Perplexity (engine docs, c=512)
Vulkan0 3,437 tok/s 93.0 tok/s 21.57
ROCm0 (GGML_HIP=ON, gfx1151) ~2,400 tok/s (noisy) 61.5 tok/s 21.78
HRX0 1,175 tok/s 25.5 tok/s 21.55

🤖 Generated with Claude Code

ZAYA1 ran on Vulkan and the CPU only. Changes that let HRX0 and ROCm0 run it too, each
found by the op or kernel that stopped it:

- recurrent state as two whole rows per sequence, the conv state of q|k in r
  (n_embd_r = 2*n_qk) and the previous hidden state in s (n_embd_s = n_embd), as the
  gated-delta-net models keep theirs; HRX has no copy into part of a row
- the grouped conv's weights tap-major, {IC_G, n_qk, 2}: one batched matmul per tap on
  the depthwise output shifted by that tap, no concat of strided views (the converter
  writes this layout; GGUFs converted before it no longer load)
- q and k normalised with rms_norm, the same value as l2_norm * sqrt(head_dim) in one op
  that every backend has
- the router's EDA term built before its down projection, which HRX fuses with the bias
  and EDA adds into one kernel that must find the term already written
- the router scores made contiguous before argsort (ROCm needs it)
- ggml-cuda/HIP: ssm_conv with a 2-tap kernel
- llama-quantize keeps cca_conv_grp in F16, as it does the ssm_conv1d weights

Checked on Strix Halo (Radeon 8060S), ZAYA1-8B:
- transformers FP32, 96 teacher-forced positions: the F16 GGUF agrees on the top-1 token
  at 95 (unchanged)
- test-llama-archs -a zaya: Vulkan NMSE 9.6e-8 and ROCm 8.1e-14 vs the CPU, roundtrip OK
- Q4_K_M, pp512 / tg128 tok/s, perplexity: Vulkan0 3437 / 93.0, 21.57;
  HRX0 1175 / 25.5, 21.55; ROCm0 ~2400 / 61.5, 21.78

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@bong-water-water-bong
bong-water-water-bong merged commit e2e6ca2 into 1bit/hrx-vulkan-patched Sep 26, 2026
13 of 31 checks passed
@bong-water-water-bong
bong-water-water-bong deleted the 1bit/zaya-gpu branch October 12, 2026 01:31
bong-water-water-bong pushed a commit that referenced this pull request Nov 8, 2026
…se release() nulls slot.task (engine ggml-org#1489)

A CLIP encode failure killed llama-server with SIGSEGV three milliseconds after it had already produced the
error. Reproduced with a backtrace, and the frame names the site:

  Thread 1 received signal SIGSEGV
  #0 server_context_impl::pre_decode()::{lambda(server_slot&)#5}::operator()(server_slot&)
  #1 server_context_impl::iterate(std::vector<server_slot>&, std::function<void(server_slot&)>)
  #2 server_context_impl::pre_decode()
  #3 server_context_impl::update_slots()

The failing path is the multimodal chunk loop in pre_decode(): process_mtmd_chunk() returns non-zero, the slot's
error is sent, slot.release() runs - which does both "task_prev = std::move(task)" and "task.reset()", leaving
slot.task null - and then "continue" re-enters that loop, whose first statement reads slot.task->n_tokens(). Null
dereference, every time.

Return instead: the slot has been released and must not be batched in this pass. Upstream master's equivalent
handler does exactly that, with the comment "the slot is done, skip it entirely".

No other site in this file releases a slot and then continues.

Not verified by a rebuild in this lane: the tree here has no configured HRX build, and the only configured one on
this box is a shared build tree whose rebuild is precisely the ggml-org#1403 incident (it swaps libraries under running
services). The pre-fix crash is recorded with the full backtrace in engine ggml-org#1489; the post-fix acceptance is the
issue's own - an HTTP error and a live process - which CI's build can run.
bong-water-water-bong added a commit that referenced this pull request Nov 8, 2026
…se release() nulls slot.task (engine ggml-org#1489) (#246)

Same one-line fix as #245, cherry-picked onto 1bit/hrx-vulkan-patched -- the branch the engine actually pins.
The bug site is identical on this branch (tools/server/server-context.cpp:3667-3670), so until this lands the
pinned tree still dies on a failed CLIP encode.

A CLIP encode failure kills llama-server with SIGSEGV three milliseconds after it has already produced the error.
Reproduced with a backtrace, and the frame names the site:

  Thread 1 received signal SIGSEGV
  #0 server_context_impl::pre_decode()::{lambda(server_slot&)#5}::operator()(server_slot&)
  #1 server_context_impl::iterate(std::vector<server_slot>&, std::function<void(server_slot&)>)
  #2 server_context_impl::pre_decode()
  #3 server_context_impl::update_slots()

The failing path is the multimodal chunk loop in pre_decode(): process_mtmd_chunk() returns non-zero, the slot's
error is sent, slot.release() runs - which does both "task_prev = std::move(task)" and "task.reset()", leaving
slot.task null - and then "continue" re-enters that loop, whose first statement reads slot.task->n_tokens(). Null
dereference, every time.

Return instead: the slot has been released, nothing is left to advance (the failed chunk was never added to the
prompt or the cache), and it must not be batched in this pass.

Upstream check, since the reviewer of #245 could not reach it from the fork tree: at upstream origin/master the
equivalent handler does

    slot.release();
    return; // the slot is done, skip it entirely

(verified by fetching origin/master into a fork checkout and reading tools/server/server-context.cpp there; the
honest caveat is that upstream has since refactored the chunk helper into free functions, so the surrounding code
differs while the failure handling does not).

No other site in this file releases a slot and then continues (checked on this branch).

Not verified by a rebuild in this lane: this tree has no configured HRX build, and the box's only configured one is a
shared build tree whose rebuild is precisely the ggml-org#1403 incident. The pre-fix crash is recorded with the full
backtrace in engine ggml-org#1489; the post-fix acceptance is the issue's own - an HTTP error and a live process.

Co-authored-by: bong-water-water-bong <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant