Skip to content

[GG] chore(b12x): port integration to renamed package - #246

Closed
voipmonitor wants to merge 3 commits into
local-inference-lab:dev/gilded-gnosisfrom
voipmonitor:chore/gg-b12x-package-rename-20260807
Closed

[GG] chore(b12x): port integration to renamed package#246
voipmonitor wants to merge 3 commits into
local-inference-lab:dev/gilded-gnosisfrom
voipmonitor:chore/gg-b12x-package-rename-20260807

Conversation

@voipmonitor

@voipmonitor voipmonitor commented Aug 7, 2026

Copy link
Copy Markdown

Summary

B12X 1.1.0 renamed its Python package from sparkinfer back to b12x and moved its public environment prefix from SPARKINFER_ to B12X_. Port the GG runtime and tests to that API so a clean composition with current local-inference-lab/b12x boots without a compatibility alias or source overlay.

The change is deliberately mechanical:

  • update runtime imports and dynamic module paths to b12x.*;
  • update B12X-owned environment names to B12X_*;
  • update existing mocks and GPU tests to exercise the renamed package;
  • add a source-contract test that prevents legacy runtime imports or env prefixes from returning.

This PR does not change algorithms, launch policy, tensor layouts, or numerical behavior.

Paired ownership

Two functional PRs replace files too extensively for a duplicate mechanical edit here:

The release composition applies those PRs explicitly and performs a final source scan across both vllm/ and tests/. This keeps ownership visible while guaranteeing that the composed image contains no active sparkinfer.* import or SPARKINFER_* runtime setting.

Validation

Tested against current B12X master plus PR #125 in the CUDA 13.2 release environment:

  • Ruff and git diff --check;
  • package source-contract test;
  • 50 EXL3/MXFP8/linear API tests;
  • 44 sparse-indexer and B12X MoE warmup tests;
  • 5 MLA query-projection API tests;
  • renamed sparse-MLA scratch/capacity cases on SM120;
  • composed GG source scan: no legacy package references in runtime or tests.

Multi-GPU channel and DSpark concurrency validation is performed on the full declared release composition.

@coderabbitai

coderabbitai Bot commented Aug 7, 2026

Copy link
Copy Markdown

Review Change Stack

📝 Walkthrough

Walkthrough

The change replaces legacy SparkInfer package references with B12X references across runtime integrations, distributed paths, diagnostics, tests, mocks, optional-dependency checks, and environment markers. A contract test rejects remaining legacy runtime references.

Changes

B12X runtime integration

Layer / File(s) Summary
Kernel, attention, MoE, quantization, and model integrations
vllm/compilation/..., vllm/model_executor/..., vllm/models/..., vllm/v1/attention/...
Runtime imports, custom operators, capability checks, and error messages now use B12X namespaces.
Distributed and engine lifecycle references
vllm/distributed/..., vllm/envs.py, vllm/v1/attention/ops/..., vllm/v1/worker/...
PCIe, DCP, graph-channel, environment, and worker references now identify B12X.
Test namespace alignment
tests/...
Tests, mocks, fixtures, optional-dependency checks, expected errors, and the runtime contract test now target B12X.

Estimated code review effort: 2 (Simple) | ~15 minutes

Possibly related PRs

Suggested reviewers: lukealonso

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 22.81% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
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.
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly and concisely describes the B12X package rename integration port covered by the changes.
✨ 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.

Signed-off-by: Martin Vit <martin@voipmonitor.org>

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Actionable comments posted: 3

🤖 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 `@tests/test_b12x_package_contract.py`:
- Around line 6-11: Update the legacy_markers check in the test to match the
standalone package token “sparkinfer” as well as the existing “SPARKINFER_”
marker, so root imports such as import sparkinfer and from sparkinfer import ...
are detected while preserving the current uppercase check.

In `@vllm/model_executor/layers/fused_moe/b12x_moe.py`:
- Around line 406-407: Update the dependency declaration for B12X used by the
imports TPMoEScratchCaps and plan_tp_moe_scratch to pin an available artifact
that actually exposes b12x.moe.fused_moe and its private paths. Remove the
unavailable 1.1.0/source assumption and ensure production installation resolves
the intended package version.

In `@vllm/v1/attention/ops/dcp_alltoall.py`:
- Line 200: Update the checkpoint function docstring beginning “Snapshot B12X
DCP pools before a disposable graph capture” to add Google-style Args and
Returns sections, documenting the cp_group parameter and the returned tuple,
while preserving the existing summary text.
🪄 Autofix

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: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: bb541ab0-2c61-4843-b551-da136dac6920

📥 Commits

Reviewing files that changed from the base of the PR and between 3003860 and 02a51a6.

📒 Files selected for processing (38)
  • tests/distributed/test_b12x_fused_all_reduce.py
  • tests/model_executor/kernels/test_b12x_mxfp8_linear.py
  • tests/model_executor/layers/test_b12x_moe_warmup.py
  • tests/model_executor/layers/test_sparse_attn_indexer_b12x.py
  • tests/quantization/test_exl3.py
  • tests/quantization/test_exl3_prefill_plan.py
  • tests/test_b12x_package_contract.py
  • tests/v1/attention/test_b12x_mla_fp8_rope_writer.py
  • tests/v1/attention/test_mla_backends.py
  • tests/v1/attention/test_sparse_mla_backends.py
  • vllm/compilation/b12x_capture.py
  • vllm/distributed/device_communicators/custom_all_reduce.py
  • vllm/distributed/parallel_state.py
  • vllm/envs.py
  • vllm/model_executor/kernels/attention/b12x_mxfp8_bmm.py
  • vllm/model_executor/kernels/linear/mxfp4/b12x.py
  • vllm/model_executor/kernels/linear/mxfp8/b12x.py
  • vllm/model_executor/kernels/linear/nvfp4/b12x.py
  • vllm/model_executor/kernels/linear/scaled_mm/b12x.py
  • vllm/model_executor/kernels/linear/scaled_mm/b12x_tensor.py
  • vllm/model_executor/layers/attention/mla_attention.py
  • vllm/model_executor/layers/fused_moe/b12x_ep_moe.py
  • vllm/model_executor/layers/fused_moe/b12x_moe.py
  • vllm/model_executor/layers/quantization/exl3.py
  • vllm/model_executor/layers/quantization/nvfp4_nf3_hybrid.py
  • vllm/model_executor/layers/sparse_attn_indexer.py
  • vllm/model_executor/warmup/b12x_sparse_indexer_warmup.py
  • vllm/models/deepseek_v4/attention.py
  • vllm/models/deepseek_v4/nvidia/b12x.py
  • vllm/models/deepseek_v4/nvidia/model.py
  • vllm/models/deepseek_v4/nvidia/mtp.py
  • vllm/models/minimax_m3/nvidia/sparse_attention_b12x.py
  • vllm/v1/attention/backends/b12x_attn.py
  • vllm/v1/attention/backends/mla/b12x_mla_sparse.py
  • vllm/v1/attention/backends/mla/indexer.py
  • vllm/v1/attention/ops/dcp_alltoall.py
  • vllm/v1/worker/gpu/model_runner.py
  • vllm/v1/worker/gpu_worker.py

Comment on lines +6 to +11
legacy_markers = ("sparkinfer.", "SPARKINFER_")
offenders: list[str] = []

for source in runtime_root.rglob("*.py"):
text = source.read_text(encoding="utf-8")
if any(marker in text for marker in legacy_markers):

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win

Match the legacy package name, not only dotted submodules.

"sparkinfer." does not match import sparkinfer or from sparkinfer import .... A legacy root-package import can therefore remain in vllm without failing this contract test. Match sparkinfer as a package token while preserving the SPARKINFER_ check.

Proposed fix
+import re
 from pathlib import Path
...
-    legacy_markers = ("sparkinfer.", "SPARKINFER_")
+    legacy_package = re.compile(
+        r"(?<![A-Za-z0-9_])sparkinfer(?:\b|\.)"
+    )
...
-        if any(marker in text for marker in legacy_markers):
+        if legacy_package.search(text) or "SPARKINFER_" in text:
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
legacy_markers = ("sparkinfer.", "SPARKINFER_")
offenders: list[str] = []
for source in runtime_root.rglob("*.py"):
text = source.read_text(encoding="utf-8")
if any(marker in text for marker in legacy_markers):
legacy_package = re.compile(
r"(?<![A-Za-z0-9_])sparkinfer(?:\b|\.)"
)
offenders: list[str] = []
for source in runtime_root.rglob("*.py"):
text = source.read_text(encoding="utf-8")
if legacy_package.search(text) or "SPARKINFER_" in text:
🤖 Prompt for 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.

In `@tests/test_b12x_package_contract.py` around lines 6 - 11, Update the
legacy_markers check in the test to match the standalone package token
“sparkinfer” as well as the existing “SPARKINFER_” marker, so root imports such
as import sparkinfer and from sparkinfer import ... are detected while
preserving the current uppercase check.

Comment on lines +406 to +407
from b12x.moe.fused_moe import Caps as TPMoEScratchCaps
from b12x.moe.fused_moe import plan as plan_tp_moe_scratch

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🩺 Stability & Availability | 🟠 Major | ⚡ Quick win

🧩 Analysis chain

🏁 Script executed:

#!/usr/bin/env bash
set -euo pipefail

python - <<'PY'
from importlib import import_module
from importlib.metadata import version

expected_version = "1.1.0"
actual_version = version("b12x")
if actual_version != expected_version:
    raise SystemExit(
        f"expected b12x=={expected_version}, found {actual_version}"
    )

exports = {
    "b12x.moe.ep_moe": ("Caps", "plan", "run", "prepare_expert_map"),
    "b12x.moe.fused_moe": (
        "Caps",
        "plan",
        "plan_execution",
        "run",
        "plan_weights",
        "prepare_weights",
    ),
    "b12x.moe._shared.execution": ("PreparedWeightLayout",),
    "b12x.attention.compressed_mla": (
        "Caps",
        "plan",
        "run",
        "split_chunks_for_contract",
    ),
    "b12x.norm.mhc": (
        "DEFAULT_BLOCK_K",
        "MULT",
        "Caps",
        "plan",
        "run_pre",
        "run_post_pre",
        "run_post",
    ),
    "b12x.norm.mhc._impl": (
        "MHC_GRAM_BLOCK_H",
        "MHC_SOURCE_TILE_H",
        "MHC_SUPPORTED_HIDDEN_SIZES",
    ),
    "b12x.attention.paged": (
        "Caps",
        "compile",
        "decode_graph_capacity",
        "decode_graph_scratch_envelope",
        "extend_graph_capacity",
        "plan",
        "run",
        "verify_graph_capacity",
    ),
    "b12x.attention.varlen": ("create_plan", "plan", "run"),
    "b12x.attention.nsa_indexer": (
        "plan_paged_schedule",
        "uses_paged_schedule",
    ),
    "b12x.comm.pcie": ("OneshotAllReducePool", "DmaAllReduce"),
}

for module_name, names in exports.items():
    module = import_module(module_name)
    missing = [name for name in names if not hasattr(module, name)]
    if missing:
        raise SystemExit(f"{module_name} is missing: {missing}")

print("B12X export checks passed")
PY

Repository: local-inference-lab/vllm

Length of output: 1099


🌐 Web query:

pypi b12x package versions

💡 Result:

The b12x package is a specialized Python library containing CuTe DSL kernels designed for NVFP4 LLM inference on SM120/SM121 GPU architectures (such as Blackwell-based hardware) [1][2]. The package is available on PyPI, with version 0.30.2 being the most recent version identified [1]. It is important to note that the repository formerly associated with the b12x project has been renamed or superseded by sparkinfer [3]. While the b12x package remains available on PyPI, users should be aware that the active development and evolution of the underlying technology have transitioned to the sparkinfer package [3]. Key details: - Repository/Source: Originally hosted under lukealonso/b12x, now associated with local-inference-lab/sparkinfer [4][3]. - Purpose: Provides a focused set of high-performance kernels (NVFP4 fused MoE GEMM, dense GEMM, paged attention, etc.) for integration with frameworks like sglang and vllm [5][2]. - Dependencies: Requires Python 3.10+, torch >= 2.12, and compatible SM120/SM121 hardware [1][3]. - Installation: Can be installed via pip, though users may need to check if their specific use case is better served by the current sparkinfer package [1][3].

Citations:


Pin the B12X dependency to an available artifact that exposes the imported symbols.

Public PyPI only reaches b12x==0.30.2; b12x.moe.fused_moe, the private B12X paths, and a 1.1.0 artifact are not available from that release. Resolve this to the intended package version/source before relying on these imports in production.

🤖 Prompt for 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.

In `@vllm/model_executor/layers/fused_moe/b12x_moe.py` around lines 406 - 407,
Update the dependency declaration for B12X used by the imports TPMoEScratchCaps
and plan_tp_moe_scratch to pin an available artifact that actually exposes
b12x.moe.fused_moe and its private paths. Remove the unavailable 1.1.0/source
assumption and ensure production installation resolves the intended package
version.

cp_group: GroupCoordinator,
) -> tuple[int, dict[Any, tuple[Any, Any]]]:
"""Snapshot SparkInfer DCP pools before a disposable graph capture."""
"""Snapshot B12X DCP pools before a disposable graph capture."""

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

📐 Maintainability & Code Quality | 🟡 Minor | ⚡ Quick win

Add Google-style sections to the checkpoint docstring.

Line [200] documents a function with a cp_group argument and a tuple return value, but it has no Args: or Returns: section. Add both sections.

Proposed docstring
 def checkpoint_b12x_dcp_a2a_channels(
     cp_group: GroupCoordinator,
 ) -> tuple[int, dict[Any, tuple[Any, Any]]]:
-    """Snapshot B12X DCP pools before a disposable graph capture."""
+    """Snapshot B12X DCP pools before a disposable graph capture.
+
+    Args:
+        cp_group: DCP group whose registered pools are checkpointed.
+
+    Returns:
+        Group ID and per-pool channel checkpoints.
+    """

As per coding guidelines, Python docstrings must use Google-style Args:/Returns:/Raises: sections instead of reStructuredText/Sphinx fields.

📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
"""Snapshot B12X DCP pools before a disposable graph capture."""
def checkpoint_b12x_dcp_a2a_channels(
cp_group: GroupCoordinator,
) -> tuple[int, dict[Any, tuple[Any, Any]]]:
"""Snapshot B12X DCP pools before a disposable graph capture.
Args:
cp_group: DCP group whose registered pools are checkpointed.
Returns:
Group ID and per-pool channel checkpoints.
"""
🤖 Prompt for 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.

In `@vllm/v1/attention/ops/dcp_alltoall.py` at line 200, Update the checkpoint
function docstring beginning “Snapshot B12X DCP pools before a disposable graph
capture” to add Google-style Args and Returns sections, documenting the cp_group
parameter and the returned tuple, while preserving the existing summary text.

Source: Coding guidelines

Signed-off-by: Martin Vit <martin@voipmonitor.org>
@voipmonitor

Copy link
Copy Markdown
Author

Superseded by dev/gilded-gnosis commit e2666d9 (refactor: complete b12x rename). The r30 clean composer now starts from that GG head and intentionally omits this duplicate mechanical rename.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant