Skip to content

Commit 90da26c

Browse files
authored
[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.
1 parent 22d9f99 commit 90da26c

File tree

2 files changed

+60
-18
lines changed

2 files changed

+60
-18
lines changed

experimental/builder/README.md

Lines changed: 20 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,25 @@ cmake
3737

3838
## Building and testing
3939

40-
During development, build and test from the CK build directory with
40+
During development, all CK Builder tests can be built with command
41+
42+
```sh
43+
ninja test_ckb_all
44+
```
45+
46+
To execute all tests, run
47+
4148
```sh
42-
ninja test_conv_builder && bin/test_conv_builder
49+
ls bin/test_ckb_* | xargs -n1 sh -c
4350
```
51+
52+
Some tests involve building old CK convolution factories, which will take a long time.
53+
Hence, one might want to build only single test targets. For example
54+
55+
```sh
56+
ninja test_ckb_conv_builder && bin/test_ckb_conv_builder
57+
```
58+
59+
When adding new tests, please follow the convention where the CMake build target starts with a prefix `test_ckb`.
60+
This allows us to filter out the CK Builder tests from the set full CK repository tests.
61+
Also, the `test_ckb_all` target that builds all CK Builder tests relies on having the `test_ckb` prefix on the CMake build targets.

experimental/builder/test/CMakeLists.txt

Lines changed: 40 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -16,16 +16,16 @@ function(add_ck_builder_test test_name)
1616
target_link_libraries(${test_name} PRIVATE GTest::gtest_main GTest::gmock)
1717
endfunction()
1818

19-
# The test_conv_builder target has all the unit tests (each test should run < 10 ms)
20-
add_ck_builder_test(test_conv_builder
19+
# The test_ckb_conv_builder target has all the unit tests (each test should run < 10 ms)
20+
add_ck_builder_test(test_ckb_conv_builder
2121
test_conv_builder.cpp
22-
test_instance_traits.cpp
22+
test_fwd_instance_traits.cpp
2323
test_instance_traits_util.cpp)
2424

25-
add_ck_builder_test(test_inline_diff test_inline_diff.cpp)
25+
add_ck_builder_test(test_ckb_inline_diff test_inline_diff.cpp)
2626

2727
# Testing the virtual GetInstanceString methods requires kernel compilation.
28-
add_ck_builder_test(test_get_instance_string
28+
add_ck_builder_test(test_ckb_get_instance_string
2929
test_get_instance_string_fwd_grp_conv_v3.cpp
3030
test_get_instance_string_fwd_grp_conv.cpp
3131
test_get_instance_string_fwd_grp_conv_large_tensor.cpp)
@@ -46,15 +46,39 @@ function(add_ck_factory_test test_name)
4646
target_link_libraries(${test_name} PRIVATE composablekernels::device_conv_operations)
4747
endfunction()
4848

49-
add_ck_factory_test(test_testing_utils test_testing_utils.cpp)
50-
add_ck_factory_test(test_ck_factory_grouped_convolution_forward test_ck_factory_grouped_convolution_forward.cpp)
51-
add_ck_factory_test(test_ck_factory_grouped_convolution_forward_clamp test_ck_factory_grouped_convolution_forward_clamp.cpp)
52-
add_ck_factory_test(test_ck_factory_grouped_convolution_forward_convscale test_ck_factory_grouped_convolution_forward_convscale.cpp)
53-
add_ck_factory_test(test_ck_factory_grouped_convolution_forward_bilinear test_ck_factory_grouped_convolution_forward_bilinear.cpp)
54-
add_ck_factory_test(test_ck_factory_grouped_convolution_forward_scale test_ck_factory_grouped_convolution_forward_scale.cpp)
55-
add_ck_factory_test(test_ck_factory_grouped_convolution_forward_scaleadd_ab test_ck_factory_grouped_convolution_forward_scaleadd_ab.cpp)
56-
add_ck_factory_test(test_ck_factory_grouped_convolution_forward_bias_clamp test_ck_factory_grouped_convolution_forward_bias_clamp.cpp)
57-
add_ck_factory_test(test_ck_factory_grouped_convolution_forward_bias_bnorm_clamp test_ck_factory_grouped_convolution_forward_bias_bnorm_clamp.cpp)
58-
add_ck_factory_test(test_ck_factory_grouped_convolution_forward_scaleadd_scaleadd_relu test_ck_factory_grouped_convolution_forward_scaleadd_scaleadd_relu.cpp)
59-
add_ck_factory_test(test_ck_factory_grouped_convolution_forward_dynamic_op test_ck_factory_grouped_convolution_forward_dynamic_op.cpp)
49+
add_ck_factory_test(test_ckb_testing_utils test_testing_utils.cpp)
50+
add_ck_factory_test(test_ckb_factory_grouped_convolution_forward test_ck_factory_grouped_convolution_forward.cpp)
51+
add_ck_factory_test(test_ckb_factory_grouped_convolution_forward_clamp test_ck_factory_grouped_convolution_forward_clamp.cpp)
52+
add_ck_factory_test(test_ckb_factory_grouped_convolution_forward_convscale test_ck_factory_grouped_convolution_forward_convscale.cpp)
53+
add_ck_factory_test(test_ckb_factory_grouped_convolution_forward_bilinear test_ck_factory_grouped_convolution_forward_bilinear.cpp)
54+
add_ck_factory_test(test_ckb_factory_grouped_convolution_forward_scale test_ck_factory_grouped_convolution_forward_scale.cpp)
55+
add_ck_factory_test(test_ckb_factory_grouped_convolution_forward_scaleadd_ab test_ck_factory_grouped_convolution_forward_scaleadd_ab.cpp)
56+
add_ck_factory_test(test_ckb_factory_grouped_convolution_forward_bias_clamp test_ck_factory_grouped_convolution_forward_bias_clamp.cpp)
57+
add_ck_factory_test(test_ckb_factory_grouped_convolution_forward_bias_bnorm_clamp test_ck_factory_grouped_convolution_forward_bias_bnorm_clamp.cpp)
58+
add_ck_factory_test(test_ckb_factory_grouped_convolution_forward_scaleadd_scaleadd_relu test_ck_factory_grouped_convolution_forward_scaleadd_scaleadd_relu.cpp)
59+
add_ck_factory_test(test_ckb_factory_grouped_convolution_forward_dynamic_op test_ck_factory_grouped_convolution_forward_dynamic_op.cpp)
6060

61+
# Function to add all test_ckb targets to a list
62+
function(collect_test_ckb_targets result_var)
63+
# Get all targets in current directory
64+
get_directory_property(all_targets BUILDSYSTEM_TARGETS)
65+
66+
set(test_ckb_targets)
67+
foreach(target ${all_targets})
68+
# Check if target name starts with "test_ckb"
69+
string(REGEX MATCH "^test_ckb" match_result ${target})
70+
if(match_result)
71+
list(APPEND test_ckb_targets ${target})
72+
endif()
73+
endforeach()
74+
75+
set(${result_var} ${test_ckb_targets} PARENT_SCOPE)
76+
endfunction()
77+
78+
# Create the custom target
79+
collect_test_ckb_targets(TEST_CKB_TARGETS)
80+
add_custom_target(test_ckb_all)
81+
add_dependencies(test_ckb_all ${TEST_CKB_TARGETS})
82+
83+
# Optional: Print the collected targets for verification
84+
message(STATUS "Found following CK Builder test targets: ${TEST_CKB_TARGETS}")

0 commit comments

Comments
 (0)