← Back to Pull requests

Vendor numba-free `distributed.protocol.rmm` for CuPy/RMM serialization #169

Closed
unknown closed this pull request without merging on Nov 25, 2026 19:09 UTC
View on GitHub
unknown unknown commented on Nov 20, 2026 13:29 UTC
Author

RAPIDS no longer depends on numba (https://github.com/NVIDIA/cudf/pull/25391), so RAPIDS wheel environments may not have it installed. distributed's lazily-registered CuPy serializers (distributed/protocol/cupy.py) import from distributed.protocol.rmm, falling back to distributed.protocol.numba, and both import numba. Serializing any cupy.ndarray or rmm.DeviceBuffer then fails with TypeError: Could not serialize object of type ndarray (caused by ModuleNotFoundError: No module named 'numba'). This breaks Dask-CUDA's CI.

Upstream uses numba in distributed/protocol/rmm.py only to copy device buffers to host (numba.cuda.as_cuda_array(f).copy_to_host()), which rmm.DeviceBuffer.copy_to_host() already does. This PR vendors distributed 2026.7.1's distributed/protocol/rmm.py with numba removed and no other changes, using the existing vendoring mechanism. It applies in every process (client, scheduler, workers) through the .pth-installed finder.

  • If rmm is not installed, importing distributed.protocol.rmm still raises ImportError as before, so the fallback in distributed.protocol.cupy is unchanged.

  • When numba is installed, nothing changes, and numba is still not imported for CuPy/RMM serialization.

  • Tests check that the vendored module is used, that it works with numba blocked, that ImportError is raised without rmm, and (with a GPU) that CuPy (contiguous and non-contiguous) and rmm.DeviceBuffer round-trip with the cuda and dask serializers without importing numba.
  • This can be removed if/when distributed no longer needs numba for RMM/CuPy serialization, e.g., https://github.com/dask/distributed/pull/9394 .

    Diff: 208 lines (+156 / -52) across 2 files Reviewer: madsbk Review duration: 7539m
    All Vouch review confidence checks passed
    Residual risk 0.14 = Change Risk (0.36) × (1 − Review Confidence (0.60)). Review depth and reviewer attention state are adequate.
    Model 1 · Change Risk (XGBoost)
    Score: 0.36 · 208 lines diff across 2 files
    0.36
    Model 2 · Review Depth (DistilBERT)
    Depth Score: 0.17 · 1 substantive comment(s)
    0.17
    Model 3 · Review Timing & Attention
    Session adequacy: 100% · Reviewer familiarity: 35%
    60%
    Bedrock Claude 3 · Risk Narration
    (disconnected)
    Groq
    Groq Risk Narration
    AWS Bedrock is currently disconnected. Generate high-confidence PR triage narration on-demand using Groq.
    Model 1 · Change Risk Attribution
    SHAP Weights
    Diff Size diff_size
    0.320
    Shallow Review Depth shallow_review_depth
    0.289
    Real PR Conversation Timeline
    1 comments
    "Review active on #169"
    general weight: 0.35
    Reviewers
    Assignees
    Unassigned
    Labels
    risk: low confidence: 60.5% reviewed
    Vouch Risk Breakdown
    AI-powered review risk analysis
    Change Risk
    Change Risk · Model 1 (XGBoost)
    Predicted defect probability (0.00–1.00) based on diff churn, modified sensitive files, and author risk history.
    Score: 36.4% (MEDIUM) · Higher = larger blast radius
    36.4%
    Review Confidence
    Review Confidence · Models 2 & 3
    Scrutiny score (0.00–1.00) combining DistilBERT semantic review depth with reviewer familiarity and session dwell time.
    Score: 60.5% · Lower = rushed or shallow review
    60.5%
    Residual Risk
    Residual Risk · Core Equation
    Residual = Change × (1 − Confidence)
    Unmitigated risk surviving review. ≥ 0.65 triggers an automated re-queue to protect production.
    Score: 14.4% · Safe to merge
    14.4%