Repository navigation
ggml-sycl: kernels and graph replay for audio models - #1242
Conversation
These ops are used by YuE2 and other audio models but were missing from the SYCL backend, so their graphs failed on --backend sycl. - EXPM1: unary op through the existing elementwise helpers. - ROUND_BF16: f32/f16/bf16 input with contiguous rows to contiguous f32, rounding as ggml_compute_fp32_to_bf16 does (round to nearest even, quiet NaN). - CONCAT: F16 and BF16 (BF16 when GGML_SYCL_HAS_BF16).
Each output sample only reads inputs with i*s0 <= idx < i*s0 + K. Visit that window instead of every input frame, in the same ascending order, so the result is unchanged. Assert s0 > 0, since the bound divides by it. Same change as ggml-org/llama.cpp#31109. Adds perf cases with audio codec decoder upsampling shapes to test-backend-ops.
|
@newjordan Thanks for the improvements! I found three potential correctness issues:
I reproduced these host-side contracts without Intel hardware by compiling the PR’s functions unchanged, replacing device allocation/copies and command submission with host doubles. For replay: warm up, capture the expansion’s pointer, upload new weights, then verify that replay submits the freed pointer. Both metadata-comparison and graph-UID cases fail; no-upload controls pass. Another issue from code review only: The oneDNN partition cache is shared without synchronization. A function-static Also please keeping weight caching default off and opt-in. 8.6 → 16.5 GiB peak VRAM for roughly 1.3% speedup is a substantial trade-off. It leaves less VRAM headroom for multi-model pipelines such as voice chat. A model may run successfully alone, while the combined ASR, TTS and LLM pipeline fails with OOM because cached FP16 expansions retain extra memory. |
…ed graphs Peak VRAM for YuE2 goes from 16.5 to 8.6 GiB for about 1.3% speed, so the cache is now off unless GGML_SYCL_WEIGHT_F16_CACHE=1. Asynchronous uploads drop stale expansions the same way synchronous ones do. Expansions are never handed to a queue that is recording a graph, because an upload frees them while the graph stays replayable. The per-device total is atomic.
The SDPA graph binds the mask as one dense plane. A mask wider than the active KV length, or a strided one, would be read with the wrong row stride and now takes the other kernels.
The function-static map was read and modified by independent backend instances, which races between concurrent sessions.
|
Thanks for going through this so carefully. All four were real, and they're fixed in the three commits I just pushed:
The weight cache is now off by default and needs
The SYCL validation report you asked for on #1241 is coming as a follow-up. |
|
@newjordan Thanks! Host tests passed. PR merged. |
Second of three PRs that together take YuE2 to 2.98x realtime on an Arc Pro B70, up from 1.75x with enablement alone: #1241 (backend), #1242 (this PR, ggml-sycl kernels), #1243 (YuE2). Full numbers are in #1243.
Changes to
external/ggml/src/ggml-sycland its op tests only, one commit per change. Nothing here affects other backends.RMS_NORM_MUL_VECTORbackend tests, including outputs that must not be fused away.GGML_SYCL_FA_ONEDNN=0disables it.GGML_SYCL_WEIGHT_F16_CACHE=1enables them. They live with the buffer, are dropped when it is written, and are never captured by a recorded graph.One behavior worth a reviewer's attention: graph replay is on by default here (
GGML_SYCL_DISABLE_GRAPH=1opts out), while llama.cpp defaults it off. It measured +2.3% on YuE2, andcheck_graph_compatibilitystill excludes the operators that wait on the host.The weight cache costs memory, about 2x the size of the weights it expands. When enabled, it is limited to devices with at least 20 GiB and to a third of device memory.
Measurements
Arc Pro B70, oneAPI 2026.1, YuE2 city_lights (seed 831001, 8 NAR steps,
cot=full, one warmup and 3 measured runs). These use the SYCL backend from #1241 and #1243, withyue2.perf_mode=cuda_perfon both sides, so the difference is these kernels. Both sides are built withGGML_SYCL_F16=ON.Individual controls, with the preset in #1243:
Validation
test-backend-opsas above on the B70: 2826/2826.main; details are in Add SYCL backend support #1241.Limitations
Tested on one Intel GPU, the Arc Pro B70. The fallback for GPUs without dp4a and the path for devices under 20 GiB have not been run on such hardware.