sycl: fix SDPA executing of fattn-onednn and ggml queue not synced.#25825
Closed
hibiday wants to merge 1 commit into
Closed
sycl: fix SDPA executing of fattn-onednn and ggml queue not synced.#25825hibiday wants to merge 1 commit into
hibiday wants to merge 1 commit into
Conversation
Author
|
Closing in favor of #25741, which identifies the correct root cause (pool buffers freed at host return while the GPU is still executing).
So the order of cont_to_f16 → execute → permute was already guaranteed. Note: the ordering between cp.execute(strm, ...) and permute is only guaranteed with an in-order queue. If you use an out-of-order queue, you need to pass event dependencies explicitly (sycl_interop::execute). |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Overview
Sync the SDPA execution in fattn-onednn with the ggml SYCL queue before and after the execute call.
The dnnl stream and ggml's in-order queue are not necessarily identical.
There is no ordering guarantee between the two queues. If oneDNN reads the staging buffer before the conversion is complete, uninitialized pool memory may result in NaN values when interpreted as FP16.
When the SDPA is submitted to the dnnl stream and the permute is submitted to a separate ggml queue, the permute may observe
outfin one of the following three states:Additional information
Hardware
Software
llama.cpp build
Reproduction model
This issue might be relevant.
#25761
There is a slight (~3%) performance degradation compared to the unsynchronized path, but that path is computing garbage. The fixed XMX path is still ~15% faster than the fallback (XMX disabled).
Executed command
cf. https://gist.github.com/hibiday/16aedea5644309d951ccc15145d75f20
Command output
Requirements
While attempting to speed up Qwen3.6 with Claude Code (Fable 5), I encountered a NaN issue in llama.cpp's SYCL backend. Fable 5 identified a queue synchronization oversight as the cause and provided reference code. I myself performed the verification and the fix, auditing all the code in the Gist to ensure the problem was resolved.