Skip to content

Port https://github.com/NovaSky-AI/SkyRL/pull/1120 to skyrl folder#1130

Merged
pcmoritz merged 1 commit into
NovaSky-AI:mainfrom
pcmoritz:port-1120
Feb 15, 2026
Merged

Port https://github.com/NovaSky-AI/SkyRL/pull/1120 to skyrl folder#1130
pcmoritz merged 1 commit into
NovaSky-AI:mainfrom
pcmoritz:port-1120

Conversation

@pcmoritz
Copy link
Copy Markdown
Collaborator

@pcmoritz pcmoritz commented Feb 15, 2026

See #1120


Open with Devin

Copy link
Copy Markdown
Contributor

@gemini-code-assist gemini-code-assist Bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request refactors the StackedDecoderLayers to simplify how sharding metadata is handled. The new approach uses nnx.spmd.add_axis to create a treedef that includes the necessary sharding information for the stacked layers. This is a significant improvement as it removes a manual, imperative synchronization loop, making the code more robust and declarative. I have one suggestion to ensure the code is resilient against potential AttributeErrors.


# Build a treedef with stacked partition metadata so tree_unflatten
# reconstructs Variables with the correct leading-layer sharding axis.
stacked_first_state = nnx.spmd.add_axis(first_state, 0, {nnx.PARTITION_NAME: None})
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

high

For consistency with nnx.spmd.add_axis and to prevent a potential AttributeError if PARTITION_NAME is not exposed at the top-level nnx module, it's safer to qualify it with the spmd submodule.

Suggested change
stacked_first_state = nnx.spmd.add_axis(first_state, 0, {nnx.PARTITION_NAME: None})
stacked_first_state = nnx.spmd.add_axis(first_state, 0, {nnx.spmd.PARTITION_NAME: None})

Copy link
Copy Markdown
Contributor

@devin-ai-integration devin-ai-integration Bot left a comment

Choose a reason for hiding this comment

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

✅ Devin Review: No Issues Found

Devin Review analyzed this PR and found no potential bugs to report.

View in Devin Review to see 3 additional findings.

Open in Devin Review

@pcmoritz pcmoritz merged commit b4355c1 into NovaSky-AI:main Feb 15, 2026
3 of 5 checks passed
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