Skip to content

Fix RNG crash on Windows #2871

Open
vlad-perevezentsev wants to merge 2 commits intomasterfrom
fix_rng_crash_windows
Open

Fix RNG crash on Windows #2871
vlad-perevezentsev wants to merge 2 commits intomasterfrom
fix_rng_crash_windows

Conversation

@vlad-perevezentsev
Copy link
Copy Markdown
Contributor

This PR adds a Windows workaround for a crash on Battlemage during test runs.

In oneMKL 2026.0 mkl_rng::mt19937 destructor may crash with STATUS_STACK_BUFFER_OVERRUN during DLL_PROCESS_DETACH when using the Level Zero backend and static storage inside a DLL.

The workaround heap-allocates backend_sycl singleton on Windows to avoid running its destructor at shutdown. Although ~backend_sycl() is empty, it triggers destruction of its members (including mkl_rng::mt19937) which causes the crash.
Since backend_sycl is a process-lifetime singleton, skipping its destruction is safe because OS reclaims all
resources at process exit.

  • Have you provided a meaningful PR description?
  • Have you added a test, reproducer or referred to an issue with a reproducer?
  • Have you tested your changes locally for CPU and GPU devices?
  • Have you made sure that new changes do not introduce compiler warnings?
  • Have you checked performance impact of proposed changes?
  • Have you added documentation for your changes, if necessary?
  • Have you added your changes to the changelog?

@github-actions
Copy link
Copy Markdown
Contributor

View rendered docs @ https://intelpython.github.io/dpnp/pull/2871/index.html

Comment thread dpnp/backend/src/queue_sycl.hpp Outdated
@coveralls
Copy link
Copy Markdown
Collaborator

coveralls commented Apr 23, 2026

Coverage Status

coverage: 78.298% (+0.003%) from 78.295% — fix_rng_crash_windows into master

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Apr 23, 2026

Array API standard conformance tests for dpnp=0.20.0dev6=py313h509198e_19 ran successfully.
Passed: 1356
Failed: 4
Skipped: 16

Copy link
Copy Markdown
Contributor

@antonwolfy antonwolfy left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@antonwolfy antonwolfy added this to the 0.21.0 release milestone Apr 23, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants