[PR #2151] [CLOSED] SYCL: preserve the borrowed default queue during teardown #3885

Closed
opened 2026-11-07 15:31:26 +07:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/Niko1221/Strata/pull/2151
Author: @alex4o
Created: 10/12/2026
Status: ❌ Closed

Base: main ← Head: fix/sycl-owned-queue-teardown


📝 Commits (1)

  • 6f99145 sycl: preserve the borrowed default queue during teardown

📊 Changes

4 files changed (+89 additions, -6 deletions)

View changed files

📝 sycl/CMakeLists.txt (+4 -0)
📝 sycl/include/strata/core/mtp.hpp (+2 -3)
➕ sycl/probe/teardown_queue_test.cpp (+80 -0)
📝 sycl/src/prefill/prefill.cpp (+3 -3)

📄 Description

Summary

Do not initialize uncreated, owned SYCL queue handles with DPCT's borrowed default queue. Otherwise teardown can delete that queue and leave DPCT's default-queue pointer dangling.

Related: #1555 (the same null-sentinel migration trap; this patch targets Prefill/MtpDrafter rather than Verifier).

What changed

  • Initialize Prefill::Impl::copy and kv_copy to nullptr until their creation paths run.
  • Initialize MtpDrafter::side_ to nullptr until load() creates its owned queue.
  • Keep borrowed Prefill::Impl::cs pointing to the default queue; do not change its ownership.
  • Add sycl_teardown_queue_test under STRATA_SYCL_PARITY, with a 30-second timeout.

The existing guarded cleanup still destroys genuinely owned queues. This does not skip cleanup, change inference arithmetic, or use _Exit to hide errors.

Failure and regression

A non-serve A770 run completed a long generation, then exited with SIGSEGV. A core inspected with matching oneAPI libraries showed:

sycl::detail::usm::free
sycl::free
strata::core::MtpDrafter::~MtpDrafter
main

Prefill had already destroyed kv_copy even with KV prefetch disabled, because its initializer made it alias the default queue. MTP's later weight free then used that dangling queue. An unloaded/failed-load MTP object had the analogous side_ ownership problem.

The model-free GPU regression retains a live USM allocation across unloaded MTP, rejected MTP load, uninitialized prefill, repeated reset, and rejected prefill initialization. It checks default-queue identity/context/device, allocation contents, and a subsequent free. Five scenarios × eight repetitions = 40 lifecycles.

Validation

On PR base a0116b2, A770/i915, oneAPI 2026.1:

cmake --build <build> --target strata sycl_teardown_queue_test
ctest --test-dir <build> -R '^sycl_teardown_queue_test$' --output-on-failure

Both full engine build and regression passed. The same regression compiled against unfixed headers/libraries fails at unloaded MTP with UR_RESULT_ERROR_UNINITIALIZED; with this patch all 40 lifecycles pass.

Earlier isolated experiments on base 61b3fb5 applied these same ownership fixes and completed four full-context CLI runs with normal exit 0, after the original teardown crash. These runs also included separate diagnostic/GRF changes, so they supplement—not replace—the focused regression. Validation notes.

Limits

With STRATA_KV_PREFETCH=1, nullptr now allows the intended dedicated queue to be created where the old nonnull initializer suppressed creation. That opt-in asynchronous path was reviewed but not runtime-tested. Peer/multi-GPU teardown and other similar migrated sentinels are outside this focused patch. Only SYCL files are touched; CUDA/HIP were not changed.


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/Niko1221/Strata/pull/2151 **Author:** [@alex4o](https://github.com/alex4o) **Created:** 10/12/2026 **Status:** ❌ Closed **Base:** `main` ← **Head:** `fix/sycl-owned-queue-teardown` --- ### 📝 Commits (1) - [`6f99145`](https://github.com/Niko1221/Strata/commit/6f991454bb5fc7e92c6fac3b45cf7424545aab6c) sycl: preserve the borrowed default queue during teardown ### 📊 Changes **4 files changed** (+89 additions, -6 deletions) <details> <summary>View changed files</summary> 📝 `sycl/CMakeLists.txt` (+4 -0) 📝 `sycl/include/strata/core/mtp.hpp` (+2 -3) ➕ `sycl/probe/teardown_queue_test.cpp` (+80 -0) 📝 `sycl/src/prefill/prefill.cpp` (+3 -3) </details> ### 📄 Description ## Summary Do not initialize uncreated, owned SYCL queue handles with DPCT's borrowed default queue. Otherwise teardown can delete that queue and leave DPCT's default-queue pointer dangling. Related: #1555 (the same null-sentinel migration trap; this patch targets Prefill/MtpDrafter rather than Verifier). ## What changed - Initialize Prefill::Impl::copy and kv_copy to nullptr until their creation paths run. - Initialize MtpDrafter::side_ to nullptr until load() creates its owned queue. - Keep borrowed Prefill::Impl::cs pointing to the default queue; do not change its ownership. - Add sycl_teardown_queue_test under STRATA_SYCL_PARITY, with a 30-second timeout. The existing guarded cleanup still destroys genuinely owned queues. This does not skip cleanup, change inference arithmetic, or use _Exit to hide errors. ## Failure and regression A non-serve A770 run completed a long generation, then exited with SIGSEGV. A core inspected with matching oneAPI libraries showed: sycl::detail::usm::free sycl::free strata::core::MtpDrafter::~MtpDrafter main Prefill had already destroyed kv_copy even with KV prefetch disabled, because its initializer made it alias the default queue. MTP's later weight free then used that dangling queue. An unloaded/failed-load MTP object had the analogous side_ ownership problem. The model-free GPU regression retains a live USM allocation across unloaded MTP, rejected MTP load, uninitialized prefill, repeated reset, and rejected prefill initialization. It checks default-queue identity/context/device, allocation contents, and a subsequent free. Five scenarios × eight repetitions = 40 lifecycles. ## Validation On PR base a0116b2, A770/i915, oneAPI 2026.1: cmake --build <build> --target strata sycl_teardown_queue_test ctest --test-dir <build> -R '^sycl_teardown_queue_test$' --output-on-failure Both full engine build and regression passed. The same regression compiled against unfixed headers/libraries fails at unloaded MTP with UR_RESULT_ERROR_UNINITIALIZED; with this patch all 40 lifecycles pass. Earlier isolated experiments on base 61b3fb5 applied these same ownership fixes and completed four full-context CLI runs with normal exit 0, after the original teardown crash. These runs also included separate diagnostic/GRF changes, so they supplement—not replace—the focused regression. [Validation notes](https://gist.github.com/alex4o/6f5912c82d67393fe5ca3aac26ff5b63). ## Limits With STRATA_KV_PREFETCH=1, nullptr now allows the intended dedicated queue to be created where the old nonnull initializer suppressed creation. That opt-in asynchronous path was reviewed but not runtime-tested. Peer/multi-GPU teardown and other similar migrated sentinels are outside this focused patch. Only SYCL files are touched; CUDA/HIP were not changed. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-11-07 15:31:26 +07:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
Niko1221/Strata#3885
No description provided.