Skip to content

refactor(nixl): pick the wire dtype with resolve_wire_dtype - #3740

Open
yafshar wants to merge 3 commits into
PrimeIntellect-ai:mainfrom
yafshar:fix/nixl-optional-fp32-policy
Open

yafshar wants to merge 3 commits into
PrimeIntellect-ai:mainfrom
yafshar:fix/nixl-optional-fp32-policy

Conversation

@yafshar

@yafshar yafshar commented Oct 1, 2026 •

Copy link
Copy Markdown
Contributor

Change

NIXL decides whether each tensor goes to the inference engine as FP32 or BF16 with its own inline copy of the rule. NCCL and the filesystem gather already share that rule through resolve_wire_dtype in utils/weights.py, whose docstring asks for NIXL to join them:

TODO: NIXL keeps its own inline copy of this rule; unify the handling.

This PR makes NIXL call resolve_wire_dtype and look up keep_in_fp32_for_weight_transfer with getattr(..., None), as the other two transports do. It also drops the cast(PreTrainedModelPrimeRL, model) that only existed for the direct method call, and removes the TODO.

Transport Method lookup Dtype rule
NCCL (nccl.py) getattr(..., None) resolve_wire_dtype
Filesystem gather (utils/weights.py) getattr(..., None) resolve_wire_dtype
NIXL (nixl.py), before direct call after a cast inline copy
NIXL (nixl.py), after getattr(..., None) resolve_wire_dtype

No behaviour change. Since #3773 removed the Hugging Face model fallback, every trainer model inherits keep_in_fp32_for_weight_transfer from PreTrainedModelPrimeRL, so each tensor keeps the same wire dtype.

An earlier version of this PR was a fix for an AttributeError that NIXL raised on Hugging Face models. #3773 removed that code path, so the PR is now only a cleanup.

Plain Transformers models may not define keep_in_fp32_for_weight_transfer,
causing NIXL transfer initialization to raise AttributeError. Look up the
predicate optionally and use the shared wire-dtype resolver, consistent
with the other transfer paths.

Signed-off-by: Yaser Afshar <yaser.afshar@intel.com>
…p32-policy

Signed-off-by: Yaser Afshar <yaser.afshar@intel.com>
@yafshar yafshar changed the title fix(nixl): support models without an FP32 transfer predicate refactor(nixl): pick the wire dtype with resolve_wire_dtype Oct 12, 2026
…p32-policy

Signed-off-by: Yaser Afshar <yaser.afshar@intel.com>
@yafshar
yafshar marked this pull request as ready for review November 3, 2026 18:36
@yafshar

yafshar commented Nov 3, 2026

Copy link
Copy Markdown
Contributor Author

Ready for review. NIXL now picks the FP32/BF16 wire dtype with resolve_wire_dtype, the same rule NCCL and the filesystem transport use, and the TODO asking for this is removed. No behaviour change: every trainer model already provides keep_in_fp32_for_weight_transfer. Merges cleanly on current main.

@biswapanda could you review? @garrett361 @mikasenghaas for approval.

This branch has not been deployed

No deployments
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