Skip to content

【KernelGen】Add feature_dropout operator - #1732

Merged
bin913 merged 3 commits into
flagos-ai:masterfrom
Schopenhauer-loves-Hegel:auto-gen/feature_dropout
May 9, 2026
Merged

【KernelGen】Add feature_dropout operator#1732
bin913 merged 3 commits into
flagos-ai:masterfrom
Schopenhauer-loves-Hegel:auto-gen/feature_dropout

Conversation

@Schopenhauer-loves-Hegel

Copy link
Copy Markdown
Collaborator

PR Category

Operator

Type of Change

New Feature

Description

Add feature_dropout operator implementation with Triton kernel.

  • Implementation mode: manual_kernel
  • Accuracy test: 96/96 passed

Issue

N/A

Progress

  • Change is properly reviewed (1 reviewer required, 2 recommended).
  • Change is responded to an issue.
  • Change is fully covered by a UT.

Performance

torch.bfloat16

Shape Torch Latency (ms) Gems Latency (ms) Speedup
[8, 64] 0.0128 0.0233 0.549
[16, 128] 0.0127 0.0223 0.571
[32, 256] 0.0128 0.0196 0.650
[4, 64, 32, 32] 0.0162 0.0214 0.757
[8, 128, 16, 16] 0.0162 0.0229 0.709
[16, 256, 8, 8] 0.0162 0.0216 0.750
[2, 512, 14, 14] 0.0161 0.0216 0.747
[4, 1024, 7, 7] 0.0190 0.0263 0.722

torch.float16

Shape Torch Latency (ms) Gems Latency (ms) Speedup
[8, 64] 0.0156 0.0389 0.401
[16, 128] 0.0156 0.0177 0.882
[32, 256] 0.0128 0.0231 0.553
[4, 64, 32, 32] 0.0180 0.0216 0.833
[8, 128, 16, 16] 0.0162 0.0220 0.739
[16, 256, 8, 8] 0.0163 0.0204 0.795
[2, 512, 14, 14] 0.0174 0.0219 0.798
[4, 1024, 7, 7] 0.0174 0.0229 0.761

torch.float32

Shape Torch Latency (ms) Gems Latency (ms) Speedup
[8, 64] 0.0140 0.0201 0.696
[16, 128] 0.0125 0.0264 0.474
[32, 256] 0.0140 0.0195 0.720
[4, 64, 32, 32] 0.0184 0.0272 0.676
[8, 128, 16, 16] 0.0155 0.0220 0.703
[16, 256, 8, 8] 0.0155 0.0203 0.762
[2, 512, 14, 14] 0.0164 0.0220 0.749
[4, 1024, 7, 7] 0.0151 0.0228 0.663

Overall: median speedup = 0.721x, mean speedup = 0.694x (24 data points)


Generated by auto_gen tool with Claude Code

@Schopenhauer-loves-Hegel

Copy link
Copy Markdown
Collaborator Author

Closing in favor of grouped PRs to reduce review overhead.

@Schopenhauer-loves-Hegel Schopenhauer-loves-Hegel changed the title Add feature_dropout operator 【KernelGen】Add feature_dropout operator Mar 23, 2026
@factnn
factnn force-pushed the auto-gen/feature_dropout branch from ff45ed6 to a5ccfe4 Compare April 15, 2026 20:26
@CLAassistant

CLAassistant commented Apr 15, 2026

Copy link
Copy Markdown

CLA assistant check
All committers have signed the CLA.

@factnn

factnn commented Apr 17, 2026

Copy link
Copy Markdown
Contributor

feature_dropout Benchmark Speedup Results

float16

Size Torch (ms) Gems (ms) Speedup
[8, 64] 0.016 0.020 0.786
[16, 128] 0.016 0.018 0.898
[4, 64, 32, 32] 0.022 0.020 1.085
[8, 128, 16, 16] 0.017 0.020 0.835
[2, 512, 14, 14] 0.016 0.041 0.395
[4, 1024, 7, 7] 0.016 0.037 0.432

float32

Size Torch (ms) Gems (ms) Speedup
[8, 64] 0.014 0.037 0.384
[4, 64, 32, 32] 0.015 0.051 0.301
[8, 128, 16, 16] 0.016 0.044 0.375
[4, 1024, 7, 7] 0.017 0.048 0.344

bfloat16

Size Torch (ms) Gems (ms) Speedup
[8, 64] 0.014 0.045 0.304
[4, 64, 32, 32] 0.018 0.045 0.392
[16, 256, 8, 8] 0.016 0.034 0.482
[4, 1024, 7, 7] 0.016 0.042 0.382

Note: feature_dropout shows performance regression across most sizes, likely due to kernel launch overhead on small tensors.

@factnn
factnn force-pushed the auto-gen/feature_dropout branch from a5ccfe4 to fb25338 Compare April 17, 2026 23:55
@factnn
factnn force-pushed the auto-gen/feature_dropout branch 2 times, most recently from 954672d to 91fede8 Compare April 23, 2026 03:59
Comment thread benchmark/test_feature_dropout_perf.py Outdated

@tengqm tengqm left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Overall lgtm.

Comment thread src/flag_gems/__init__.py
Comment thread tests/test_feature_dropout.py Outdated
Comment thread tests/test_feature_dropout.py Outdated
Comment thread tests/test_feature_dropout.py Outdated
@factnn
factnn force-pushed the auto-gen/feature_dropout branch from 373d609 to 3bbee51 Compare April 26, 2026 06:31
@github-actions github-actions Bot added the documentation Improvements or additions to documentation label Apr 26, 2026
Comment thread benchmark/test_feature_dropout_perf.py Outdated
Comment thread benchmark/test_feature_dropout.py
Comment thread src/flag_gems/ops/feature_dropout.py
Comment thread PR_status.md Outdated
@github-actions github-actions Bot removed the documentation Improvements or additions to documentation label Apr 27, 2026
tengqm
tengqm previously approved these changes Apr 27, 2026

@tengqm tengqm left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

Comment thread benchmark/test_feature_dropout.py Outdated
tengqm
tengqm previously approved these changes Apr 28, 2026
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@factnn
factnn force-pushed the auto-gen/feature_dropout branch from e282855 to 1f90724 Compare May 8, 2026 07:16
@factnn

factnn commented May 8, 2026

Copy link
Copy Markdown
Contributor

UT Results

Branch rebased to upstream/master and tests passed:

python -m pytest tests/ -m feature_dropout --ref cpu -x -q
72 passed

@bin913
bin913 merged commit f92157a into flagos-ai:master May 9, 2026
18 checks passed
withdrawn919 pushed a commit to withdrawn919/FlagGems that referenced this pull request May 9, 2026
…i#1732)

Co-authored-by: factnn <1050552884@qq.com>
Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-authored-by: bin913 <842884726@qq.com>
smridhi06 pushed a commit to smridhi06/FlagGems that referenced this pull request May 10, 2026
…i#1732)

Co-authored-by: factnn <1050552884@qq.com>
Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-authored-by: bin913 <842884726@qq.com>
smridhi06 pushed a commit to smridhi06/FlagGems that referenced this pull request May 13, 2026
…i#1732)

Co-authored-by: factnn <1050552884@qq.com>
Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-authored-by: bin913 <842884726@qq.com>
smridhi06 pushed a commit to smridhi06/FlagGems that referenced this pull request May 15, 2026
…i#1732)

Co-authored-by: factnn <1050552884@qq.com>
Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-authored-by: bin913 <842884726@qq.com>
tengqm pushed a commit that referenced this pull request May 17, 2026
Co-authored-by: factnn <1050552884@qq.com>
Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-authored-by: bin913 <842884726@qq.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants