Skip to content

fix(collector): reject non-divisible DSV4 head geometry - #1611

Open
git-jxj wants to merge 1 commit into
ai-dynamo:mainfrom
git-jxj:git-jxj/fix-dsv4-head-divisibility
Open

fix(collector): reject non-divisible DSV4 head geometry#1611
git-jxj wants to merge 1 commit into
ai-dynamo:mainfrom
git-jxj:git-jxj/fix-dsv4-head-divisibility

Conversation

@git-jxj

@git-jxj git-jxj commented Sep 10, 2026

Copy link
Copy Markdown

AIC transition scope:

  • Bug fix to supported AIC behavior, including corrective documentation or tests
  • Security fix
  • Migration-blocking compatibility fix

Overview:

Reject non-divisible DSV4 native-head/TP geometry before deriving the rank-local head count, as requested in #1466. For example, 64 native heads with TP=3 currently produces 21 local heads, which reconstructs as a different native identity (63).

This is a configuration-validation correction. Current standard 64/128-head models with the existing power-of-two TP sweep are unaffected; this PR does not claim those models have produced incorrect data.

Details:

Add the requested divisibility check and retain the existing module-head consistency validation. Extend the existing collector contract test with non-divisible and TP-larger-than-head-count cases, covering native, local, and absent module head attributes. Exact division, including one head per rank, remains valid.

Validation:

  • The extended contract test fails on main (DID NOT RAISE RuntimeError) and passes after the fix.
  • python -m pytest --confcutdir=tests/unit/collector tests/unit/collector/sglang/test_collect_dsv4_attn_contract.py -q: 6 passed. This follows the existing test's AST extraction of the actual helper and does not require importing SGLang or loading a model.
  • Ruff lint and format checks passed; the repository's Ruff and Ruff-format pre-commit hooks passed.
  • The full pre-commit invocation could not initialize its unrelated ESLint environment because the system Node selected by nodeenv lacks node:path; no JavaScript files are changed.

Remote CI baseline comparison: the Rust/Python engine-step parity job reports the same two golden-energy mismatches as the unchanged direct main baseline f254959. Both runs report 2 failed / 62 passed, with identical actual values for GPT-OSS-20B and Nemotron-NAS. This collector-only change does not modify those TRTLLM parity paths.

The unit CI job also matches the same main baseline: 1 failed / 2750 passed / 12 skipped. Its only failure is test_power_columns_satisfy_energy_model_input_contract, with identical invalid power_limit data in 15 B200/TRTLLM parquet files.

Where should the reviewer start?

collector/sglang/collect_dsv4_attn.py::_resolve_local_heads

Related Issues:

Fixes #1466

Summary by CodeRabbit

  • Bug Fixes

    • Improved validation of attention head configurations to reject incompatible tensor-parallel settings with a clear geometry-mismatch error.
    • Valid configurations with evenly divisible heads continue to be supported.
  • Tests

    • Expanded coverage for valid single-head division and invalid non-divisible configurations.

Signed-off-by: git-jxj <65210887+git-jxj@users.noreply.github.com>
@git-jxj
git-jxj requested review from a team as code owners September 10, 2026 02:17
@copy-pr-bot

copy-pr-bot Bot commented Sep 10, 2026

Copy link
Copy Markdown

This pull request requires additional validation before any workflows can run on NVIDIA's runners.

Pull request vetters can view their responsibilities here.

Contributors can view more details about this message here.

@github-actions github-actions Bot added the fix label Sep 10, 2026
@coderabbitai

coderabbitai Bot commented Sep 10, 2026

Copy link
Copy Markdown
Contributor

Review Change StackReview Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Enterprise

Run ID: d08b3de2-9f12-4ffd-9c3c-9a6cb7ee9acd

📥 Commits

Reviewing files that changed from the base of the PR and between f254959 and 7ce66d6.

📒 Files selected for processing (2)
  • collector/sglang/collect_dsv4_attn.py
  • tests/unit/collector/sglang/test_collect_dsv4_attn_contract.py

Included review availability: Your plan provides up to 12 included reviews per hour; 5 remain after this review.

📜 Recent review details
⏰ Context from checks skipped due to timeout. (12)
  • GitHub Check: Collect snapshot (old)
  • GitHub Check: Collect snapshot (new)
  • GitHub Check: Python 3.13 compatibility
  • GitHub Check: Python 3.12 compatibility
  • GitHub Check: Build and Test (e2e)
  • GitHub Check: Cargo Deny
  • GitHub Check: Build and Test (unit)
  • GitHub Check: aic-core public API contract
  • GitHub Check: Python 3.11 compatibility
  • GitHub Check: Rust/Python engine-step parity
  • GitHub Check: Check collector data
  • GitHub Check: Perf data sanity (informational)
🧰 Additional context used
📓 Path-based instructions (10)
Enforce the collector rules from `.claude/rules/collector/layer_permissions.md`, `failure_handling.md`, and `case_authoring.md`.

⚙️ CodeRabbit configuration file

Files:

  • collector/sglang/collect_dsv4_attn.py
Check that tests cover the changed behavior rather than only the happy path.

⚙️ CodeRabbit configuration file

Files:

  • tests/unit/collector/sglang/test_collect_dsv4_attn_contract.py
Prefer applicable inline comments.

⚙️ CodeRabbit configuration file

Files:

  • tests/unit/collector/sglang/test_collect_dsv4_attn_contract.py
  • collector/sglang/collect_dsv4_attn.py
When a declared model row, quant mode, attention/MLA profile, or artifact configuration cannot be resolved, raise an error; never substitute defaults, another model's geometry, or a close-enough quant mode.

📄 CodeRabbit inference engine (.claude/rules/collector/case_authoring.md)

Files:

  • collector/sglang/collect_dsv4_attn.py
A collector has exactly two legal responses to a queued case: **execute it, or raise**.

📄 CodeRabbit inference engine (.claude/rules/collector/layer_permissions.md)

Files:

  • collector/sglang/collect_dsv4_attn.py
Record and classify every worker failure; include the module error record, backend collection summary, case parameters, exception details, and `(model, dtype)` group label before any worker reset.

📄 CodeRabbit inference engine (.claude/rules/collector/failure_handling.md)

Files:

  • collector/sglang/collect_dsv4_attn.py
Collector unit tests should preserve and verify the base-grid/model-shape expansion, deduplication, capability filtering, declaration validation, and loud failure behavior described by the collector rules.

📄 CodeRabbit inference engine (.claude/rules/collector/case_authoring.md)

Files:

  • tests/unit/collector/sglang/test_collect_dsv4_attn_contract.py
Check the collector when generated configuration formats or generator parameter names change, because it may parse generated configs or reference parameter names.

📄 CodeRabbit inference engine (.claude/rules/generator/cross_module_impact.md)

Files:

  • collector/sglang/collect_dsv4_attn.py
Before making any change under `collector/**`, read `.claude/rules/collector/layer_permissions.md` and `.claude/rules/collector/failure_handling.md` first.

📄 CodeRabbit inference engine (AGENTS.md)

Files:

  • collector/sglang/collect_dsv4_attn.py
When editing `collector/**`, read and follow `.claude/rules/collector/layer_permissions.md` and `.claude/rules/collector/failure_handling.md`; for case YAML work, also read `case_authoring.md`.

📄 CodeRabbit inference engine (.claude/rules/repo-guide.md)

Files:

  • collector/sglang/collect_dsv4_attn.py
🔇 Additional comments (2)
collector/sglang/collect_dsv4_attn.py (1)

1228-1232: LGTM!

tests/unit/collector/sglang/test_collect_dsv4_attn_contract.py (1)

62-68: LGTM!


Walkthrough

The DSV4 collector now validates that native attention heads divide evenly across tensor-parallel ranks. Unit tests cover exact division and invalid geometries across supported head reports.

Changes

DSV4 head geometry

Layer / File(s) Summary
Validate rank-local head geometry
collector/sglang/collect_dsv4_attn.py
_resolve_local_heads raises RuntimeError when native_heads is not divisible by tp_size.
Test head geometry validation
tests/unit/collector/sglang/test_collect_dsv4_attn_contract.py
Tests cover exact one-head-per-rank division and non-divisible native, missing, and rank-local head reports.

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

Severity of issue fixed: Medium

Merge Risk: ⚪ Minimal · up to 7ce66

This change rejects invalid non-divisible DSV4 tensor-parallel head configurations before they can produce truncated persisted head counts, while preserving valid exact-division behavior. The updated validation and coverage leave no identified merge-blocking risk.

🚥 Pre-merge checks | ✅ 4
✅ Passed checks (4 passed)
Check name Status Explanation
Linked Issues check ✅ Passed The changes satisfy issue #1466 by validating native-head divisibility before division, preserving module-head validation, returning exact quotients for divisible geometry, and adding unit coverage.
Out of Scope Changes check ✅ Passed The changes are limited to DSV4 head-geometry validation and related contract tests, which directly match issue #1466 and the stated pull request objectives.
Title check ✅ Passed The title clearly and concisely describes the main change: rejecting non-divisible DSV4 head geometry.
Description check ✅ Passed The description completes the required sections, identifies the bug-fix scope, explains the validation change, documents tests and CI results, names the review starting point, and references issue #14

Native heads line up in flight
Each rank receives its proper slice
Uneven shapes now raise a flag
Tests guard the exact divide
DSV4 keeps its geometry nice

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

@git-jxj

git-jxj commented Sep 11, 2026

Copy link
Copy Markdown
Author

Rechecked the failing CI on current head 7ce66d6c01f7 against the latest completed main Build and Test run, 34306677905 at f254959eb89e. The unit failure has exactly the same 17 assertion lines for invalid power_limit values in 15 B200/TRTLLM data files. The parity failure has the same four assertion lines for the two golden-energy mismatches (443.84428875568517 and 1241.060314309411). No new failure signature appears in this PR. Could a maintainer confirm the upstream data/golden repair path and rerun these checks once that baseline is repaired?

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

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Validate DSV4 native attention heads are divisible by TP size

1 participant