From e73c0550ce840f6013580722fb6426df1bbaf17b Mon Sep 17 00:00:00 2001 From: Bartlomiej Kocot Date: Mon, 16 Jun 2025 08:28:06 +0000 Subject: [PATCH] Revert "test gk bias" This reverts commit 8e42e29d7b64dfa12d15bb85932ce9dd0f334065. --- ...ofile_grouped_conv_fwd_bias_clamp_impl.hpp | 46 +-------- .../CMakeLists.txt | 3 - .../test_grouped_convnd_fwd_bias_clamp.cpp | 3 +- .../test_grouped_convnd_fwd_gk_bias_clamp.cpp | 93 ------------------- 4 files changed, 5 insertions(+), 140 deletions(-) delete mode 100644 test/grouped_convnd_fwd_activation/test_grouped_convnd_fwd_gk_bias_clamp.cpp diff --git a/profiler/include/profiler/profile_grouped_conv_fwd_bias_clamp_impl.hpp b/profiler/include/profiler/profile_grouped_conv_fwd_bias_clamp_impl.hpp index 7035f3e52f..3ef9f4505d 100644 --- a/profiler/include/profiler/profile_grouped_conv_fwd_bias_clamp_impl.hpp +++ b/profiler/include/profiler/profile_grouped_conv_fwd_bias_clamp_impl.hpp @@ -25,23 +25,6 @@ namespace ck { namespace profiler { -template -auto get_bias_desc(ck::index_t G, ck::index_t K) -{ - if constexpr(NDimSpatial == 1) - { - return HostTensorDescriptor({G, 1, K, 1}, {K, 0, 1, 0}); - } - else if constexpr(NDimSpatial == 2) - { - return HostTensorDescriptor({G, 1, K, 1, 1}, {K, 0, 1, 0, 0}); - } - else - { - return HostTensorDescriptor({G, 1, K, 1, 1, 1}, {K, 0, 1, 0, 0, 0}); - } -} - template + typename IndexType = ck::index_t> bool profile_grouped_conv_fwd_bias_clamp_impl(int do_verification, int init_method, bool do_log, @@ -79,16 +61,12 @@ bool profile_grouped_conv_fwd_bias_clamp_impl(int do_verification, const auto out_g_n_k_wos_desc = ck::utils::conv::make_output_host_tensor_descriptor_g_n_k_wos_packed(conv_param); - const index_t G = conv_param.G_; - const index_t K = conv_param.K_; - std::array a_g_n_c_wis_lengths{}; std::array a_g_n_c_wis_strides{}; std::array b_g_k_c_xs_lengths{}; std::array b_g_k_c_xs_strides{}; std::array e_g_n_k_wos_lengths{}; std::array e_g_n_k_wos_strides{}; - std::array d_g_n_k_wos_strides{}; std::array conv_filter_strides{}; std::array conv_filter_dilations{}; std::array input_left_pads{}; @@ -102,7 +80,6 @@ bool profile_grouped_conv_fwd_bias_clamp_impl(int do_verification, copy(wei_g_k_c_xs_desc.GetStrides(), b_g_k_c_xs_strides); copy(out_g_n_k_wos_desc.GetLengths(), e_g_n_k_wos_lengths); copy(out_g_n_k_wos_desc.GetStrides(), e_g_n_k_wos_strides); - copy(out_g_n_k_wos_desc.GetStrides(), d_g_n_k_wos_strides); copy(conv_param.conv_filter_strides_, conv_filter_strides); copy(conv_param.conv_filter_dilations_, conv_filter_dilations); copy(conv_param.input_left_pads_, input_left_pads); @@ -112,8 +89,7 @@ bool profile_grouped_conv_fwd_bias_clamp_impl(int do_verification, Tensor weight(wei_g_k_c_xs_desc); Tensor host_output(out_g_n_k_wos_desc); Tensor device_output(out_g_n_k_wos_desc); - const auto bias_desc = BiasGK ? get_bias_desc(G, K) : out_g_n_k_wos_desc; - Tensor bias(bias_desc); + Tensor bias(out_g_n_k_wos_desc); std::cout << "input: " << input.mDesc << std::endl; std::cout << "weight: " << weight.mDesc << std::endl; @@ -137,11 +113,7 @@ bool profile_grouped_conv_fwd_bias_clamp_impl(int do_verification, DeviceMem in_device_buf(sizeof(InDataType) * input.mDesc.GetElementSpaceSize()); DeviceMem wei_device_buf(sizeof(WeiDataType) * weight.mDesc.GetElementSpaceSize()); DeviceMem out_device_buf(sizeof(OutDataType) * device_output.mDesc.GetElementSpaceSize()); - - const std::size_t bias_dev_buf_size = - BiasGK ? sizeof(OutDataType) * G * K - : sizeof(OutDataType) * device_output.mDesc.GetElementSpaceSize(); - DeviceMem bias_device_buf(bias_dev_buf_size); + DeviceMem bias_device_buf(sizeof(OutDataType) * bias.mDesc.GetElementSpaceSize()); in_device_buf.ToDevice(input.mData.data()); wei_device_buf.ToDevice(weight.mData.data()); @@ -272,16 +244,6 @@ bool profile_grouped_conv_fwd_bias_clamp_impl(int do_verification, std::cout << "ckProfiler found " << op_ptrs.size() << " instances" << std::endl; - if constexpr(BiasGK) - { - constexpr ck::index_t spatial_offset = 3; - d_g_n_k_wos_strides[1] = 0; - for(int i = 0; i < NDimSpatial; i++) - { - d_g_n_k_wos_strides[i + spatial_offset] = 0; - } - } - for(auto& op_ptr : op_ptrs) { auto argument_ptr = op_ptr->MakeArgumentPointer(in_device_buf.GetDeviceBuffer(), @@ -293,7 +255,7 @@ bool profile_grouped_conv_fwd_bias_clamp_impl(int do_verification, b_g_k_c_xs_lengths, b_g_k_c_xs_strides, {e_g_n_k_wos_lengths}, - {d_g_n_k_wos_strides}, + {e_g_n_k_wos_strides}, e_g_n_k_wos_lengths, e_g_n_k_wos_strides, conv_filter_strides, diff --git a/test/grouped_convnd_fwd_activation/CMakeLists.txt b/test/grouped_convnd_fwd_activation/CMakeLists.txt index 8bded647b6..2a6528ff64 100644 --- a/test/grouped_convnd_fwd_activation/CMakeLists.txt +++ b/test/grouped_convnd_fwd_activation/CMakeLists.txt @@ -2,9 +2,6 @@ if(GPU_TARGETS MATCHES "gfx9") add_gtest_executable(test_grouped_convnd_fwd_bias_clamp test_grouped_convnd_fwd_bias_clamp.cpp) target_link_libraries(test_grouped_convnd_fwd_bias_clamp PRIVATE utility device_grouped_conv2d_fwd_bias_clamp_instance device_grouped_conv3d_fwd_bias_clamp_instance) - add_gtest_executable(test_grouped_convnd_fwd_gk_bias_clamp test_grouped_convnd_fwd_gk_bias_clamp.cpp) - target_link_libraries(test_grouped_convnd_fwd_gk_bias_clamp PRIVATE utility device_grouped_conv2d_fwd_bias_clamp_instance device_grouped_conv3d_fwd_bias_clamp_instance) - add_gtest_executable(test_grouped_convnd_fwd_clamp test_grouped_convnd_fwd_clamp.cpp) target_link_libraries(test_grouped_convnd_fwd_clamp PRIVATE utility device_grouped_conv2d_fwd_clamp_instance device_grouped_conv3d_fwd_clamp_instance) endif() diff --git a/test/grouped_convnd_fwd_activation/test_grouped_convnd_fwd_bias_clamp.cpp b/test/grouped_convnd_fwd_activation/test_grouped_convnd_fwd_bias_clamp.cpp index f3a569115a..7d5437d247 100644 --- a/test/grouped_convnd_fwd_activation/test_grouped_convnd_fwd_bias_clamp.cpp +++ b/test/grouped_convnd_fwd_activation/test_grouped_convnd_fwd_bias_clamp.cpp @@ -41,8 +41,7 @@ class TestGroupedConvndFwd : public ::testing::Test DataType, DataType, DataType, - IndexType, - false /*BiasGK*/>( + IndexType>( true, // do_verification 1, // init_method: integer value false, // do_log diff --git a/test/grouped_convnd_fwd_activation/test_grouped_convnd_fwd_gk_bias_clamp.cpp b/test/grouped_convnd_fwd_activation/test_grouped_convnd_fwd_gk_bias_clamp.cpp deleted file mode 100644 index 0a41eac286..0000000000 --- a/test/grouped_convnd_fwd_activation/test_grouped_convnd_fwd_gk_bias_clamp.cpp +++ /dev/null @@ -1,93 +0,0 @@ -// SPDX-License-Identifier: MIT -// Copyright (c) 2018-2025, Advanced Micro Devices, Inc. All rights reserved. - -#include -#include -#include -#include -#include - -#include "profiler/profile_grouped_conv_fwd_bias_clamp_impl.hpp" - -#include "ck/tensor_operation/gpu/element/element_wise_operation.hpp" - -using AddClamp = ck::tensor_operation::element_wise::AddClamp; - -template -class TestGroupedConvndFwd : public ::testing::Test -{ - protected: - using DataType = std::tuple_element_t<0, Tuple>; - using InLayout = std::tuple_element_t<1, Tuple>; - using WeiLayout = std::tuple_element_t<2, Tuple>; - using OutLayout = std::tuple_element_t<3, Tuple>; - using IndexType = ck::index_t; - - std::vector conv_params; - - template - void Run() - { - EXPECT_FALSE(conv_params.empty()); - bool pass = true; - for(auto& param : conv_params) - { - pass = pass && ck::profiler::profile_grouped_conv_fwd_bias_clamp_impl( - true, // do_verification - 1, // init_method: integer value - false, // do_log - false, // time_kernel - param); - } - EXPECT_TRUE(pass); - } -}; - -using namespace ck::tensor_layout::convolution; - -using KernelTypes2d = ::testing::Types>; - -using KernelTypes3d = ::testing::Types>; - -template -class TestGroupedConvndFwd2d : public TestGroupedConvndFwd -{ -}; - -template -class TestGroupedConvndFwd3d : public TestGroupedConvndFwd -{ -}; - -TYPED_TEST_SUITE(TestGroupedConvndFwd2d, KernelTypes2d); -TYPED_TEST_SUITE(TestGroupedConvndFwd3d, KernelTypes3d); - -TYPED_TEST(TestGroupedConvndFwd2d, Test2D) -{ - this->conv_params.clear(); - this->conv_params.push_back( - {2, 2, 32, 128, 256, {1, 1}, {7, 7}, {2, 2}, {1, 1}, {0, 0}, {0, 0}}); - this->conv_params.push_back( - {2, 2, 32, 128, 256, {3, 3}, {14, 14}, {1, 1}, {1, 1}, {1, 1}, {1, 1}}); - this->template Run<2>(); -} - -TYPED_TEST(TestGroupedConvndFwd3d, Test3D) -{ - this->conv_params.clear(); - this->conv_params.push_back( - {3, 2, 32, 128, 256, {1, 1, 1}, {7, 7, 7}, {2, 2, 2}, {1, 1, 1}, {0, 0, 0}, {0, 0, 0}}); - this->conv_params.push_back( - {3, 2, 32, 128, 256, {3, 3, 3}, {14, 14, 3}, {1, 1, 1}, {1, 1, 1}, {1, 1, 1}, {1, 1, 1}}); - this->template Run<3>(); -}