b70-optimization-lab

2026-05-06 Q4_0 allreduce + GET_ROWS fusion test

Goal

Test whether the final remaining plain decode collective, attn_output-63 -> GET_ROWS, can be fused safely and whether that improves Qwen3.6 27B Q4_0 GGUF tensor-parallel decode on 3x B70.

Patch

Added an off-by-default meta-backend/SYCL helper:

Patch artifact:

Trace result

Probe command shape:

ONEAPI_DEVICE_SELECTOR=level_zero:2,1,3 \
GGML_SYCL_DISABLE_DNN=1 \
GGML_SYCL_Q8_CACHE=1 \
GGML_SYCL_ASYNC_CPY_TENSOR=1 \
GGML_SYCL_COMM_ALLREDUCE=1 \
GGML_SYCL_COMM_SINGLE_KERNEL=1 \
GGML_SYCL_COMM_EVENT_BARRIER=1 \
GGML_META_FUSE_ALLREDUCE_ADD=1 \
GGML_META_FUSE_ALLREDUCE_GET_ROWS=1 \
GGML_META_ALLREDUCE_STATS=4 \
llama-bench -m Qwen3.6-27B-Q4_0.gguf \
  -dev SYCL0/SYCL1/SYCL2 -ngl 99 -sm tensor -ts 1/1/1 \
  -fa 1 -ub 32 -ctk f16 -ctv f16 -t 8 -p 0 -n 1 -r 1

The intended graph site was captured:

Artifacts:

Timing results, early stack

Short screen, gate on:

Full validation, gate on:

Same-build control, gate off:

Reference high-water mark before this patch:

Current-stack recheck

After the later Q8 cache, fused MMVQ2, fused MMVQ2+SwiGLU, RMS_NORM+MUL, event-barrier, and sync-after-2 stack was in place, the same GET_ROWS hook became measurable.

Configuration:

GGML_SYCL_DISABLE_DNN=1 \
GGML_SYCL_Q8_CACHE=1 \
GGML_SYCL_ASYNC_CPY_TENSOR=0 \
GGML_SYCL_ASYNC_PEER_COPY=1 \
GGML_SYCL_COMM_ALLREDUCE=1 \
GGML_SYCL_COMM_SINGLE_KERNEL=1 \
GGML_SYCL_COMM_EVENT_BARRIER=1 \
GGML_SYCL_COMM_SYNC_AFTER=2 \
GGML_META_FUSE_ALLREDUCE_ADD=1 \
GGML_SYCL_FUSE_MMVQ2=1 \
GGML_SYCL_FUSE_MMVQ2_SWIGLU=1 \
GGML_SYCL_FUSE_RMS_NORM_MUL=1 \
GGML_META_FUSE_ALLREDUCE_GET_ROWS=1 \
llama-bench -m Qwen3.6-27B-Q4_0.gguf \
  -dev SYCL2/SYCL1/SYCL3 -ngl 99 -sm tensor -ts 1/1/1 \
  -fa 1 -ub 128 -ctk f16 -ctv f16 -t 8 -p 512 -n 512 -r 5 --poll 50

Five-repeat full validation, gate on:

Five-repeat same-build control, gate off:

Short decode-only A/B:

Correctness:

LocalMaxxing:

Interpretation

The early isolated test was neutral, but after the later fused decode stack landed, GET_ROWS became a small reproducible win: about +0.576 tok/s over the same-build five-repeat gate-off control and a new Q4_0 GGUF high-water mark at 49.403656 tok/s.

Keep GGML_META_FUSE_ALLREDUCE_GET_ROWS=1 in the current best TP3 Q4_0 recipe. It is still a narrow final-logits optimization, not the broader lower-level projection epilogue we need for a large jump. Next Q4_0 work should still target fused row-parallel projection plus allreduce/residual epilogues or same-activation multi-GEMV groups.

The result is leaderboard-worthy because it was validated against a same-build control and does not change quality-affecting settings.