GeezerVisonThe World Wide Web, restored to 800 pixels of glory. | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Home|About|Gaming cabinet|Archives|How it works|Starter sites | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
GeezerVison is showing github.com — CPU: three upstream ggml fixes (tiled AVX2 reduce, concat row kernel, NEON fp32 to fp16) by danielhanchen · Pull Request #62 · unslothai/stable-diffusion.cpp Conversation
|
| patch | upstream | change | results |
|---|---|---|---|
0040-ggml-cpu-tiled-avx2-reduce-accumulators.patch |
#30296 (3dbcb7fca) | the AVX2 tiled K-quant / I-quant microkernel reduces its eight int32 accumulators together (hadd + permute) instead of one horizontal sum each |
bit-identical (integer additions) |
0041-ggml-cpu-concat-row-kernel.patch |
#31179 (4d71b42fd) | CPU concat as one row kernel for every type, rows split over all threads, tiles of 32 for transposed sources; adds upstream's transposed-b test-backend-ops cases |
same bytes (copies) |
0042-ggml-cpu-neon-fp32-to-fp16.patch |
#30505 (119f68d7d) | the NEON branch of simd-mappings.h defined the hardware fp32 -> fp16 conversion but never selected it, so aarch64 used the portable software conversion (im2col to F16 for VAE convs, F16 copies, F16 activations) |
same results except NaN payloads |
Why these matter for diffusion:
Base = master build, head = this branch, same flags (AVX2 + FMA + F16C, no native), Xeon Platinum 8559C, 8 pinned threads, 3 interleaved runs each. The host is shared and loaded, so timing is noisy; the bit checks are exact.
0040, mul_mat 3072 x 3072 x 1024 in the plain buffer (tiled path), FNV-1a hash over the output bits:
| type | base ms (3 runs) | head ms (3 runs) | output bits |
|---|---|---|---|
| Q3_K | 33.0 / 35.0 / 29.4 | 27.5 / 26.4 / 28.5 | identical |
| Q6_K | 35.0 / 32.4 / 32.3 | 26.0 / 29.9 / 27.2 | identical |
| Q5_K | 34.4 / 31.7 / 37.7 | 25.6 / 36.4 / 25.6 | identical |
| IQ4_XS | 32.5 / 34.0 / 38.5 | 34.2 / 30.6 / 29.5 | identical |
| IQ3_S | 33.3 / 29.9 / 31.9 | 27.2 / 43.0 / 29.4 | identical |
An earlier pass also matched Q2_K, Q4_K and IQ2_XXS bit for bit at 3072 x 3072 x 256 and 9728 x 2560 x 64. Q3_K and Q6_K are about 1.2x faster, with the run ranges not overlapping; the other types are inside the noise here.
0041, concat at 8 threads, output hashed:
| case | base ms (3 runs) | head ms (3 runs) | output bits |
|---|---|---|---|
| single-block dim 0, [3072, 4608] + [9216, 4608] F32 | 107.1 / 91.8 / 81.0 | 20.0 / 20.0 / 5.9 | identical |
| single-block dim 0, [3072, 1280] + [9216, 1280] F32 | 37.0 / 37.0 / 38.0 | 12.0 / 4.0 / 0.7 | identical |
| tokens dim 1, [3072, 512] + [3072, 4096] F32 | 27.2 / 29.1 / 27.4 | 12.0 / 8.9 / 11.0 | identical |
| VAE cache dim 2, [104, 60, 2, 384] + [104, 60, 1, 384] F32 / F16 | noise | noise | identical |
| channels dim 3, [104, 60, 1, 192] x 2 F32 | noise | noise | identical |
| tokens dim 1, transposed b | noise | noise | identical |
test-backend-ops -o CONCAT -b CPU: 226/226 passed, including the new transposed-b cases.
Staged run on GitHub runners (master vs this branch, same job, 4 threads):
mul_mat 3072 x 3072 x {128, 1024}, AVX2 (haswell) variant, output hashes identical in every cell:
| type | Xeon 8370C, 6 runs, n=1024 ms | x | EPYC 9V45, 3 runs, n=1024 ms | x |
|---|---|---|---|---|
| Q2_K | 117.7 -> 109.0 | 1.08 | 54.2 -> 48.7 | 1.11 |
| Q3_K | 102.7 -> 95.8 | 1.07 | 52.9 -> 48.6 | 1.09 |
| Q4_K (plain buffer) | 112.0 -> 100.3 | 1.12 | 50.7 -> 45.9 | 1.10 |
| Q5_K | 112.7 -> 101.0 | 1.12 | 49.9 -> 44.9 | 1.11 |
| Q6_K | 103.8 -> 96.8 | 1.07 | 50.2 -> 47.4 | 1.06 |
| IQ4_XS | 115.7 -> 104.4 | 1.11 | 58.4 -> 52.3 | 1.12 |
| IQ2_XXS | 101.9 -> 94.8 | 1.07 | 49.6 -> 47.3 | 1.05 |
The AVX-512 (zen4) variant and Neoverse N2 are unchanged (0.98-1.03x, same hashes), as expected: 0040 touches the AVX2 microkernel only. Q4_K in the repack buffer is unchanged.
test-backend-ops -o CONCAT -b CPU: 226/226 on EPYC 9V45 and on Neoverse N2 (master: 198/198, without the new cases).
0042 on Neoverse N2: CPY f32 -> f16 [512, 3072] 574.6 -> 124.9 us (4.6x); the other CPY / IM2COL cases are within 1-7%.
FLUX.2-klein-4B DiT, 512 x 512, 2 steps, s/step (3 runs each), image md5 identical master vs branch for every row:
| DiT | EPYC 7763 (AVX2) | Neoverse N2 |
|---|---|---|
| Q3_K_M | 51.7 -> 48.7 (1.06x) | 141.1 -> 140.9 |
| Q4_K_M | 54.9 -> 52.9 (1.04x) | 78.6 -> 78.4 |
| F16 | 121.9 -> 122.4 | 127.9 -> 127.6 |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
- 0031, ggml-org/llama.cpp#30296: the AVX2 tiled K-quant microkernel reduces its eight int32 accumulators together (hadd + permute) instead of one horizontal sum each. Integer additions, so bit-identical. - 0032, ggml-org/llama.cpp#31179: CPU concat as one row kernel for every type, rows split over all threads. The old kernel split over dim 2 only, so the FLUX single-block concat (ne2 == 1) ran on one thread. Same bytes. - 0033, ggml-org/llama.cpp#30505: select the NEON fp32 -> fp16 conversion the NEON branch already defined (aarch64 used the portable software conversion). Same results except NaN payloads. All three cherry-picked as patches on the pinned ggml (no submodule bump).
There was an error while loading. Please reload this page.
Codex Review Summary: ✅ CompletedThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
Codex Review: Didn't find any major issues. More of your lovely PRs please. Reviewed commit: ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. Codex can also answer questions or update the PR. Try commenting "@codex address that feedback". |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
0031-0033 are also used by other open PRs (HIP / Vulkan patches).
|
Codex Review: Didn't find any major issues. Already looking forward to the next diff. Reviewed commit: ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. Codex can also answer questions or update the PR. Try commenting "@codex address that feedback". |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
Successfully merging this pull request may close these issues.
There was an error while loading. Please reload this page.