[KernelGen][Nvidia] Add transpose_ operator with Triton kernel - #5446
Open
ShawnsYing wants to merge 1 commit into
Open
[KernelGen][Nvidia] Add transpose_ operator with Triton kernel#5446ShawnsYing wants to merge 1 commit into
ShawnsYing wants to merge 1 commit into
Conversation
ShawnsYing
requested review from
0x45f,
103yiran,
Caeruleann,
bin913,
douxetpur,
hellojack163,
huangyiqun,
tengqm and
w1120029931-bit
as code owners
August 13, 2026 08:22
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.
Summary
Adds a Triton kernel for
transpose_. In-place transpose: swaps two dimensions of the tensor, mutating it in placeand returning it. This is a zero-copy view operation that swaps the sizes and
strides of the two specified dimensions via as_strided, matching the semantics
of aten::transpose_.
Testing
to_reference(inp, True)Performance
Test command:
pytest benchmark/test_transpose_.py --level core(NVIDIA H20)transpose_ (in-place)
Multi-backend Testing
Files Changed
src/flag_gems/ops/transpose_.py: Triton kernel implementationtests/test_transpose_.py: Accuracy testbenchmark/test_transpose_.py: Performance benchmarksrc/flag_gems/ops/__init__.py: Register import and__all__src/flag_gems/__init__.py: Register to_FULL_CONFIGconf/operators.yaml: Add operator entry (kind: Tensor, stage: alpha 5.4)