[KernelGen][Nvidia] Add addr_ operator with Triton kernel - #5440
Open
LoserCheems wants to merge 1 commit into
Open
[KernelGen][Nvidia] Add addr_ operator with Triton kernel#5440LoserCheems wants to merge 1 commit into
LoserCheems wants to merge 1 commit into
Conversation
Implements the in-place variant of addr using a single fused Triton kernel. The kernel computes beta * input + alpha * outer(vec1, vec2) and writes the result back to the input tensor directly. Benchmark results on H20 (vs PyTorch native addr_): - float16 average speedup: 1.89x - float32 average speedup: 1.34x
LoserCheems
requested review from
0x45f,
103yiran,
Caeruleann,
bin913,
douxetpur,
hellojack163,
huangyiqun,
tengqm and
w1120029931-bit
as code owners
August 13, 2026 04:47
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
addr_(in-place variant). Performs the outer-product of vectorsvec1andvec2, scales byalpha, and adds tobeta * inputin-place using a single fused kernel.Testing
(M, N)shapes andfloat16/float32/bfloat16dtypesPerformance
Test command:
pytest benchmark/test_addr_.py --level core --mode cudagraph(NVIDIA H20)float16:
float32:
bfloat16:
Multi-backend Testing
Files Changed
src/flag_gems/ops/addr_.py: Triton kernel implementationtests/test_addr_.py: Accuracy testbenchmark/test_addr_.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: BLAS, stage: stable 4.0)