Skip to content

vulkan: TP allreduce optimizations - #25

Closed
0cc4m wants to merge 11 commits into
pwilkin:vulkan-tp-p2pfrom
ggml-org:0cc4m/vulkan-tp-allreduce-opt
Closed

0cc4m wants to merge 11 commits into
pwilkin:vulkan-tp-p2pfrom
ggml-org:0cc4m/vulkan-tp-allreduce-opt

Conversation

@0cc4m

@0cc4m 0cc4m commented Oct 13, 2026

Copy link
Copy Markdown

I get good TP perf with 2 GPUs after this change. More GPUs is probably worse, I plan to look at that separately after the initial allreduce is merged.

Tests on 2x R9700:

tensor, fa=1, r3 new orig PR (+same submit fix) fallback layer ROCm tensor ROCm layer
Llama8B pp512 / tg128 5394 / 108.8 4250 / 79.6 1931 / 48.1 4388 / 68.7 5011 / 89.3 4950 / 64.8
Llama8B @D4096 4416 / 101.7 3817 / 75.8 1777 / 46.9 3622 / 64.1 4524 / 84.9 4013 / 60.9
Qwen27B pp512 / tg128 1612 / 45.2 1366 / 35.3 631 / 20.4 1235 / 26.9 1548 / 39.7 1225 / 26.7
Qwen27B @D4096 1416 / 44.3 1434 / 34.7 607 / 20.4 1177 / 26.4 1501 / 39.3 1170 / 26.4
MoE35B pp512 / tg128 5072 / 98.1 4623 / 92.8 2131 / 40.1 3987 / 137.5 3856 / 83.2 3360 / 83.5
MoE35B @D4096 4223 / 109.8 3780 / 94.9 1962 / 37.3 3623 / 134.0 3638 / 82.6 3179 / 83.0

(submit fix means a change to avoid splitting small graphs into multiple submissions)

pwilkin and others added 11 commits September 23, 2026 08:31
…al, wait peers + add from their slots

- One exported timeline per device, no backend hooks; comm work recorded in the backend compute ctx
- F16 wire above 1 MiB, F32 below; small reductions ride with the next graph submit
- Double-buffered, grow-only host slots; zero-size splits zeroed
- Remove ring, transfer-queue leg, device staging, shrink, Windows shims
- comm_init returns nullptr when unsupported; add GGML_VK_COMM_DISABLE
- No flops-based submit splitting for graphs below 1 GFLOP
@pwilkin pwilkin closed this Oct 23, 2026
nvwaonline added a commit to rulith-dev/llama.cpp that referenced this pull request Nov 3, 2026
…quest text (pwilkin#26), UD decode products

- llama-batch.cpp, qwen4exp.cpp: when every set of a ragged ubatch had the same count, the splitter made an ordinary
  equal-length ubatch and qwen4exp_seq_groups put the sets into one multi-sequence group, which the prompt kernels of
  the recurrent net (gated_delta_net.cu: WY, R16, tiled) do not take. Two 2048-token prompts sent together read at
  ~800 t/s against ~1,230 for 2047 + 2049. Equal counts of 16 tokens or more now stay ragged, one group a set:
  ~1,180-1,240 t/s. Decode and MTP verification sets stay below the bound and keep sharing a group.
  STRIX_RAGGED_EQUAL: the bound (0 = off).
- server-common.cpp: copies of the server's media marker in the request's message text and tools are replaced with a
  neutral <__media__> before the media parts get their markers. An agent that quoted /props in a tool result sent the
  marker back as text; mtmd_tokenize took it for an image without a bitmap and every later request of the
  conversation failed with HTTP 400 "Failed to tokenize prompt".
- mmvq.cu: on RDNA3.5, one-token products over K 352-1024 (the routed and shared experts' down projections) give a
  single-wave workgroup four rows: the Q5_1 down of UD-Q4_K_XL 4.05 -> 3.28 ms a token. MTP verifications of 2-8 tokens
  run the unfused Q5_1 / Q8_0 expert products four rows a workgroup: 9.29 -> 8.41 ms a 4-row step. Each row's sum as
  before. STRIX_MMVQ_SK, STRIX_MMVQ_MOE_R4.
- mmvf.cu: the few-rows F32 / BF16 loop up to 1024 rows (was 128): the router's BF16 product 908 -> 828 us a token on
  UD-Q4_K_XL, 713 -> 641 on EXL3 4.05, the same multiply-adds in the same order.

UD-Q4_K_XL decode about 3% less time a token, MTP verification 2%; one-conversation probes bit for bit as 0.6.10 on
UD f16, UD MTP and EXL3 4.05. Qwen3.6-35B-A3B (qwen35moe) runs on these kernels unchanged.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
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.

2 participants