From c98902a657aa7380afce7b3bbd9164d7f3da7eac Mon Sep 17 00:00:00 2001 From: Katsumi Takeuchi Date: Fri, 9 Oct 2026 10:57:42 +0900 Subject: [PATCH] sycl: MtpDrafter's queue defaults to nullptr, so a run without --mtp no longer crashes at exit dpct turned `cudaStream_t cs_ = nullptr` into `&dpct::get_in_order_queue()`: a drafter that never loads keeps it, and its destructor destroys the device's default queue (exit 139, sometimes UR_RESULT_ERROR_UNINITIALIZED, after the output). Arc Pro B70 at fb58e0d without --mtp: 3 of 3 runs crashed before, 0 of 3 after; output unchanged with and without --mtp. --- sycl/include/strata/core/mtp.hpp | 2 +- sycl/tools/fixups.py | 6 ++++++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/sycl/include/strata/core/mtp.hpp b/sycl/include/strata/core/mtp.hpp index dc515ad5..f36c0819 100644 --- a/sycl/include/strata/core/mtp.hpp +++ b/sycl/include/strata/core/mtp.hpp @@ -231,7 +231,7 @@ private: float chain_prob_[8] = {}; int64_t n_vocab_ = 0; uint64_t vram_ = 0; - dpct::queue_ptr cs_ = &dpct::get_in_order_queue(); + dpct::queue_ptr cs_ = nullptr; // load() creates it; not the device's queue, which ~MtpDrafter would destroy dpct::experimental::command_graph_exec_ptr prefill_exec_[9] = {}; dpct::experimental::command_graph_exec_ptr prefill_dev_exec_[9] = {}; int32_t* pf_dev_ = nullptr; ///< E-4: a prompt's rows' token / step / position records, uploaded at once diff --git a/sycl/tools/fixups.py b/sycl/tools/fixups.py index 3b9e00c1..053d2810 100644 --- a/sycl/tools/fixups.py +++ b/sycl/tools/fixups.py @@ -334,3 +334,9 @@ edit("src/program/generate.cpp", sub( edit("src/kernels/cuda/native_router.dp.cpp", lambda s: s.replace( " item_ct1.barrier(sycl::access::fence_space::local_space);", " sycl::group_barrier(item_ct1.get_sub_group()); // only subgroup row zero participates")) + +# MtpDrafter: CUDA's `cudaStream_t cs_ = nullptr` came out as the device's default in-order queue. A drafter that never +# loads (no --mtp) kept it, and its destructor waited on and destroyed that queue: exit 139 after the output. +edit("include/strata/core/mtp.hpp", lambda s: s.replace( + " dpct::queue_ptr cs_ = &dpct::get_in_order_queue();\n", + " dpct::queue_ptr cs_ = nullptr; // load() creates it; not the device's queue, which ~MtpDrafter would destroy\n"))