e2e: speedups re-measured with flash attention off

#11
by awu12 - opened

Re-measures the e2e speedups with -fa off pinned. -fa auto selects flash attention, which is the slower path on Graviton4 for both builds, so these runs pin it off.

Agent vs stock llama.cpp, c8g.4xlarge, medians of 5 reps, pp512 / tg128:

Threads Qwen3.5-4B prefill Qwen3.5-4B decode Llama-3.1-8B prefill Llama-3.1-8B decode
1 1.510 1.100 1.568 1.099
4 1.450 1.090 1.454 1.069
16 1.373 1.094 1.391 1.102

The faon_control files repeat -fa on at 16 threads (3 reps) to check the same box reproduces the earlier numbers: prefill 1.327 for Qwen3.5-4B and 1.305 for Llama-3.1-8B.

Override hooks hit 11/11 and 7/7 kernels. Perplexity was not re-measured. Adds four files under runs/e2e-*/measurements/; nothing else changes. Host names and local paths are removed from the JSON.

Cool, is that running after bf16/fp16 input is fixed? Also have you met the problem that the agent optimized kernel assert N%8==0?

I tested this kernel set with the current code main (284729b, which includes the bf16/fp16 tensor-loader fix from #120) on a c8g.xlarge, against the dataset at a8117d1. For each of the 18 gemm_ggml_* definitions I ran every workload (104 in total) with reference-scalar, baseline-llamacpp-arm (ggml) and claude-code-claude-fable-5-1-gatev2, once with the fixed loader and once with the pre-#120 loader. Per scripts/e2e/drivers/measure5.sh (branch feat/e2e-qwen35), manifest_gatev2b holds the same 5 re-optimized + 6 original Qwen kernels as the gatev2 set here, so this covers the kernels measured in this PR. I found the following problems:

1. The loader bug hid real accuracy differences. With the pre-#120 loader, every agent kernel is within Β±0.8 dB SQNR of ggml. With the fixed loader:

Same SQNR as ggml More than 1 dB below ggml Other
Llama-3.1-8B (7) 6 0 q6_K_n1024_k4096 does not compile (point 3)
Qwen3.5-4B (11) 3 (q4_K n8192_k2560, n9216_k2560; q5_K n8192_k2560) 8, by 3.4–14.9 dB on every workload

The 8 are q4_K n1024_k2560, n2560_k4096, n2560_k9216, n4096_k2560; q5_K n2560_k4096; q6_K n1024_k2560, n248320_k2560, n2560_k9216. They quantize each activation row with a single scale, while the other 10 use ggml's per-256-block Q8_K scales and, where they compile, match ggml exactly. Two of the 8 (q4_K n4096_k2560, q5_K n2560_k4096) are gate-v2 re-optimizations: gate v2 was meant to catch per-row activation scales, but with the loader bug it never saw the real activations. This is consistent with the perplexity results (Qwen +0.6%, Llama unchanged).

2. The stored baseline_sqnr_db tags of these workloads are from the buggy loader. The tags (49.4–52.1 dB) are what ggml and reference-scalar score with the pre-#120 loader. With the fixed loader they score 30.2–56.2 dB, so on current main ggml and reference-scalar themselves pass only 1 of the 104 workloads. The tags need recalibrating; #8 does that for its workloads.

3. gemm_ggml_q6_K_n1024_k4096 (claude-code-claude-fable-5-1-gatev2) does not compile: 'svget_neonq_s32' needs target feature sve; its spec has no -march, same as the two solutions fixed in #10.

The speed numbers in this PR are not affected, since the loader only feeds the kernel-level checks. But 8 of the 11 Qwen kernels behind them do not meet the 1 dB rule on real activations.

Could you also add manifest_gatev2b.json and the Llama manifest used here to this PR, so the measured kernel set is recorded with the results?

Yes as weihua reported, we need to recalibrate affected ggml_gemm kernels on c8g as a whole. Since #8 is for reformatting gemm kernel for v2, they should not be merged before the rerun completed. On my local side I have already recalibrate all ggml_gemm kernels and I could open a new PR for that if needed

Ready to merge
This branch is ready to get merged automatically.

Sign up or log in to comment