Skip to content

zaya: skip CONTs of fresh contiguous results - #36

Merged
bong-water-water-bong merged 1 commit into
1bit/hrx-vulkan-patchedfrom
1bit/zaya-decode-noop-copies
Sep 29, 2026
Merged

bong-water-water-bong merged 1 commit into
1bit/hrx-vulkan-patchedfrom
1bit/zaya-decode-noop-copies

Conversation

@bong-water-water-bong

Copy link
Copy Markdown

Stacked on #35; I'll retarget it to 1bit/hrx-vulkan-patched once #35 merges. This is our own ZAYA model code, and it's part of RFC 1bit-MONSTER/engine#213 gate 1.

What it changes. A CONT of a result that is already contiguous and not a view copies it for nothing, and every copy is a dispatch per layer on a GPU backend. cont_if_needed skips exactly those.

What it leaves alone, from measurement:

  • Views keep their CONT even when contiguous. Dropping it for the Q/K slices and the conv tap views made HRX's flash attention about 4.7× and the grouped conv matmul about 2.4× slower (strided paths). That's net of a ~1.8× throttle factor that slowed every kernel in that run.
  • The MoE router keeps its CONTs. Dropping them made every layer wait ~110 µs before the top-k gather (copy_f32 -> get_rows_small).

Checked on strixhalo (gfx1151), ZAYA1-8B Q4_K_M, HRX0:

  • Dispatches per token 3,165 -> 3,045 (copy_f32 322 -> 202). Token span in back-to-back profiles 18.66 -> 17.95 ms. No other kernel slower.
  • Bit-exact decode: greedy 6 prompts × 48 tokens identical, max |Δlogprob| 0.0000.
  • Prefill unchanged: wikitext 8 × 512 perplexity 41.9971 before and after.
  • llama-bench tg64 × 2, 6 interleaved rounds each, starting below 60 °C: median 66.42 -> 68.04 tok/s (+2.4%).

🤖 Generated with Claude Code

A CONT of a result that is already contiguous and not a view copies it for
nothing, and each copy is a dispatch per layer on a GPU backend. Views keep their
CONT even when contiguous: on HRX the consumers of a sliced or permuted view
(flash attention, the grouped conv matmul) take a much slower strided path. The
MoE router keeps its CONTs too: dropping them made every layer wait ~110 us
before the top-k gather.

ZAYA1-8B Q4_K_M on HRX0 (gfx1151), decode:
- 3,165 -> 3,045 dispatches per token (copy_f32 322 -> 202); token span
  18.66 -> 17.95 ms in back-to-back profiles, no other kernel slower.
- greedy 6 prompts x 48 tokens identical to before, max |dlogprob| 0.0000;
  wikitext 8 x 512 perplexity 41.9971 before and after (prefill unchanged).
- llama-bench tg64 x2, 6 interleaved rounds each: median 66.42 -> 68.04 tok/s.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@github-actions github-actions Bot added the model label Sep 29, 2026
@bong-water-water-bong
bong-water-water-bong changed the base branch from 1bit/hrx-res-scale-fuse to 1bit/hrx-vulkan-patched September 29, 2026 14:57
@bong-water-water-bong
bong-water-water-bong merged commit 3d75c08 into 1bit/hrx-vulkan-patched Sep 29, 2026
10 of 24 checks passed
bong-water-water-bong added a commit that referenced this pull request Oct 25, 2026
…able and lm_head (#143)

DFlash2 drafters on Hadamard-folded targets (PrismML Ternary-Bonsai-2-27B) read the shared token table and lm_head without the folds: 0 of 5271 drafts accepted. Now folded; acceptance 0.37 on code (35.7 tok/s), Qwen3.8-27B unchanged. Pairs with gpu-kernels #36.

Co-Authored-By: Claude Fable 5.1 <[email protected]>
@bong-water-water-bong
bong-water-water-bong deleted the 1bit/zaya-decode-noop-copies branch November 12, 2026 21:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant