mirror of
https://github.com/Niko1221/Strata.git
synced 2026-12-03 19:03:30 +07:00
[PR #5405] [Engine] sycl: Prefill::release destroys the default in-order queue, and 349 frees use it afterwards at exit #5416
Labels
No labels
needs-format
pull-request
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
Niko1221/Strata#5416
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
📋 Pull Request Information
Original PR: https://github.com/Niko1221/Strata/pull/5405
Author: @aslater3
Created: 11/6/2026
Status: 🔄 Open
Base:
main← Head:a770/up2-queue-release📝 Commits (1)
70cb539sycl: Prefill::release must not destroy the default in-order queue📊 Changes
1 file changed (+6 additions, -2 deletions)
View changed files
📝
sycl/src/prefill/prefill.cpp(+6 -2)📄 Description
Problem and result
Prefill::Impl::kv_copystarts as&dpct::get_in_order_queue(). It only gets a queue of its own withSTRATA_KV_PREFETCH=1(default off).Prefill::release()destroys it unconditionally, so on the default path itdestroys dpct's default in-order queue.
dpct::get_in_order_queue()keeps returning that pointer afterwards, so everylater caller works on a freed queue.
On an unpatched build of 0.2.11 (its engine code is identical to
main9f7d977d), gdb shows the default queue0x8560aa0destroyed insidePrefill::release(). After that, 349sycl::freecalls pass that freed queue duringshutdown: 301 from
NativeDense, 34 fromStager, 7 fromMtpDrafter, 2 each fromPrefill::releaseandNativeHead, and 1 each fromExpertCache::close,FileExpertSource::closeandNativeEmbed. Upstream does notcrash today, because
sycl::freeonly reads the queue's context and that memory happens to still be intact.On our Arc A770 branch, which adds one wait on the default queue while the expert cache is freed at exit, this
crashed in
urQueueFinish: exit code 139 in 7 of 9 benchmark runs. gdb showed that the Level Zero queue handlePrefill::releasereleased was the oneExpertCache::closethen waited on.After this change the default queue is never destroyed, and
kv_copyis cleared after release. WithSTRATA_KV_PREFETCH=1the separate queue is still destroyed, as before.Related discussion
none (a focused fix)
Approach
Skip
destroy_queuewhenkv_copyis the default in-order queue, and setkv_copy = nullptrafterwards. Fivelines in
sycl/src/prefill/prefill.cpp. No behaviour change except at shutdown. Otherdestroy_queuecalls in theengine replace the queue with a newly created one before destroying it, so they don't have this problem.
Validation
Arc A770 16 GB (xe, Linux 7.0), oneAPI 2026.1 icpx, Ryzen 7 3800X, 30 GB RAM, no swap. Model Qwen3.8-Flash-Next
IQ1_M,
--resident-experts --expert-cache auto --max-context 131072 --kv int8 --kv-resident 20480 --spec 4 --mtp,--prefill auto, greedy, 8K-token prompt, 256 new tokens.Passed:
cmake --build build-sycl --target strata(SYCL, Release) onmain9f7d977d+ this commit: builds clean.Prefill::release,dpct::device_ext::destroy_queue,sycl::free):the trace above.
main+ this commit, 3 runs: exit 0 each time. Prompt 469.9 / 464.3 / 467.4 tok/s, generating 32.08 / 31.42 /30.87 tok/s. Same range as unpatched 0.2.11 earlier the same day (466 / 32.6).
Failed: none observed.
Not run: CUDA and HIP, because the change is in
sycl/only. Windows and i915 not tested. Same forSTRATA_KV_PREFETCH=1, whose path this change does not touch.Limits
Upstream does not crash on the default path today. Without this fix, the shutdown
sycl::freecalls listed abovestill run through a freed queue, and any future wait or submit on the default queue after
Prefill::releasewouldcrash.
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.