Skip to content

Validate DSV4 native attention heads are divisible by TP size #1466

Description

@coderabbitai

Summary

collector/sglang/collect_dsv4_attn.py::_resolve_local_heads computes the persisted rank-local num_heads with integer division.

Required change

Before calculating native_heads // tp_size, validate that native_heads % tp_size == 0. Raise RuntimeError when the geometry is not exactly divisible.

Rationale

A non-divisible geometry truncates the local head count. Consumers derive the native identity as num_heads * tp_size, so the persisted row can move into an incorrect native-head bucket.

Affected area

  • collector/sglang/collect_dsv4_attn.py
  • _resolve_local_heads

Acceptance criteria

  • _resolve_local_heads raises RuntimeError for non-divisible native_heads and tp_size.
  • _resolve_local_heads returns the exact quotient for divisible geometry.
  • The existing module_heads validation remains in place.
  • Add or update unit coverage for non-divisible geometry.

Backlinks

Activity

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

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions