Skip to content

Add weight for ragged gather kernel and enable fan out in bwd ragged sort#4166

Open
NuojCheng wants to merge 1 commit into
mainfrom
chengnuojin-fix-ragged
Open

Add weight for ragged gather kernel and enable fan out in bwd ragged sort#4166
NuojCheng wants to merge 1 commit into
mainfrom
chengnuojin-fix-ragged

Conversation

@NuojCheng

@NuojCheng NuojCheng commented Jun 15, 2026

Copy link
Copy Markdown
Collaborator

Description

This PR fixes the usage of ragged_gather kernel under _ring_ragged_unsort_bwd. Previously, this kernel was applied in non-fan-out way, since the backward pass the unsort requires weight balance, while the ragged gather kernel did not support. This PR adds this support and enable a fan-out style of this kernel, successfully avoid materializing the full padded-shape tensor in fp32.

FIXES: b/522526813

Tests

Checklist

Before submitting this PR, please make sure (put X in square brackets):

  • I have performed a self-review of my code. For an optional AI review, add the gemini-review label.
  • I have necessary comments in my code, particularly in hard-to-understand areas.
  • I have run end-to-end tests tests and provided workload links above if applicable.
  • I have made or will make corresponding changes to the doc if needed, including adding new documentation pages to the relevant Table of Contents (toctree directive) as explained in our documentation.

@codecov

codecov Bot commented Jun 15, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 77.77778% with 12 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
src/maxtext/kernels/ragged/ragged_gather.py 71.42% 11 Missing and 1 partial ⚠️

📢 Thoughts on this report? Let us know!

@NuojCheng NuojCheng force-pushed the chengnuojin-fix-ragged branch from ee734a4 to 2de0a9c Compare June 16, 2026 01:42
@NuojCheng NuojCheng changed the title Add fan out for scatter bwd Add weight for ragged gather kernel and enable fan out in bwd ragged sort Jun 16, 2026
@NuojCheng NuojCheng marked this pull request as ready for review June 16, 2026 02:27
@NuojCheng NuojCheng force-pushed the chengnuojin-fix-ragged branch from 2de0a9c to 9172c06 Compare June 16, 2026 05:00
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