Skip to content

test(bindings): use a capped mempool in test_interop_memPool - #3011

Open
juenglin wants to merge 2 commits into
NVIDIA:mainfrom
juenglin:cython-memPool-capped-pool
Open

juenglin wants to merge 2 commits into
NVIDIA:mainfrom
juenglin:cython-memPool-capped-pool

Conversation

@juenglin

@juenglin juenglin commented Oct 2, 2026 •

Copy link
Copy Markdown
Contributor

Description

follow-on to #2381

test_interop_memPool in the cuda_bindings Cython and Python tests used the device's default memory pool. Creating the default pool reserves virtual address space of roughly twice the installed device memory, and that reservation is not returned for the lifetime of the process. On address-space-constrained systems this can fail with CUDA_ERROR_OUT_OF_MEMORY even when plenty of device memory is free, which is the failure mode described in #2381. It also follows the convention in cuda_core/tests/AGENTS.md: tests that need a pool should create a capped one.

This PR changes both tests to:

  • create a small pool (maxSize = 2 MiB) with cuMemPoolCreate
  • set it with cudaDeviceSetMemPool
  • read it back with cudaDeviceGetMemPool and assert it is the same handle, then pass it to cuDeviceSetMemPool
  • destroy the pool before destroying the context

The capped pool is set before it is queried because cuDeviceGetMemPool and cudaDeviceGetMemPool also create the default pool when no pool has been set. Running the test no longer grows the process virtual size (5 GiB before and after, measured locally on an RTX 6000 Ada).

Both tests still check the driver/runtime handle round trip. The Python test no longer needs the xfail_if_mempool_oom guard. The two *GetDefaultMemPool calls are no longer made in either test, so cuda_bindings no longer exercises them directly.

Checklist

  • New or existing tests cover these changes.
  • The documentation is up to date with these changes.

The default mempool reserves ~2x device memory of virtual address space
on first use, which cannot be satisfied in a 39-bit address space
(riscv64 Sv39) and made the test flaky. Create a 2 MiB pool instead and
set it before querying it, since the pool getters also create the
default pool.
@copy-pr-bot

copy-pr-bot Bot commented Oct 2, 2026

Copy link
Copy Markdown
Contributor

This pull request requires additional validation before any workflows can run on NVIDIA's runners.

Pull request vetters can view their responsibilities here.

Contributors can view more details about this message here.

@juenglin juenglin self-assigned this Oct 2, 2026
@github-actions github-actions Bot added the cuda.bindings Everything related to the cuda.bindings module label Oct 2, 2026
@juenglin juenglin added the test Improvements or additions to tests label Oct 2, 2026
@juenglin juenglin added this to the cuda.bindings next milestone Oct 2, 2026
@juenglin

juenglin commented Oct 2, 2026

Copy link
Copy Markdown
Contributor Author

/ok to test a8c7196

@juenglin
juenglin requested a review from rwgk October 2, 2026 21:42
@juenglin
juenglin marked this pull request as ready for review October 2, 2026 21:53
Mirror the Cython change: create a 2 MiB pool and set it before
querying it, so the test no longer creates the default pool and no
longer needs the xfail_if_mempool_oom guard.
@juenglin juenglin changed the title test(cython): use a capped mempool in test_interop_memPool test(bindings): use a capped mempool in test_interop_memPool Oct 2, 2026
@juenglin

juenglin commented Oct 2, 2026

Copy link
Copy Markdown
Contributor Author

/ok to test 870ea5d

@github-actions

github-actions Bot commented Oct 2, 2026

Copy link
Copy Markdown
Contributor

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

cuda.bindings Everything related to the cuda.bindings module test Improvements or additions to tests

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant