Skip to content

Vectorize DeepSeek V4 decode forward specs#589

Open
high-cloud wants to merge 1 commit into
hw-native-sys:mainfrom
high-cloud:fix/decode-fwd-spec-vectorize
Open

Vectorize DeepSeek V4 decode forward specs#589
high-cloud wants to merge 1 commit into
hw-native-sys:mainfrom
high-cloud:fix/decode-fwd-spec-vectorize

Conversation

@high-cloud

Copy link
Copy Markdown
Contributor

Summary

  • vectorize tid2eid stacked spec generation with broadcasting over layer/token/top-k ids
  • vectorize decode forward metadata spec initializers for position_ids, block tables, slot mappings, compressed slot mappings, and state slot mappings
  • keep the compressed slot mappings masked so non-writeback tokens remain -1

Context

Follow-up to #588. This addresses the Gemini review feedback asking to replace the Python loops in decode_fwd.py spec generation with PyTorch tensor operations.

Validation

  • python -m py_compile models/deepseek/v4/decode_fwd.py
  • git diff --check -- models/deepseek/v4/decode_fwd.py
  • python models/deepseek/v4/decode_fwd.py --compile-only

@coderabbitai

coderabbitai Bot commented Jun 23, 2026

Copy link
Copy Markdown

Warning

Review limit reached

@high-cloud, we couldn't start this review because you've reached your PR review rate limit.

More reviews will be available in 15 minutes and 31 seconds. Learn how PR review limits work.

Your organization has used up its prepaid credits, and credit purchases are no longer available. Enable the review add-on in the billing tab to keep reviews running — you're only billed for reviews past your plan's rate limits ($0.25/file).

⌛ How to resolve this issue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based credits.

🚦 How do rate limits work?

CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan refill rate.

For paid Pro and Pro+ PR reviews, CodeRabbit uses rolling per-developer review limits. Reviews become available again as older review attempts age out of the rolling limit window.

Please see our Fair Usage Limits Policy for further information.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 3778ec6d-1574-4315-b884-8dc7f02c9853

📥 Commits

Reviewing files that changed from the base of the PR and between df158c8 and 8d1fa5d.

📒 Files selected for processing (1)
  • models/deepseek/v4/decode_fwd.py

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

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

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

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.

Code Review

This pull request refactors several initialization functions in models/deepseek/v4/decode_fwd.py to use vectorized PyTorch operations instead of Python loops, improving performance and readability. Specifically, init_value (for tid2eid), init_position_ids_single, init_block_table_single, and various slot mapping functions have been vectorized. There are no review comments, so I have no feedback to provide.

Important

The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.

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