From 9aba7baa282d2c84350ac987435d27c482eebc14 Mon Sep 17 00:00:00 2001 From: nekomario28 <206304251+nekomario28@users.noreply.github.com> Date: Fri, 9 Oct 2026 01:18:56 +0900 Subject: [PATCH] sycl: keep the null-stream sentinel a sentinel in Verifier (#1555) dpct migrated cudaStream_t ext_stream_ = nullptr to a pointer to the in-order queue, evaluated at construction on whichever device is current. Two places then misread it: init() compared ext_stream_ against the *init-time* device's in-order queue, so a stage built on one device and init'ed on another adopted the constructing device's queue (cross-context submit failures, UR_RESULT_ERROR_DEVICE_LOST); teardown's 'cs_ != ext_stream_' ownership test drifted the same way. Restore the CUDA contract: nullptr means 'no stream until set_stream()', matching include/strata/core/verify.hpp:319 and src/core/verify.cpp:604. --- sycl/include/strata/core/verify.hpp | 6 +++--- sycl/src/core/verify.cpp | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/sycl/include/strata/core/verify.hpp b/sycl/include/strata/core/verify.hpp index 2501122d..7d6de96a 100644 --- a/sycl/include/strata/core/verify.hpp +++ b/sycl/include/strata/core/verify.hpp @@ -303,9 +303,9 @@ private: void collect_profile(); ///< STRATA_VERIFY_PROFILE: add the last window's stamps to prof_sum_ void accumulate_profile(const unsigned long long* stamps); ///< one window's stamps (host copy) into prof_sum_ // pipelined windows (pl_launch ...) - dpct::queue_ptr ext_stream_ = - &dpct::get_in_order_queue(); ///< set_stream: the stage's shared stream - ///< (not destroyed here) + dpct::queue_ptr ext_stream_ = nullptr; ///< set_stream: the stage's shared stream (not destroyed here); + ///< nullptr = none until set_stream() (#1555: a queue pointer captured + ///< at construction would be the *constructing* device's) bool always_publish_ = false; void pl_stage(int T, const int32_t* tokens, int64_t pos0, const int32_t ple_prev[2]); dpct::event_ptr ev_done_ = nullptr, ev_commit_ = nullptr; diff --git a/sycl/src/core/verify.cpp b/sycl/src/core/verify.cpp index 8339b9da..9b3ffca5 100644 --- a/sycl/src/core/verify.cpp +++ b/sycl/src/core/verify.cpp @@ -602,7 +602,7 @@ bool Verifier::init(const WeightTable &wt, const ModelGeometry &g, err = "verify: copy stream create failed"; return false; } - if (ext_stream_ != &dpct::get_in_order_queue()) cs_ = + if (ext_stream_ != nullptr) cs_ = ext_stream_; // set_stream (pipelined windows): the stage's shared // stream /*