Skip to content

Release transient SYCL queues at the end of each test file to avoid OOM on low-memory GPUs#3001

Merged
antonwolfy merged 2 commits into
masterfrom
fix-huge-queue-leak-in-tests
Jul 16, 2026
Merged

Release transient SYCL queues at the end of each test file to avoid OOM on low-memory GPUs#3001
antonwolfy merged 2 commits into
masterfrom
fix-huge-queue-leak-in-tests

Conversation

@antonwolfy

@antonwolfy antonwolfy commented Jul 15, 2026

Copy link
Copy Markdown
Contributor

Running the full test suite in a single process steadily drains device memory and can end in a RuntimeError: ... UR_RESULT_ERROR_OUT_OF_RESOURCES (seen intermittently on a low-memory iGPU, where the kernel logs VM worker error: -12 / exec queue reset detected).

Root cause: every distinct dpctl.SyclQueue a test creates is retained for the whole session as a key in dpctl's SequentialOrderManager (the map is keyed by queue identity and only ever grows). Each retained entry holds a host-task event that pins the backing USM allocation, so the memory is never released. Over a full run the map accumulates ~300 queues
and free device memory bleeds from several GB down to ~1 GB, occasionally crossing the device limit.

This is amplified on integrated GPUs, where "device memory" is system RAM, so the leaked USM competes directly with the host and the container's memory budget.

  • 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?

Every distinct SyclQueue a test creates is retained forever as a key in
dpctl's SequentialOrderManager (keyed by queue identity), which pins its
host-task events and the backing USM memory for the whole session. Over a
full run this accumulates hundreds of queues and steadily drains device
memory, occasionally triggering out-of-resources failures on low-memory
GPU devices.

Add a pytest_runtest_teardown hook that drains and drops the order-manager
entries at each test-file boundary, keeping the footprint flat without
paying the cost after every individual test.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@antonwolfy antonwolfy added this to the 0.21.0 release milestone Jul 15, 2026
@antonwolfy antonwolfy self-assigned this Jul 15, 2026
@github-actions

github-actions Bot commented Jul 15, 2026

Copy link
Copy Markdown
Contributor

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

@antonwolfy
antonwolfy marked this pull request as ready for review July 15, 2026 12:03
@coveralls

coveralls commented Jul 15, 2026

Copy link
Copy Markdown
Collaborator

Coverage Status

coverage: 78.118% (-0.009%) from 78.127% — fix-huge-queue-leak-in-tests into master

@github-actions

github-actions Bot commented Jul 15, 2026

Copy link
Copy Markdown
Contributor

Array API standard conformance tests for dpnp=0.21.0dev3=py313h509198e_6 ran successfully.
Passed: 1372
Failed: 3
Skipped: 5

@vlad-perevezentsev vlad-perevezentsev left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

LGTM
Thank you @antonwolfy

@antonwolfy
antonwolfy merged commit 0d7ba8a into master Jul 16, 2026
76 of 83 checks passed
@antonwolfy
antonwolfy deleted the fix-huge-queue-leak-in-tests branch July 16, 2026 11:35
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