← Back to Pull requests

common: move the LIBFABRIC post thread pool to src/utils/common #2745

Open
unknown opened this pull request with 290 lines diff across 3 files
View on GitHub
unknown unknown commented on Nov 23, 2026 23:01 UTC
Author

Part of #2498. Split out of #2695, as asked in its review, so that it lands on its own; #2695 stacks on it.

What?


  • nixl::threadPool in src/utils/common/thread_pool.h is nixlLibfabricPostThreadPool made generic:

  • - a fire-and-forget submit(std::function<void()>);
    - tasks queued before destruction still run;
    - an exception-safe constructor;
    - it stays on std::thread, clear of the Mooncake Transfer Engine's libasio.so (#2588).
  • LIBFABRIC's cap of four threads per hardware thread moves into the pool, so other backends get it too.

  • LIBFABRIC uses the pool with no other change. post_thread_count_ is taken from the pool, so it still reflects the cap.

  • A gtest checks that queued tasks run before destruction.
  • Why?


    In #2499's review, tvegas1 asked to share one pool between LIBFABRIC and MOONCAKE (r4567484179). MOONCAKE switches to it in #2695.

    Behavior changes


  • The warning when num_threads is over the cap now reads Capping thread pool from N to M threads. It used to read Capping libfabric post thread count from N to M.
  • Testing


    On a GB200 host without EFA, using libfabric 1.22.0 with the tcp provider:
  • *gtest threadPoolTest.: passes.

  • libfabric_backend_test: passes.

  • Two-agent harness (local only): writes 4,096 × 64 B descriptors 20 times and checks every byte. Passes with num_threads 0 and 4. With num_threads=100000 the pool caps at 560 threads (4 × 140) with the warning above.

  • Checks:* clang-format 19 on the changed lines is clean.
  • AI assistance: Claude Code wrote this change and its test, and ran the builds and tests.

    🤖 Generated with Claude Code

    <!-- This is an auto-generated comment: release notes by coderabbit.ai -->

    <!-- coderabbit-ai-generated:v1 -->

    Summary by CodeRabbit

    Improvements
    Descriptor posting in the Libfabric backend now uses a shared worker pool, with the effective worker count adjusted to supported limits.
    Task processing continues during orderly shutdown, helping ensure queued work is completed.
    Tests
    Added coverage verifying that submitted tasks complete when the worker pool shuts down.

    <!-- end of auto-generated comment: release notes by coderabbit.ai -->

    Diff: 290 lines (+217 / -73) across 3 files Reviewer: tvegas1 Review duration: 10011m
    All Vouch review confidence checks passed
    Residual risk 0.23 = Change Risk (0.40) × (1 − Review Confidence (0.43)). Review depth and reviewer attention state are adequate.
    Model 1 · Change Risk (XGBoost)
    Score: 0.40 · 290 lines diff across 3 files
    0.40
    Model 2 · Review Depth (DistilBERT)
    Depth Score: 0.02 · 1 substantive comment(s)
    0.02
    Model 3 · Review Timing & Attention
    Session adequacy: 100% · Reviewer familiarity: 35%
    42%
    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
    Shallow Review Depth shallow_review_depth
    0.344
    Diff Size diff_size
    0.339
    Real PR Conversation Timeline
    1 comments
    "Review active on #2745"
    general weight: 0.35
    Reviewers
    Assignees
    Unassigned
    Labels
    risk: low confidence: 43.0% 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: 39.9% (MEDIUM) · Higher = larger blast radius
    39.9%
    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: 43.0% · Lower = rushed or shallow review
    43.0%
    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: 22.7% · Safe to merge
    22.7%
    Repository