【KernelGen】Add einsum operator - #1731
Conversation
|
Closing in favor of grouped PRs to reduce review overhead. |
einsum Benchmark Speedup Resultseinsum_matmul (float16)
einsum_matmul (float32)
einsum_bmm (float16)
einsum_bmm (float32)
|
8acb144 to
288c926
Compare
tengqm
left a comment
There was a problem hiding this comment.
Some naming suggestions and sorting nits.
Wondering if we are doing a thorough performance testing when compared to accuracy checking. There are so many situations to cover.
|
Thanks for the review! All three comments have been addressed:
|
UT ResultsBranch rebased to upstream/master and tests passed: |
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-authored-by: Qiming Teng <tengqm@outlook.com> Signed-off-by: Zang Peiyu <166481866+factnn@users.noreply.github.com>
|
The A = torch.randn(3, 3, device='cuda')
torch.einsum('ii->i', A) # matches FlagGems output exactly |
|
The |
* feat: add einsum operator with tests and benchmark Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> * Apply suggestions from code review Co-authored-by: Qiming Teng <tengqm@outlook.com> Signed-off-by: Zang Peiyu <166481866+factnn@users.noreply.github.com> * fix: use consts.FLOAT_DTYPES and base.Benchmark in einsum benchmark * fix: fix einsum benchmark - use correct base classes and shapes --------- Signed-off-by: Zang Peiyu <166481866+factnn@users.noreply.github.com> Co-authored-by: factnn <1050552884@qq.com> Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com> Co-authored-by: Zang Peiyu <166481866+factnn@users.noreply.github.com> Co-authored-by: Qiming Teng <tengqm@outlook.com>
* feat: add einsum operator with tests and benchmark Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> * Apply suggestions from code review Co-authored-by: Qiming Teng <tengqm@outlook.com> Signed-off-by: Zang Peiyu <166481866+factnn@users.noreply.github.com> * fix: use consts.FLOAT_DTYPES and base.Benchmark in einsum benchmark * fix: fix einsum benchmark - use correct base classes and shapes --------- Signed-off-by: Zang Peiyu <166481866+factnn@users.noreply.github.com> Co-authored-by: factnn <1050552884@qq.com> Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com> Co-authored-by: Zang Peiyu <166481866+factnn@users.noreply.github.com> Co-authored-by: Qiming Teng <tengqm@outlook.com>
* feat: add einsum operator with tests and benchmark Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> * Apply suggestions from code review Co-authored-by: Qiming Teng <tengqm@outlook.com> Signed-off-by: Zang Peiyu <166481866+factnn@users.noreply.github.com> * fix: use consts.FLOAT_DTYPES and base.Benchmark in einsum benchmark * fix: fix einsum benchmark - use correct base classes and shapes --------- Signed-off-by: Zang Peiyu <166481866+factnn@users.noreply.github.com> Co-authored-by: factnn <1050552884@qq.com> Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com> Co-authored-by: Zang Peiyu <166481866+factnn@users.noreply.github.com> Co-authored-by: Qiming Teng <tengqm@outlook.com>
* feat: add einsum operator with tests and benchmark Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> * Apply suggestions from code review Co-authored-by: Qiming Teng <tengqm@outlook.com> Signed-off-by: Zang Peiyu <166481866+factnn@users.noreply.github.com> * fix: use consts.FLOAT_DTYPES and base.Benchmark in einsum benchmark * fix: fix einsum benchmark - use correct base classes and shapes --------- Signed-off-by: Zang Peiyu <166481866+factnn@users.noreply.github.com> Co-authored-by: factnn <1050552884@qq.com> Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com> Co-authored-by: Zang Peiyu <166481866+factnn@users.noreply.github.com> Co-authored-by: Qiming Teng <tengqm@outlook.com>
* feat: add einsum operator with tests and benchmark Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> * Apply suggestions from code review Co-authored-by: Qiming Teng <tengqm@outlook.com> Signed-off-by: Zang Peiyu <166481866+factnn@users.noreply.github.com> * fix: use consts.FLOAT_DTYPES and base.Benchmark in einsum benchmark * fix: fix einsum benchmark - use correct base classes and shapes --------- Signed-off-by: Zang Peiyu <166481866+factnn@users.noreply.github.com> Co-authored-by: factnn <1050552884@qq.com> Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com> Co-authored-by: Zang Peiyu <166481866+factnn@users.noreply.github.com> Co-authored-by: Qiming Teng <tengqm@outlook.com>
PR Category
Operator
Type of Change
New Feature
Description
Add
einsumoperator implementation with Triton kernel.N/AIssue
N/A
Progress
Performance
torch.bfloat16
torch.float16
torch.float32
Overall: median speedup = 0.960x, mean speedup = 1.012x (30 data points)
Generated by auto_gen tool with Claude Code