Pull requests / #2151

#2151 SYCL: preserve the borrowed default queue during teardown

open · @alex4o · 0 Kommentare · Auf GitHub

Server & APIMulti-GPUAMD / HIPNVIDIA / CUDAModels & quants

Beschreibung

## 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.

Mehr auf der Site

Links zu Install, Modellen, Releases.