-
Notifications
You must be signed in to change notification settings - Fork 422
Fix bsr_get_diag zero fill for missing blocks #1170
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Signed-off-by: Cucchi01 <cucchi01centr@gmail.com>
📝 WalkthroughWalkthroughThe Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes 🚥 Pre-merge checks | ✅ 2 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing touches
📜 Recent review detailsConfiguration used: Path: .coderabbit.yml Review profile: CHILL Plan: Pro 📒 Files selected for processing (2)
🧰 Additional context used🧬 Code graph analysis (1)warp/tests/test_sparse.py (2)
🪛 Ruff (0.14.10)warp/tests/test_sparse.py247-247: (F405) 🔇 Additional comments (2)
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. Comment |
Greptile OverviewGreptile SummaryThis PR fixes a bug in The Fix:
The Test:
The kernel Confidence Score: 5/5
Important Files ChangedFile Analysis
Sequence DiagramsequenceDiagram
participant User
participant bsr_get_diag
participant out array
participant _bsr_get_diag_kernel
User->>bsr_get_diag: Call with BSR matrix A and out buffer
alt out is None
bsr_get_diag->>out array: Create zeros(dim)
else out is provided
bsr_get_diag->>bsr_get_diag: Validate dtype, device, shape
bsr_get_diag->>out array: out.zero_() [NEW FIX]
end
bsr_get_diag->>_bsr_get_diag_kernel: Launch kernel(scale, offsets, columns, values, out)
loop For each row
_bsr_get_diag_kernel->>_bsr_get_diag_kernel: diag = bsr_block_index(row, row, ...)
alt diag != -1 (diagonal block exists)
_bsr_get_diag_kernel->>out array: out[row] = scale * A_values[diag]
else diag == -1 (no diagonal block)
Note over _bsr_get_diag_kernel,out array: out[row] remains zero (from zero_() call)
end
end
bsr_get_diag-->>User: Return out array
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No files reviewed, no comments
gdaviet
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good catch, thanks for the PR!
|
Thanks @Cucchi01, this is now merged and will be a part of the next Warp release. |
Description
To my understanding,
bsr_get_diagshould produce the same result whether or not anoutarray is provided. Previously, whenoutwas passed, it was not zero-initialized, causing missing diagonal blocks to retain whatever values were already inoutinstead of being set to 0.0. This PR fixes that and adds a regression test.Before your PR is "Ready for review"
__init__.pyi,docs/api_reference/,docs/language_reference/)pre-commit run -aSummary by CodeRabbit
Bug Fixes
bsr_get_diag()to properly initialize output buffers when provided by users, ensuring correct results when writing diagonal blocks to an external buffer.Tests
✏️ Tip: You can customize this high-level summary in your review settings.