Scope binning memory resource fixture to class in Python tests#2284
Merged
rapids-bot[bot] merged 2 commits intorapidsai:mainfrom Mar 11, 2026
Merged
Scope binning memory resource fixture to class in Python tests#2284rapids-bot[bot] merged 2 commits intorapidsai:mainfrom
rapids-bot[bot] merged 2 commits intorapidsai:mainfrom
Conversation
The binning memory resource test recreates a BinningMemoryResource (with FixedSizeMemoryResource bins backed by ManagedMemoryResource) for every (dtype, nelem, alloc, upstream_mr) combination. The managed memory slab allocations make each creation take ~0.5-0.9s, totaling ~40s for 147 tests. Restructure the test into a class with a class-scoped fixture so that each BinningMemoryResource is built once per upstream_mr rather than once per test. A function-scoped autouse fixture re-sets the current device resource before each test. Times measured on an RTX 2070 Super (8 GiB) under WSL2, where managed memory operations can be particularly expensive. Binning tests drop from ~39s to ~3s; full suite drops from ~49s to ~11s.
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (1)
📝 WalkthroughSummary by CodeRabbit
WalkthroughRefactors tests for BinningMemoryResource: adds helper Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes Possibly related PRs
Suggested reviewers
🚥 Pre-merge checks | ✅ 2 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Comment |
Matt711
approved these changes
Mar 10, 2026
Co-authored-by: Matthew Murray <41342305+Matt711@users.noreply.github.com>
Collaborator
Author
|
/merge |
bdice
added a commit
to bdice/rmm
that referenced
this pull request
Mar 12, 2026
…tests Scope the FixedSizeMemoryResource fixture to the test class so the resource is created once per upstream rather than once per (dtype, nelem, alloc) combination, matching the pattern established for BinningMemoryResource in rapidsai#2284. Rework the binning test so allocations actually span multiple bins. The previous bin range (2^18-2^22) pre-allocated ~992 MiB of managed memory while test data never exceeded 1 KiB, so every allocation landed in the same bin. Shrink the auto-created range to 2^10-2^17 (1 KiB-128 KiB) so the six _BINNING_NELEMS values each route to a distinct fixed-size bin with float64. Add an explicit 128 MiB CudaMemoryResource bin and a dedicated test_binning_large_allocation that copies 128 MiB of data through it.
3 tasks
rapids-bot bot
pushed a commit
that referenced
this pull request
Mar 16, 2026
…tests (#2291) Scope the `FixedSizeMemoryResource` fixture to the test class so the resource is created once per upstream rather than once per `(dtype, nelem, alloc)` combination, matching the pattern from #2284. Rework `test_binning_memory_resource` so allocations span multiple distinct bins. The previous bin range `(2^18–2^22)` pre-allocated ~992 MiB of managed memory while test data never exceeded 1 KiB — every allocation landed in the same bin. The new range `(2^10–2^17)` creates bins from 1 KiB to 128 KiB, and each `_BINNING_NELEMS` value routes to a different fixed-size bin with `float64`. An explicit 128 MiB `CudaMemoryResource` bin and a dedicated `test_binning_large_allocation` exercise the large-allocation path. Authors: - Bradley Dice (https://github.com/bdice) Approvers: - Tom Augspurger (https://github.com/TomAugspurger) URL: #2291
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Follow-up to #2273. The binning memory resource test recreates a
BinningMemoryResource(withFixedSizeMemoryResourcebins backed byManagedMemoryResource) for every(dtype, nelem, alloc, upstream_mr)combination. The managed memory slab allocations make each creation take ~0.5–0.9s, totaling ~40s for 147 tests.Restructure the test into a class with a class-scoped fixture so that each
BinningMemoryResourceis built once perupstream_mrrather than once per test. A function-scoped autouse fixture sets the current device resource before each test.Times measured on an RTX 2070 Super (8 GiB) under WSL2, where managed memory operations can be particularly expensive. Binning tests drop from ~39s to ~3s; full suite drops from ~49s to ~11s.
Checklist