[Conv3D] Add packed-dot depthwise Conv3D hip kernel - #27
Open
sammysun0711 wants to merge 3 commits into
Open
Conversation
Signed-off-by: Xiake Sun <xiake.sun@amd.com>
Select packed FP16 on gfx942 where fdot2 is supported, and fall back to sgb for BF16 since bf16 packed-dot requires gfx950 dot12-insts. Signed-off-by: Xiake Sun <xiake.sun@amd.com>
There was a problem hiding this comment.
Pull request overview
This PR integrates a new packed-dot depthwise Conv3D HIP kernel and adds an automatic kernel-selection path so PyHIP can choose the best implementation for supported AMD GPU architectures (gfx950/gfx942) and dtypes, alongside benchmark/test and packaging updates.
Changes:
- Added a new packed-dot depthwise Conv3D HIP kernel implementation (
conv_depthwise3d_hip_packed_dot.cpp). - Implemented
hip_impl="auto"selection logic inconv_depthwise.py, choosingpackedwhen supported and otherwise falling back tosgb. - Extended the benchmark/test harness with dtype/backend controls and improved output labeling; updated packaging to include contributed
.cppsources in wheels.
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 3 comments.
| File | Description |
|---|---|
| tests/contrib/conv3d/test_conv_depthwise.py | Adds --dtype and --depthwise-hip auto/packed/sgb/original controls and adjusts benchmark labels/formatting. |
| src/contrib/conv_depthwise3d_hip_packed_dot.cpp | New packed-dot depthwise Conv3D kernel using fdot2 builtins and reduced LDS/VGPR strategy. |
| src/contrib/conv_depthwise.py | Adds packed/auto backend resolution based on shape, dtype, and detected AMDGPU arch; switches default to hip_impl="auto". |
| pyproject.toml | Ensures pyhip.contrib ships .cpp sources as package data for wheel builds. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Signed-off-by: Xiake Sun <xiake.sun@amd.com>
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.
Integrates optimized FP16/BF16 packed-dot depthwise Conv3D kernel on gfx950, and FP16 packed-dot support on gfx942.
__builtin_amdgcn_fdot2_f32_bf16and FP16 packed-dot__builtin_amdgcn_fdot2LLVM built-in, Reduce VGPR from 86 to 47, use 68 SGPR, Reduce LDS usage from 32KB to 24KB, increase wave occupancy from 5 to 6. the packed dot BF16 kernel reaches +41.6% (BF16) and +40.9% (FP16) performance uplift compared to SGB while maintaining PyTorch correctness.__builtin_amdgcn_fdot2dot10-insts,#pragma unrollcompiler codegen uses 255 VGPR, while limited LDS (64KB) does not improve wave occupancy (still 2), packed dot ISA improve perf by 34.9% while maintaining PyTorch correctness. Fallback to SGB for BF16 dtype since gfx942 does not support__builtin_amdgcn_fdot2_f32_bf16, which required dot12-insts.MI350X (gfx950)
python test_conv_depthwise.py --depthwise-hip packed --dtype bf16python test_conv_depthwise.py --depthwise-hip packed --dtype fp16MI308X (gfx942)
python test_conv_depthwise.py --depthwise-hip packed --dtype fp16