[FlagGems Operator Development Competition] Add avg_pool3d operator - #2684
Closed
goldenfox2025 wants to merge 4 commits into
Closed
[FlagGems Operator Development Competition] Add avg_pool3d operator#2684goldenfox2025 wants to merge 4 commits into
goldenfox2025 wants to merge 4 commits into
Conversation
goldenfox2025
requested review from
0x45f,
bin913,
douxetpur,
huangyiqun and
w1120029931-bit
as code owners
April 26, 2026 12:21
Signed-off-by: goldenfox2025 <goldenfox2025@163.com>
Collaborator
|
Hi, thank you for your participation in the FlagOS Open Computing Competition 🙏 After review, we have chosen to move forward with a different implementation for this operator. As a result, this PR will be closed. We appreciate your time and contribution, and hope to see more of your submissions in the future. |
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
This PR implements the forward path of
torch.nn.functional.avg_pool3din Triton.Supported API:
Supported dtypes:
torch.float16torch.float32torch.bfloat16Supported input ranks:
(C, D, H, W)(N, C, D, H, W)Implementation
The implementation uses one Triton kernel. Each program handles a block of output elements, maps each flattened output offset to
(n, c, od, oh, ow), gathers the valid input values inside the 3D pooling window, accumulates them infloat32, computes the divisor, and stores the averaged result.Handled features:
kernel_sizestrideNone, or empty sequencepaddingceil_modecount_include_paddivisor_overrideinput.contiguous()The kernel uses
float32accumulation for numerical stability. The output is cast back to the original input dtype before storing.Accuracy Validation
Command:
Result:
Coverage includes:
kernel_size/stride/paddingceil_mode=True/Falsecount_include_pad=True/Falsedivisor_overridetorch.nn.functional.avg_pool3dBenchmark
Command:
Benchmark result summary:
Most benchmark cases are faster than PyTorch. The only slightly slower case is the fp32
ceil_mode=Truecase, where FlagGems reaches0.966xof PyTorch performance.Notes
avg_pool3d.divisor_override=0is rejected explicitly.