Skip to content

Fix: preserve inactive prefill indexer score rows - #1104

Merged
lwDavid merged 1 commit into
hw-native-sys:mainfrom
indigo1973:fix_0901
Sep 1, 2026
Merged

Fix: preserve inactive prefill indexer score rows#1104
lwDavid merged 1 commit into
hw-native-sys:mainfrom
indigo1973:fix_0901

Conversation

@indigo1973

Copy link
Copy Markdown
Contributor

The golden score buffer is initialized with FP32_NEG_INF for all T
rows, but only the first num_tokens rows are active. Assigning scores
to every row overwrote the sentinel values of inactive rows when
num_tokens < T, causing prefill_score_compare to report false golden
mismatches.

Limit both the source and destination to the active token prefix so
inactive score rows retain FP32_NEG_INF.

Before the fix, start_pos=0 and num_tokens=8 failed score validation
with 240 inactive sentinel mismatches:

  • task_20260901_170618_126348616272

Tested on Ascend A5 in the wzh environment with:

  • PyPTO: 4054785f520cb093d877038f3063a259d3afc3e3
  • runtime/simpler: dbdd041e957420ea15b03e878400dd4de5e9c34c
  • PTOAS: 0.60
  • newer PTO-ISA: ad509ef4aaa078e0db3f89f9e760b27578099ee7

Test results:

  • start_pos=0, num_tokens=8: PASS task_20260901_172411_133338029446
  • start_pos=0, num_tokens=128: PASS task_20260901_172455_134010821348

  The golden score buffer is initialized with FP32_NEG_INF for all T
  rows, but only the first num_tokens rows are active. Assigning scores
  to every row overwrote the sentinel values of inactive rows when
  num_tokens < T, causing prefill_score_compare to report false golden
  mismatches.

  Limit both the source and destination to the active token prefix so
  inactive score rows retain FP32_NEG_INF.

  Before the fix, start_pos=0 and num_tokens=8 failed score validation
  with 240 inactive sentinel mismatches:
  - task_20260901_170618_126348616272

  Tested on Ascend A5 in the wzh environment with:
  - PyPTO: 4054785f520cb093d877038f3063a259d3afc3e3
  - runtime/simpler: dbdd041e957420ea15b03e878400dd4de5e9c34c
  - PTOAS: 0.60
  - newer PTO-ISA: ad509ef4aaa078e0db3f89f9e760b27578099ee7

  Test results:
  - start_pos=0, num_tokens=8: PASS
    task_20260901_172411_133338029446
  - start_pos=0, num_tokens=128: PASS
    task_20260901_172455_134010821348
@coderabbitai

coderabbitai Bot commented Sep 1, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Team

Run ID: 462de610-96a5-457b-8df7-b5dd96010e01

📥 Commits

Reviewing files that changed from the base of the PR and between b7eafa4 and 1690bc2.

📒 Files selected for processing (1)
  • models/deepseek_v4_pro/prefill_indexer.py

Included review availability: Your plan provides up to 1 included review per hour; 0 remain after this review.


📝 Walkthrough

Walkthrough

The prefill indexer now populates golden scores only for active tokens. Inactive score rows retain their initialized sentinel values.

Changes

Active Token Score Handling

Layer / File(s) Summary
Restrict score writes to active tokens
models/deepseek_v4_pro/prefill_indexer.py
score_full writes now target only the active num_tokens prefix. Inactive rows retain their sentinel values.

Estimated code review effort: 1 (Trivial) | ~2 minutes

Merge Risk: ⚪ Minimal · up to 1690b

This localized change limits score writes to active token rows so inactive prefill score sentinels are preserved. No actionable merge-blocking risk remains beyond normal checks and review.

Poem

I’m a rabbit guarding scores in a row
Active tokens get a careful glow
Sleeping rows keep sentinels in place
No extra writes disturb their space
The indexer hops with measured grace

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 1 functions across 1 files. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly identifies the main change: preserving inactive prefill indexer score rows.
Description check ✅ Passed The description directly explains the inactive-row sentinel mismatch, the active-prefix fix, and the validation results.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
  • Fix all pre-merge checks with AI

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.

@lwDavid
lwDavid self-requested a review September 1, 2026 09:40
@lwDavid lwDavid added the bug Something isn't working label Sep 1, 2026
@lwDavid lwDavid moved this to Done in pto project Sep 1, 2026

@lwDavid lwDavid left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Reviewed.

@lwDavid
lwDavid merged commit 903ae11 into hw-native-sys:main Sep 1, 2026
10 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

2 participants