Add DMMV Q4_K and Q6_K ESIMD kernels - #25942
Conversation
Configure cmake build with -DGGML_SYCL_ESIMD=ON to enable. Signed-off-by: Todd Malsbary <todd.malsbary@intel.com>
arthw
left a comment
There was a problem hiding this comment.
I suggest adding a debug env var like GGML_SYCL_ENABLE_DNN for ESIMD.
So that we could easy to debug the new issue in the future.
| option(GGML_SYCL_HOST_MEM_FALLBACK "ggml: allow host memory fallback in SYCL reorder (requires kernel 6.8+)" ON) | ||
| option(GGML_SYCL_SUPPORT_LEVEL_ZERO_API "ggml: use Level Zero API in SYCL backend" ON) | ||
| option(GGML_SYCL_DNN "ggml: enable oneDNN in the SYCL backend" ON) | ||
| option(GGML_SYCL_ESIMD "ggml: enable ESIMD kernels in the SYCL backend" OFF) |
There was a problem hiding this comment.
Suggest setting it as ON as default
There was a problem hiding this comment.
I removed this and just use the __INTEL_LLVM_COMPILER define now to determine whether to build or not. I added GGML_SYCL_ENABLE_ESIMD env var to control on/off at runtime.
|
Very impressive performance uplift @malsbat! I'll try and test this locally sometime on my B70. EDIT: I can reproduce the performance uplift. So cool! |
Signed-off-by: Todd Malsbary <todd.malsbary@intel.com>
Signed-off-by: Todd Malsbary <todd.malsbary@intel.com>
|
Qwen3.5-4B-Q4_K_M.gguf on B60 Big perf increase with GGML_SYCL_PRIORITIZE_DMMV=1. GGML_SYCL_PRIORITIZE_DMMV=1
Qwen3.5-4B-Q4_K_M.gguf
|
|
Since ESIMD depend on GGML_SYCL_PRIORITIZE_DMMV=1. Like, |
I'm not positive we want to do this just yet. I did some quick smoke tests across some more models and with ESIMD=1,DMMV=1 for example the decode performance of Qwen3.5-9B-Q8-latest measured only 81% of ESIMD=0,DMMV=0. I suggest we wait until the rest of the kernels are supported via the ESIMD path and beat the MMVQ performance. The other alternative I can think of would be more complex logic in ggml_sycl_mul_mat to decide which one to use. |
Signed-off-by: Todd Malsbary <todd.malsbary@intel.com>
|
@arthw, I added code to use ESIMD by default when support is available regardless of the DMMV setting. This removes the regression I mentioned earlier with Qwen3.5-9B-Q8-latest I also noticed something else interesting: performance went down when DMMV is not enabled in some cases. It appears that the existing DMMV implementation, at least on B70, is better than MMVQ for some kernels (Q5_K at a minimum, I haven't investigated further). For example with both ESIMD and DMMV: With only ESIMD: Still better, but less so. Adding Q5_K to the switch in the most recent commit restored the improvement from 1.030x back to 1.075x. |
|
@malsbat Is it possible to update the above info to the guide of GGML_SYCL_ENABLE_ESIMD in SYCL.md? |
|
@arthw, I measured again with mutiple reps, I think I was just seeing measurement noise above. I'm going to mark this PR as ready for review now. I'll have the other QK kernels available soon in a separate PR. |
While not an issue in the current version, this will become an issue when additional QK ESIMD kernels are added (such as Q2_K). Signed-off-by: Todd Malsbary <todd.malsbary@intel.com>
Signed-off-by: Todd Malsbary <todd.malsbary@intel.com>
Signed-off-by: Todd Malsbary <todd.malsbary@intel.com>
arthw
left a comment
There was a problem hiding this comment.
It's good job!
ESIMD will bring surprise to all users.
Thank you!
Signed-off-by: Todd Malsbary <todd.malsbary@intel.com>
Signed-off-by: Todd Malsbary <todd.malsbary@intel.com>
|
#26251 got merged ahead of this one, so the only difference is now the removal of the copyright header. |
Overview
Using optimized ESIMD kernels with the Qwen3-14B-Q4_K_M model gives a tg performance boost (on B70) of 1.05x against MMVQ on B70 and 1.46x against DMMV. On PVC, the gains are more significant: 1.31x against MMVQ and 1.76x against DMMV.
The ESIMD kernels are based on kernels used in the archived ipex-llm project. As measured with VTune, the average kernel time dropped 25-46%, read bandwidth rose 18-53%, and SEND instructions dropped 77-87% when using the ESIMD kernels instead of the existing DMMV ones.
I'd like to get feedback on:
Additional information
Build recipe
Performance
The measurements were built using this branch, merged with aicss-genai/fattn-single-device-sync.
B70
MMVQ baseline
DMMV baseline
DMMV esimd
PVC
MMVQ baseline
DMMV baseline
DMMV esimd
Perplexity
DMMV baseline vs esimd (B70)
Requirements