From 4a66249803f7072f5c4a080d009754546d2d1ae0 Mon Sep 17 00:00:00 2001 From: Vladislav Perevezentsev Date: Thu, 23 Apr 2026 03:05:12 -0700 Subject: [PATCH 1/2] Fix RNG crash on Windows --- dpnp/backend/src/queue_sycl.hpp | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/dpnp/backend/src/queue_sycl.hpp b/dpnp/backend/src/queue_sycl.hpp index 6100a03c872a..08ac927829de 100644 --- a/dpnp/backend/src/queue_sycl.hpp +++ b/dpnp/backend/src/queue_sycl.hpp @@ -67,8 +67,17 @@ class backend_sycl static backend_sycl &get() { +#ifdef _WIN32 + // TODO: remove once MKLD-19835 is resolved + // mt19937 (oneMKL 2026.0) destructor crashes during DLL_PROCESS_DETACH + // on Windows (Battlemage/Level Zero). Use a heap-allocated + // process-lifetime singleton to skip destructor; OS reclaims memory. + static backend_sycl *backend = new backend_sycl{}; + return *backend; +#else static backend_sycl backend{}; return backend; +#endif } static sycl::queue &get_queue() From 730ac820ea8f76efbaef3d84dcdbfd1480c996be Mon Sep 17 00:00:00 2001 From: Vladislav Perevezentsev Date: Thu, 23 Apr 2026 06:13:31 -0700 Subject: [PATCH 2/2] Add MKL version check to RNG crash workaround --- dpnp/backend/src/queue_sycl.hpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dpnp/backend/src/queue_sycl.hpp b/dpnp/backend/src/queue_sycl.hpp index 08ac927829de..3c41401ad62f 100644 --- a/dpnp/backend/src/queue_sycl.hpp +++ b/dpnp/backend/src/queue_sycl.hpp @@ -67,7 +67,7 @@ class backend_sycl static backend_sycl &get() { -#ifdef _WIN32 +#if defined(_WIN32) && INTEL_MKL_VERSION == 20260000 // TODO: remove once MKLD-19835 is resolved // mt19937 (oneMKL 2026.0) destructor crashes during DLL_PROCESS_DETACH // on Windows (Battlemage/Level Zero). Use a heap-allocated