-
Notifications
You must be signed in to change notification settings - Fork 265
[CK_BUILDER] Add grouped conv fwd ck tile profiler #3518
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
Open
bartekxk
wants to merge
19
commits into
develop
Choose a base branch
from
barkocot/tile-builder-testing
base: develop
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
19 commits
Select commit
Hold shift + click to select a range
ac6bd87
[BULDER] Add grouped conv fwd ck tile profiler
bartekxk 7798fec
Merge branch 'develop' of github.com:ROCm/composable_kernel into bark…
bartekxk 02151f0
[CK TILE] Fix grouped conv kernels splitk and double lds
bartekxk 04ee697
Updates
bartekxk 48d9113
Fixes
bartekxk c7709ea
Move to ckProfiler
bartekxk 2b82f21
Fixes
bartekxk bed4e7e
Merge branch 'develop' of github.com:ROCm/composable_kernel into bark…
bartekxk c0dcba0
fix
bartekxk dcf8a50
fix
bartekxk 527d98e
Change instances to empty list by default
bartekxk 3291468
fix
bartekxk f754aa1
fix
bartekxk 18d08a3
Update grouped_convolution_signatures.hpp
bartekxk ca8d5af
Update grouped_convolution_forward_tile_algs.hpp
bartekxk 97f5953
Merge branch 'develop' into barkocot/tile-builder-testing
bartekxk 0725777
[CK TILE] Add grouped convolution forward tests (#3556)
bartekxk e81f6cf
fixes
bartekxk a14bc52
Merge branch 'develop' into barkocot/tile-builder-testing
bartekxk 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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -4,3 +4,5 @@ | |
| if(BUILD_TESTING) | ||
| add_subdirectory(test) | ||
| endif() | ||
|
|
||
| add_subdirectory(src) | ||
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
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
85 changes: 85 additions & 0 deletions
85
experimental/builder/include/ck_tile/builder/testing/conv_fwd_ck_tile.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,85 @@ | ||
| // Copyright (c) Advanced Micro Devices, Inc., or its affiliates. | ||
| // SPDX-License-Identifier: MIT | ||
|
|
||
| #pragma once | ||
|
|
||
| #include "ck_tile/builder/testing/conv_fwd.hpp" | ||
| #include "ck_tile/host/kernel_launch.hpp" | ||
| #include "ck_tile/builder/factory/helpers/ck/conv_elementwise_op.hpp" | ||
| #include <type_traits> | ||
| #include <array> | ||
|
|
||
| /// This file contains the implementation details for invoking/testing | ||
| /// grouped convolution operations in CK Tile. The main item is the | ||
| /// `run()` function, which is the main implementation used to invoke | ||
| /// CK grouped forward convolution kernels. | ||
|
|
||
| namespace ck_tile::builder::test { | ||
|
|
||
| namespace detail { | ||
|
|
||
| /// @brief Concept for checking whether this is the CK Tile convolution | ||
| /// implementation. | ||
| /// | ||
| /// This is the same as `::ck_tile::builder::test::CkConvInstance`, except | ||
| /// with some utility aliases. For that reason, its moved to this detail | ||
| /// namespace. | ||
| template <typename Conv, auto SIGNATURE> | ||
| concept CkTileConvInstance = requires(Conv&) { | ||
| { Conv::BlockSize() }; | ||
| }; | ||
|
|
||
| } // namespace detail | ||
|
|
||
| /// @brief Concept for checking whether a convolution is invoked like CK Tile. | ||
| /// | ||
| /// This concept is used to tell whether a convolution implementation is | ||
| /// likely to be an "CK Tile" implementation - that is, whether we should | ||
| /// invoke it as an CK Tile kernel. This is mainly used with `run()` to | ||
| /// differentiate which implementation that should be invoked. | ||
| /// | ||
| /// - SIGNATURE is the operation signature. | ||
| /// - Conv is a convolution instance created by the CK Builder API. | ||
| template <typename Conv, auto SIGNATURE> | ||
| concept CkTileConvInstance = detail::CkTileConvInstance<Conv, SIGNATURE>; | ||
|
|
||
| /// @brief `run()` specialization for forward convolution and CK Tile. | ||
| /// | ||
| /// @tparam SIGNATURE Forward convolution signature. | ||
| /// @throws std::runtime_error if the arguments werent actually valid for the | ||
| /// operation. This should be caught and reported by the testing framework. | ||
| /// | ||
| /// @see run() | ||
| template <auto SIGNATURE> | ||
| requires ValidConvSignature<SIGNATURE> && ConvDirectionIsForward<SIGNATURE> | ||
| float run(CkTileConvInstance<SIGNATURE> auto& conv, | ||
| const Args<SIGNATURE>& args, | ||
| const Inputs<SIGNATURE>& inputs, | ||
| const Outputs<SIGNATURE>& outputs, | ||
| const ck_tile::stream_config s_conf = {}) | ||
| { | ||
| using Conv = std::remove_reference_t<decltype(conv)>; | ||
| const auto param = args.to_ck_tile_conv_param(); | ||
|
|
||
| ck_tile::GroupedConvFwdHostArgs<> host_args( | ||
| param, inputs.input, inputs.weight, {}, outputs.output, args.k_batch); | ||
|
|
||
| auto kargs = Conv::MakeKernelArgs(host_args); | ||
|
|
||
| const dim3 grids = Conv::GridSize(kargs); | ||
| const dim3 blocks = Conv::BlockSize(); | ||
|
|
||
| if(!Conv::IsSupportedArgument(kargs)) | ||
| { | ||
| std::cout << "Not supported!"; | ||
| return 0.f; | ||
Snektron marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| } | ||
|
|
||
| constexpr index_t minimum_occupancy = | ||
| Conv::GemmPipeline::Scheduler == ck_tile::GemmPipelineScheduler::Intrawave ? 1 : 2; | ||
|
|
||
| return ck_tile::launch_kernel( | ||
| s_conf, ck_tile::make_kernel<minimum_occupancy>(conv, grids, blocks, 0, kargs)); | ||
| } | ||
|
|
||
| } // namespace ck_tile::builder::test | ||
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
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.
Do we want to make the instance generation code part of the CK Builder code? This is not really builder implementation but rather an application of the builder. I think the more natural place would under
/library/src/ck_tilesince we probably want to share this code between CK Tile Profiler and CK Tile Tests.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.
Alternative, we could consider placing the source code under
tile_engineif we'll unify the code generation approaches.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.
Good idea, I would like to do this in next PR to move this script under tile engine and align this to tile engine implementation