【KernelGen】Add index_copy_ operator - #1743
Merged
tengqm merged 22 commits intoMay 19, 2026
Merged
Conversation
Schopenhauer-loves-Hegel
requested review from
0x45f,
huangyiqun,
kiddyjinjin and
zhangpeiyang1
as code owners
February 27, 2026 06:15
Collaborator
Author
|
Closing in favor of grouped PRs to reduce review overhead. |
factnn
force-pushed
the
auto-gen/index_copy_
branch
from
April 15, 2026 20:29
445bd7c to
93c173f
Compare
Contributor
index_copy_ Benchmark Speedup Resultsfloat16
float32
Note: Significant performance regression on small tensors due to kernel launch overhead. Large tensors (float32) show comparable or better performance. |
factnn
force-pushed
the
auto-gen/index_copy_
branch
from
April 18, 2026 00:45
93c173f to
513db40
Compare
factnn
force-pushed
the
auto-gen/index_copy_
branch
2 times, most recently
from
April 23, 2026 04:40
7d42283 to
8b7e646
Compare
tengqm
reviewed
Apr 23, 2026
factnn
requested review from
bin913,
douxetpur and
w1120029931-bit
as code owners
April 26, 2026 06:39
tengqm
reviewed
Apr 26, 2026
|
|
||
|
|
||
| @pytest.mark.index_copy | ||
| def test_index_copy_perf(): |
Contributor
There was a problem hiding this comment.
Suggested change
| def test_index_copy_perf(): | |
| def test_index_copy(): |
| op_name="index_copy", | ||
| torch_op=torch.index_copy, | ||
| input_fn=index_copy_input_fn, | ||
| dtypes=[torch.float16, torch.float32], |
| op_name="index_copy_", | ||
| torch_op=torch.Tensor.index_copy_, | ||
| input_fn=index_copy_input_fn, | ||
| dtypes=[torch.float16, torch.float32], |
Contributor
There was a problem hiding this comment.
shall we specify inplace=True?
Comment on lines
+8
to
+9
| class TensorSelectBenchmark(GenericBenchmark2DOnly): | ||
| pass |
Contributor
There was a problem hiding this comment.
This additional layer makes no sense.
| @@ -0,0 +1,45 @@ | |||
| # Feb 27 KernelGen PR Status | |||
tengqm
reviewed
May 10, 2026
| def __call__(self, *args, **kwargs): | ||
| key = f"{self.arg_key(*args)}" | ||
| if key in self.overloads: | ||
| overload = self.overloads[key] |
Contributor
There was a problem hiding this comment.
If you return here with return overload(*args, **kwargs) here, you don't need the else on line 176.
Contributor
There was a problem hiding this comment.
No. You didn't return, still.
factnn
force-pushed
the
auto-gen/index_copy_
branch
from
May 10, 2026 13:32
43b3b14 to
0b5f06e
Compare
factnn
force-pushed
the
auto-gen/index_copy_
branch
from
May 11, 2026 07:09
0b5f06e to
af10c71
Compare
tengqm
reviewed
May 11, 2026
|
|
||
|
|
||
| def _inplace_input_fn(shape, dtype, device): | ||
| yield from _tensor_input_fn(shape, dtype, device) |
| def __call__(self, *args, **kwargs): | ||
| key = f"{self.arg_key(*args)}" | ||
| if key in self.overloads: | ||
| overload = self.overloads[key] |
Contributor
There was a problem hiding this comment.
No. You didn't return, still.
…d wrapper, rename benchmark Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…HAPES Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
tengqm
reviewed
May 13, 2026
bin913
approved these changes
May 15, 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
New Feature
Description
Add
index_copy_operator implementation with Triton kernel.manual_kernelIssue
N/A
Progress
Performance
torch.float16
torch.float32
Overall: median speedup = 0.064x, mean speedup = 0.356x (14 data points)
Generated by auto_gen tool with Claude Code