Fix fill operators crash on non-contiguous tensors (stride != 1) in hopper backend - #2560
Merged
Merged
Conversation
wuhulalala
requested review from
0x45f,
huangyiqun,
kiddyjinjin and
zhangpeiyang1
as code owners
April 20, 2026 12:38
wuhulalala
force-pushed
the
fix/benchmark-bugs
branch
from
April 22, 2026 07:43
d447240 to
b3f5394
Compare
wuhulalala
force-pushed
the
fix/benchmark-bugs
branch
from
April 22, 2026 11:27
7b99764 to
f60b77b
Compare
wuhulalala
force-pushed
the
fix/benchmark-bugs
branch
2 times, most recently
from
April 22, 2026 11:53
bf1327c to
948d1a6
Compare
tengqm
reviewed
Apr 22, 2026
tengqm
left a comment
Contributor
There was a problem hiding this comment.
Great that this passes on Hopper for real!
Huge thank you for quickly adapt the test cases.
Please note that we don't have a fill operator at the moment (see https://github.com/flagos-ai/FlagGems/blob/master/conf/operators.yaml#L1763-L1832). We have several variants for fill, each for a different scenario.
We are now marking operator tests stricter than before. Please use accurate and concise pytest mark for your test cases.
huangyiqun
previously approved these changes
Apr 24, 2026
huangyiqun
requested review from
bin913,
douxetpur and
w1120029931-bit
as code owners
April 24, 2026 07:17
tengqm
reviewed
Apr 24, 2026
tengqm
reviewed
Apr 24, 2026
huangyiqun
previously approved these changes
Apr 24, 2026
…nsors (sliced views)
…or type mismatch" This reverts commit 89dd82e.
wuhulalala
force-pushed
the
fix/benchmark-bugs
branch
from
April 24, 2026 12:04
3f86a23 to
27aaa6e
Compare
tengqm
reviewed
Apr 24, 2026
huangyiqun
approved these changes
Apr 28, 2026
huangyiqun
approved these changes
Apr 28, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
PR Category
Operator
Type of Change
Bug fix
Description
The hopper fill implementation uses flat offsets to index into tensor memory, which assumes stride=1 (contiguous layout). When the
tensor has non-unit strides — e.g. from slicing like x[:, ::2] — the kernel writes to wrong memory locations, producing results
inconsistent with PyTorch's native fill_ behavior.
The fix detects non-contiguous tensors, copies them to a contiguous buffer before running the fill kernel, then copies the result back
via copy_() which respects the original stride layout
Issue
#2347
Progress
Performance