mirror of
https://github.com/Niko1221/Strata.git
synced 2026-12-03 19:03:30 +07:00
[PR #5161] [Engine] generate (SYCL): release draft layer buffers before exiting main #5328
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#5328
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/5161
Author: @sruggier
Created: 11/3/2026
Status: 🔄 Open
Base:
main← Head:fix-SYCL-MTP-teardown📝 Commits (1)
86f66e1generate (SYCL): release draft layer buffers before exiting main📊 Changes
5 files changed (+107 additions, -27 deletions)
View changed files
📝
docs/INTEL.md(+1 -0)📝
sycl/include/strata/core/mtp.hpp(+4 -0)📝
sycl/src/core/mtp.cpp(+33 -27)📝
sycl/src/program/generate.cpp(+6 -0)➕
sycl/tools/test_mtp_teardown.sh(+63 -0)📄 Description
I reported this in #5159. See below for model-generated answers to the PR template:
Problem and result
Problem. A one-shot
strata generaterun with the MTP drafter faults after it has finished:decode,prefillandtime to first tokenall print, thenSegmentation fault (core dumped), exit 139. The numbers are complete; the exit code is not, and nothing after the summary runs (profile write-back, clean teardown).Result after the change. The same commands exit 0.
Approach
MtpDrafter::release()hands the buffers back - the graph captures first, then the buffers, each pointer nulled as it goes so it is safe to call twice - andgenerate.cppcalls it, for the canonical drafter and for the batch slots' drafters, next to the buffers it already frees by hand before returning. The destructor callsrelease()too.This is the failure the port already names where a server closes: "Their destructors ran against a runtime already shutting down and aborted (exit 139)", dodged there with
_Exitaftergguf_src.close(). The one-shot path already freesd_next,d_logits,d_emb,d_parts,sbufandarenaby hand for the same reason - it just left the largest holder of device memory to its destructor.docs/INTEL.mdgets the one-line entry in the list of fixed bugs so the symptom is searchable.Validation
Passed (all on an Arc A770 16 GB,
i915, the environment above):v0.2.10built clean in a separate worktree, the reproducer above: 139.fix-sycl-mtp-teardownbuilt clean:--spec 4 --max-new 512twice,--spec 4 --max-new 192,--spec 3 --max-new 512,--spec 4 --max-new 64- 0, 0, 0, 0, 0.sycl/tools/test_mtp_teardown.sh(new, four arms, first arm repeated because the fault was flaky at 192 tokens and reliable at 512):PASS: 4 speculation arms generated their full reply and exited 0.sycl/tools/test_prompt_deadlock.sh:PASS: the 2,743-token prompt was read (prefill 2743 tokens in 39383.0 ms -> 69.65 tok/s).python -m pytest tests/sycl -q:15 passed.Failed: none observed after the change. Before the change, the four arms of
test_mtp_teardown.shwere the failures listed above (139 each).Not run:
sycl/(sycl/include/strata/core/mtp.hpp,sycl/src/core/mtp.cpp,sycl/src/program/generate.cpp);MtpDrafter::release()is declared in the SYCL header, where the members it frees are. No CUDA or HIP file was changed, and neither backend was built or executed here.~MtpDrafterat the end ofmain; I did not observe a fault there and have no CUDA or AMD hardware.xe-driver run, and a Battlemage card: not available on this box.Limits
main's last object is destroyed - a destructor ordering upstream could fix instead, at which pointrelease()becomes a belt-and-braces call rather than the remedy._Exitinstead of unwinding, and this change does not touch it.--spec 4 --max-new 192was 0, 0 and 139 on three runs of one build before the change, so a single clean run at some generation length is not evidence the fault is absent; that is what the repeated arm intest_mtp_teardown.shis for.🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.