From f65d76ed3706a91a176d920e55c91d4c8a25499c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ville=20Pietil=C3=A4?= <188998872+vpietila-amd@users.noreply.github.com> Date: Fri, 31 Oct 2025 01:08:32 +0200 Subject: [PATCH] [CK_BUILDER] Rename CK Builder test targets with consistent prefix test_ckb (#3114) * Rename CK Builder test targets with consistent prefix test_ckb. * Add test_ckb_all target to build all CK Builder tests. * Update Readme for CK Builder. [ROCm/composable_kernel commit: 90da26ccfd16ef0ba92a80d2044239636eab91ef] --- experimental/builder/README.md | 22 +++++++++- experimental/builder/test/CMakeLists.txt | 56 +++++++++++++++++------- 2 files changed, 60 insertions(+), 18 deletions(-) diff --git a/experimental/builder/README.md b/experimental/builder/README.md index 26755795b3..141a34b9f9 100644 --- a/experimental/builder/README.md +++ b/experimental/builder/README.md @@ -37,7 +37,25 @@ cmake ## Building and testing -During development, build and test from the CK build directory with +During development, all CK Builder tests can be built with command + ```sh -ninja test_conv_builder && bin/test_conv_builder +ninja test_ckb_all ``` + +To execute all tests, run + +```sh +ls bin/test_ckb_* | xargs -n1 sh -c +``` + +Some tests involve building old CK convolution factories, which will take a long time. +Hence, one might want to build only single test targets. For example + +```sh +ninja test_ckb_conv_builder && bin/test_ckb_conv_builder +``` + +When adding new tests, please follow the convention where the CMake build target starts with a prefix `test_ckb`. +This allows us to filter out the CK Builder tests from the set full CK repository tests. +Also, the `test_ckb_all` target that builds all CK Builder tests relies on having the `test_ckb` prefix on the CMake build targets. diff --git a/experimental/builder/test/CMakeLists.txt b/experimental/builder/test/CMakeLists.txt index b7adbc116a..c54c26cb67 100644 --- a/experimental/builder/test/CMakeLists.txt +++ b/experimental/builder/test/CMakeLists.txt @@ -16,16 +16,16 @@ function(add_ck_builder_test test_name) target_link_libraries(${test_name} PRIVATE GTest::gtest_main GTest::gmock) endfunction() -# The test_conv_builder target has all the unit tests (each test should run < 10 ms) -add_ck_builder_test(test_conv_builder +# The test_ckb_conv_builder target has all the unit tests (each test should run < 10 ms) +add_ck_builder_test(test_ckb_conv_builder test_conv_builder.cpp - test_instance_traits.cpp + test_fwd_instance_traits.cpp test_instance_traits_util.cpp) -add_ck_builder_test(test_inline_diff test_inline_diff.cpp) +add_ck_builder_test(test_ckb_inline_diff test_inline_diff.cpp) # Testing the virtual GetInstanceString methods requires kernel compilation. -add_ck_builder_test(test_get_instance_string +add_ck_builder_test(test_ckb_get_instance_string test_get_instance_string_fwd_grp_conv_v3.cpp test_get_instance_string_fwd_grp_conv.cpp test_get_instance_string_fwd_grp_conv_large_tensor.cpp) @@ -46,15 +46,39 @@ function(add_ck_factory_test test_name) target_link_libraries(${test_name} PRIVATE composablekernels::device_conv_operations) endfunction() -add_ck_factory_test(test_testing_utils test_testing_utils.cpp) -add_ck_factory_test(test_ck_factory_grouped_convolution_forward test_ck_factory_grouped_convolution_forward.cpp) -add_ck_factory_test(test_ck_factory_grouped_convolution_forward_clamp test_ck_factory_grouped_convolution_forward_clamp.cpp) -add_ck_factory_test(test_ck_factory_grouped_convolution_forward_convscale test_ck_factory_grouped_convolution_forward_convscale.cpp) -add_ck_factory_test(test_ck_factory_grouped_convolution_forward_bilinear test_ck_factory_grouped_convolution_forward_bilinear.cpp) -add_ck_factory_test(test_ck_factory_grouped_convolution_forward_scale test_ck_factory_grouped_convolution_forward_scale.cpp) -add_ck_factory_test(test_ck_factory_grouped_convolution_forward_scaleadd_ab test_ck_factory_grouped_convolution_forward_scaleadd_ab.cpp) -add_ck_factory_test(test_ck_factory_grouped_convolution_forward_bias_clamp test_ck_factory_grouped_convolution_forward_bias_clamp.cpp) -add_ck_factory_test(test_ck_factory_grouped_convolution_forward_bias_bnorm_clamp test_ck_factory_grouped_convolution_forward_bias_bnorm_clamp.cpp) -add_ck_factory_test(test_ck_factory_grouped_convolution_forward_scaleadd_scaleadd_relu test_ck_factory_grouped_convolution_forward_scaleadd_scaleadd_relu.cpp) -add_ck_factory_test(test_ck_factory_grouped_convolution_forward_dynamic_op test_ck_factory_grouped_convolution_forward_dynamic_op.cpp) +add_ck_factory_test(test_ckb_testing_utils test_testing_utils.cpp) +add_ck_factory_test(test_ckb_factory_grouped_convolution_forward test_ck_factory_grouped_convolution_forward.cpp) +add_ck_factory_test(test_ckb_factory_grouped_convolution_forward_clamp test_ck_factory_grouped_convolution_forward_clamp.cpp) +add_ck_factory_test(test_ckb_factory_grouped_convolution_forward_convscale test_ck_factory_grouped_convolution_forward_convscale.cpp) +add_ck_factory_test(test_ckb_factory_grouped_convolution_forward_bilinear test_ck_factory_grouped_convolution_forward_bilinear.cpp) +add_ck_factory_test(test_ckb_factory_grouped_convolution_forward_scale test_ck_factory_grouped_convolution_forward_scale.cpp) +add_ck_factory_test(test_ckb_factory_grouped_convolution_forward_scaleadd_ab test_ck_factory_grouped_convolution_forward_scaleadd_ab.cpp) +add_ck_factory_test(test_ckb_factory_grouped_convolution_forward_bias_clamp test_ck_factory_grouped_convolution_forward_bias_clamp.cpp) +add_ck_factory_test(test_ckb_factory_grouped_convolution_forward_bias_bnorm_clamp test_ck_factory_grouped_convolution_forward_bias_bnorm_clamp.cpp) +add_ck_factory_test(test_ckb_factory_grouped_convolution_forward_scaleadd_scaleadd_relu test_ck_factory_grouped_convolution_forward_scaleadd_scaleadd_relu.cpp) +add_ck_factory_test(test_ckb_factory_grouped_convolution_forward_dynamic_op test_ck_factory_grouped_convolution_forward_dynamic_op.cpp) +# Function to add all test_ckb targets to a list +function(collect_test_ckb_targets result_var) + # Get all targets in current directory + get_directory_property(all_targets BUILDSYSTEM_TARGETS) + + set(test_ckb_targets) + foreach(target ${all_targets}) + # Check if target name starts with "test_ckb" + string(REGEX MATCH "^test_ckb" match_result ${target}) + if(match_result) + list(APPEND test_ckb_targets ${target}) + endif() + endforeach() + + set(${result_var} ${test_ckb_targets} PARENT_SCOPE) +endfunction() + +# Create the custom target +collect_test_ckb_targets(TEST_CKB_TARGETS) +add_custom_target(test_ckb_all) +add_dependencies(test_ckb_all ${TEST_CKB_TARGETS}) + +# Optional: Print the collected targets for verification +message(STATUS "Found following CK Builder test targets: ${TEST_CKB_TARGETS}")