Fix invalid device context error in ValidIfTest.ExplicitMemoryResourcesEmptyRange - #23704
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Enterprise Run ID: 📒 Files selected for processing (1)
Included review availability: Your plan includes up to 12 reviews per rolling hour; 11 remain after this review. 📝 WalkthroughSummary by CodeRabbit
WalkthroughThe empty-range memory-resource test now returns the scoped Changesvalid_if test update
Estimated code review effort: 1 (Trivial) | ~2 minutes Merge Risk: ⚪ Minimal · up to This localized test-only change removes unnecessary synchronization for an empty-range case without changing product behavior. No actionable merge-blocking risk remains, so it is merge-ready after normal checks and review. Suggested reviewers: 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Comment |
|
/merge |
Description
Fixes the BITMASK_TEST
ValidIfTest.ExplicitMemoryResourcesEmptyRangefailure when run with the cuda memory resource:The
ExplicitMemoryResourcesEmptyRangetest was callingharness.synchronize(stream)andharness.expect_no_live_allocations(stream)— both of which invokecuda::stream_ref::sync()(which uses the CUDA driver APIcuStreamSynchronize). Unlike the runtime API, the driver API requires an active CUDA context. For the empty-range case,valid_ifmakes no GPU calls at all (zero-size buffer, no kernel), so the context is never initialized, causingCUDA_ERROR_INVALID_CONTEXT (201).The fix removes both sync calls — they're unnecessary because an empty range produces no GPU work and no allocations. The existing
.total == 0counter assertions are stricter than whatexpect_no_live_allocationschecked.value == 0, so test coverage is preserved.Error introduced by #23490
Checklist