-
Notifications
You must be signed in to change notification settings - Fork 257
[CK_BUILDER] Add grouped conv fwd ck tile traits #3183
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
e387bd7
[CK BUILDER] Add grouped conv fwd ck tile traits
bartekxk 9312f33
Update instance_traits_tile_grouped_convolution_forward.hpp
bartekxk 3cc5619
Update grouped_convolution_forward_kernel.hpp
bartekxk be24e27
Merge branch 'develop' into barkocot/tile-builder-fwd
shumway File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
140 changes: 140 additions & 0 deletions
140
...lder/include/ck_tile/builder/reflect/instance_traits_tile_grouped_convolution_forward.hpp
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,140 @@ | ||
| // Copyright (C) Advanced Micro Devices, Inc., or its affiliates. | ||
| // SPDX-License-Identifier: MIT | ||
| // InstanceTraits specialization for GroupedConvolutionForwardKernel | ||
| // | ||
| // CRITICAL MAINTENANCE NOTE: | ||
| // This InstanceTraits file MUST be kept strictly in sync with the device implementation header: | ||
| // ck_tile/ops/grouped_convolution/kernel/grouped_convolution_forward_kernel.hpp | ||
| // "In sync" means that the template parameter order, names, and types in the declaration below | ||
| // MUST EXACTLY MATCH those in the device implementation. If these diverge, you may encounter | ||
| // compilation errors, subtle template instantiation mismatches, or silent runtime bugs that are | ||
| // difficult to diagnose. Always update both files together and review changes carefully. | ||
|
|
||
| #pragma once | ||
|
|
||
| #include "instance_traits.hpp" | ||
| #include "instance_traits_util.hpp" | ||
|
|
||
| // Forward declaration to avoid circular dependency. | ||
| namespace ck_tile::device { | ||
|
|
||
| template <typename GroupedConvTraitsType_, | ||
| typename TilePartitioner_, | ||
| typename GemmPipeline_, | ||
| typename EpiloguePipeline_> | ||
| struct GroupedConvolutionForwardKernel; | ||
|
|
||
| } // namespace ck_tile::device | ||
|
|
||
| namespace ck_tile { | ||
| namespace reflect { | ||
|
|
||
| // Specialization for GroupedConvolutionForwardKernel | ||
| template <typename GroupedConvTraitsType_, | ||
| typename TilePartitioner_, | ||
| typename GemmPipeline_, | ||
| typename EpiloguePipeline_> | ||
| struct InstanceTraits<ck_tile::device::GroupedConvolutionForwardKernel<GroupedConvTraitsType_, | ||
| TilePartitioner_, | ||
| GemmPipeline_, | ||
| EpiloguePipeline_>> | ||
| { | ||
| // CK Tile Conv Traits | ||
| // Spatial dimension | ||
| static constexpr int kSpatialDim = GroupedConvTraitsType_::NDimSpatial; | ||
| // Specialization | ||
| static constexpr ck_tile::ConvolutionSpecialization ConvSpecialization = | ||
| GroupedConvTraitsType_::ConvSpecialization; | ||
| // DataType types | ||
| using InLayout = typename GroupedConvTraitsType_::InLayout; | ||
| using WeiLayout = typename GroupedConvTraitsType_::WeiLayout; | ||
| using DsLayout = typename GroupedConvTraitsType_::DsLayout; | ||
| using OutLayout = typename GroupedConvTraitsType_::OutLayout; | ||
| // Vector size | ||
| static constexpr int kVectorSizeA = GroupedConvTraitsType_::VectorSizeA; | ||
| static constexpr int kVectorSizeB = GroupedConvTraitsType_::VectorSizeB; | ||
| static constexpr int kVectorSizeC = GroupedConvTraitsType_::VectorSizeC; | ||
| // Num Groups To Merge | ||
| static constexpr int kNumGroupsToMerge = GroupedConvTraitsType_::NumGroupsToMerge; | ||
| // Split image (large tensors) | ||
| static constexpr bool kEnableSplitImage = GroupedConvTraitsType_::EnableSplitImage; | ||
|
|
||
| // TilePartitioner | ||
| // Block configuration | ||
| static constexpr int kMPerBlock = TilePartitioner_::MPerBlock; | ||
| static constexpr int kNPerBlock = TilePartitioner_::NPerBlock; | ||
| static constexpr int kKPerBlock = TilePartitioner_::KPerBlock; | ||
|
|
||
| static constexpr int kMWarp = TilePartitioner_::BlockGemmShape::BlockWarps::at(number<0>{}); | ||
| static constexpr int kNWarp = TilePartitioner_::BlockGemmShape::BlockWarps::at(number<1>{}); | ||
| static constexpr int kKWarp = TilePartitioner_::BlockGemmShape::BlockWarps::at(number<2>{}); | ||
|
|
||
| static constexpr int kMWarpTile = TilePartitioner_::BlockGemmShape::WarpTile::at(number<0>{}); | ||
| static constexpr int kNWarpTile = TilePartitioner_::BlockGemmShape::WarpTile::at(number<1>{}); | ||
| static constexpr int kKWarpTile = TilePartitioner_::BlockGemmShape::WarpTile::at(number<2>{}); | ||
|
|
||
| // Data types | ||
| using ADataType = typename GemmPipeline_::ADataType; | ||
| using BDataType = typename GemmPipeline_::BDataType; | ||
| // Gemm Pipeline | ||
| using GemmPipeline = GemmPipeline_; | ||
| static constexpr ck_tile::GemmPipelineScheduler kPipelineScheduler = GemmPipeline_::Scheduler; | ||
| static constexpr bool kDoubleSmemBuffer = GemmPipeline_::DoubleSmemBuffer; | ||
| static constexpr int kNumWaveGroups = GemmPipeline_::NumWaveGroups; | ||
|
|
||
| // Epilogue Pipeline | ||
| using AccDataType = typename EpiloguePipeline_::AccDataType; | ||
| using EDataType = typename EpiloguePipeline_::ODataType; | ||
| using DsDataType = typename EpiloguePipeline_::DsDataType; | ||
| using CDEElementwiseOperation = typename EpiloguePipeline_::CDElementwise; | ||
|
|
||
| // Static member function to generate instance string | ||
| static std::string instance_string() | ||
| { | ||
| std::ostringstream oss; | ||
|
|
||
| // Kernel type name | ||
| oss << "GroupedConvolutionForwardKernel"; | ||
|
|
||
| // Template parameters in exact order matching InstanceTraits member order | ||
| oss << "<" << kSpatialDim; // 1. NDimSpatial | ||
| oss << "," | ||
| << ck_tile::getConvSpecializationString(ConvSpecialization); // 2. ConvSpecialization | ||
| oss << "," << detail::layout_name<InLayout>(); // 3. InLayout | ||
| oss << "," << detail::layout_name<WeiLayout>(); // 4. WeiLayout | ||
| oss << "," << detail::tuple_name<DsLayout>(); // 5. DsLayout | ||
| oss << "," << detail::layout_name<OutLayout>(); // 6. OutLayout | ||
| oss << "," << kVectorSizeA; // 7. VectorSizeA | ||
| oss << "," << kVectorSizeB; // 8. VectorSizeB | ||
| oss << "," << kVectorSizeC; // 9. VectorSizeC | ||
| oss << "," << kNumGroupsToMerge; // 10. NumGroupsToMerge | ||
| oss << "," << kEnableSplitImage; // 11. EnableSplitImage | ||
| oss << "," << kMPerBlock; // 12. MPerBlock | ||
| oss << "," << kNPerBlock; // 13. NPerBlock | ||
| oss << "," << kKPerBlock; // 14. KPerBlock | ||
| oss << "," << kMWarp; // 15. MWarp | ||
| oss << "," << kNWarp; // 16. NWarp | ||
| oss << "," << kKWarp; // 17. KWarp | ||
| oss << "," << kMWarpTile; // 18. MWarpTile | ||
| oss << "," << kNWarpTile; // 19. NWarpTile | ||
| oss << "," << kKWarpTile; // 20. KWarpTile | ||
| oss << "," << detail::type_name<ADataType>(); // 21. ADataType | ||
| oss << "," << detail::type_name<BDataType>(); // 22. BDataType | ||
| oss << "," << GemmPipeline::GetPipelineName(); // 23. BlkGemmPipelineVer | ||
| oss << "," << detail::pipeline_scheduler_name(kPipelineScheduler); // 24. BlkGemmPipeSched | ||
| oss << "," << kDoubleSmemBuffer; // 25. NumWaveGroups | ||
| oss << "," << kNumWaveGroups; // 26. NumWaveGroups | ||
| oss << "," << detail::type_name<AccDataType>(); // 27. AccDataType | ||
| oss << "," << detail::type_name<EDataType>(); // 28. EDataType | ||
| oss << "," << detail::tuple_name<DsDataType>(); // 29. DsDataType | ||
| oss << "," | ||
| << detail::elementwise_op_name<CDEElementwiseOperation>(); // 30. | ||
| // CDEElementwiseOperation | ||
| oss << ">"; | ||
|
|
||
| return oss.str(); | ||
| } | ||
| }; | ||
|
|
||
| } // namespace reflect | ||
| } // namespace ck_tile | ||
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
Oops, something went wrong.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nit: New copyright format shouldn't contain the year.