Skip to content

NIXL/EP/WHEEL: pack cu in diff namespace#1727

Merged
brminich merged 3 commits into
ai-dynamo:mainfrom
ofirfarjun7:topic/fix-wheel-cu-pack
Jun 5, 2026
Merged

NIXL/EP/WHEEL: pack cu in diff namespace#1727
brminich merged 3 commits into
ai-dynamo:mainfrom
ofirfarjun7:topic/fix-wheel-cu-pack

Conversation

@ofirfarjun7
Copy link
Copy Markdown
Contributor

@ofirfarjun7 ofirfarjun7 commented Jun 3, 2026

What?

Take only CUDA related from #1646

Summary by CodeRabbit

  • New Features

    • Added intelligent CUDA-versioned backend selection for the nixl_ep Python package, automatically loading the matching CUDA backend and exposing its public APIs.
  • Chores

    • Build and packaging updated to install Python package files under CUDA-versioned subdirectories and include the nixl_ep package in the published wheel.
    • Added mypy configuration tweaks for package-base handling and improved build-stage packaging of Python sources.

@github-actions
Copy link
Copy Markdown

github-actions Bot commented Jun 3, 2026

👋 Hi ofirfarjun7! Thank you for contributing to ai-dynamo/nixl.

Your PR reviewers will review your contribution then trigger the CI to test your changes.

🚀

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented Jun 3, 2026

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro

Run ID: 4ba4464b-3afd-4b95-8a86-b0fbcbc7395e

📥 Commits

Reviewing files that changed from the base of the PR and between 94d25b7 and 97b53d2.

📒 Files selected for processing (1)
  • src/bindings/python/nixl-meta/nixl_ep/__init__.py

📝 Walkthrough

Walkthrough

Adds a nixl_ep meta-dispatcher that selects a CUDA-versioned backend at import time, updates builds to install EP extension and sources into CUDA-versioned subdirectories, and integrates nixl_ep into the nixl-meta wheel and mypy configuration.

Changes

CUDA-versioned nixl_ep Meta-dispatcher and Packaging

Layer / File(s) Summary
nixl_ep meta-dispatcher module
src/bindings/python/nixl-meta/nixl_ep/__init__.py, src/bindings/python/nixl-meta/nixl_ep/meson.build
Detects CUDA major version from torch.version.cuda, imports the matching nixl_ep_cu{major} backend (with fallback to nixl_ep_cu13/nixl_ep_cu12), registers buffer and utils submodules in sys.modules, attaches them to the nixl_ep namespace, and re-exports public symbols.
CUDA-versioned extension installation
examples/device/ep/meson.build
Defines nixl_ep_install_dir as a CUDA-versioned subdirectory, sets the extension subdir to that dir, updates a custom copy target to mkdir/copy Python sources and the built extension into the CUDA-versioned path, and installs sources into the same subdir.
Meta-wheel packaging and build integration
src/bindings/python/nixl-meta/meson.build, src/bindings/python/nixl-meta/nixl/meson.build, src/bindings/python/nixl-meta/nixl_ep/meson.build, src/bindings/python/nixl-meta/pyproject.toml.in
Adds nixl_ep traversal to the meta-wheel build, changes meta-wheel inputs to use generated build-dir copies for init/API/logging and nixl_ep init, assigns fs.copyfile results to variables for reuse, and adds nixl_ep to tool.setuptools.packages.
Type checking configuration
pyproject.toml
Adds explicit_package_bases = true under [tool.mypy] to influence mypy package-base detection for the meta-dispatcher and EP sources.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Poem

A rabbit hums by torchlight bright,
choosing cu paths in silent night,
packages hop to versioned homes,
extensions nest where CUDA roams,
a tiny stamp marks where it roamed. 🐇

🚥 Pre-merge checks | ✅ 3 | ❌ 2

❌ Failed checks (2 warnings)

Check name Status Explanation Resolution
Description check ⚠️ Warning The PR description is incomplete; it only provides 'What?' but omits the required 'Why?' and 'How?' sections entirely. Complete the description by adding a 'Why?' section explaining the motivation/justification and optionally a 'How?' section detailing the design approach for complex implementation details.
Docstring Coverage ⚠️ Warning Docstring coverage is 50.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (3 passed)
Check name Status Explanation
Title check ✅ Passed The title 'NIXL/EP/WHEEL: pack cu in diff namespace' accurately summarizes the main change: organizing CUDA-related wheels into separate namespaces based on CUDA versions.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Copy Markdown

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 2

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@src/bindings/python/nixl-meta/nixl_ep/__init__.py`:
- Around line 43-51: The loop in
src/bindings/python/nixl-meta/nixl_ep/__init__.py currently only continues
probing on ModuleNotFoundError, so ImportError/OSError from a failed extension
load blocks trying the next backend; change the try/except in the for mod_name
loop around importlib.import_module(mod_name) to handle ModuleNotFoundError
specially (re-raise if e.name != mod_name, otherwise continue) but also catch
ImportError and OSError and treat them as non-fatal (log/ignore and continue to
the next mod_name), ensuring the code will try "nixl_ep_cu12" if "nixl_ep_cu13"
fails to load at import time.
- Around line 56-73: The code is hoisting every non-underscore name from
submodules and the backend (_pkg) into the nixl_ep package, changing export
semantics; fix by mirroring the backend's declared exports instead of
indiscriminately copying all names: read export lists (use getattr(_pkg,
"__all__", None) and for each submodule use getattr(module, "__all__", None)),
build a single __all__ for nixl_ep from those declared export lists (fall back
to an explicit whitelist if neither provides __all__), and only setattr names
that appear in that computed __all__; update the loops that currently iterate
over dir(module) and dir(_pkg) to iterate over the chosen export lists and avoid
overwriting existing attributes on sys.modules[__name__].
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro

Run ID: 283cb70a-9bc4-4510-bae4-09ee15ea4bac

📥 Commits

Reviewing files that changed from the base of the PR and between 669eff6 and 94d25b7.

📒 Files selected for processing (7)
  • examples/device/ep/meson.build
  • pyproject.toml
  • src/bindings/python/nixl-meta/meson.build
  • src/bindings/python/nixl-meta/nixl/meson.build
  • src/bindings/python/nixl-meta/nixl_ep/__init__.py
  • src/bindings/python/nixl-meta/nixl_ep/meson.build
  • src/bindings/python/nixl-meta/pyproject.toml.in

Comment thread src/bindings/python/nixl-meta/nixl_ep/__init__.py Outdated
Comment thread src/bindings/python/nixl-meta/nixl_ep/__init__.py
@ofirfarjun7
Copy link
Copy Markdown
Contributor Author

/build

@ofirfarjun7
Copy link
Copy Markdown
Contributor Author

/build

@brminich brminich merged commit a748c70 into ai-dynamo:main Jun 5, 2026
16 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants