ROCm / composable_kernel

Composable Kernel: Performance Portable Programming Model for Machine Learning Tensor Operators
https://rocm.docs.amd.com/projects/composable_kernel/en/latest/
Other
303 stars 120 forks source link

Spit add_example_executable and use add_example_test #248

Open qianfengz opened 2 years ago

qianfengz commented 2 years ago

Have add_example_test() separated from add_example_executable() enables more testing command-lines being added for each single example. And having the add_example_test() enables the developer to use one example .cpp and executable to support multiple testing cases from the example, which saves compiling time and makes development easier.

The CMakeLists.txt will be like the following:


add_example_executable(example_exe  example_source.cpp)
add_example_test(example_test_case_1 example_exe arg1, arg2, ...)
add_example_test(example_test_case_2 example_exe arg2, arg2, ...)
rosenrodt commented 2 years ago

I think CMake does the equivalent thing under the hood. It resolves target dependency and reuses build cache where possible, so it doesn't rebuild the same binary more than once. Can you find a counter-example?

qianfengz commented 2 years ago

How I add a different testing case using the same executable under the current framework ?

rosenrodt commented 2 years ago

I think I get what you mean now. Doing so does produce 2 executables and doubles compilation time. I was using ccache so I got the wrong impression that CMake will avoid compiling twice.

add_example_executable(example_gemm_xdl_fp16_test1 gemm_xdl_fp16.cpp)
add_example_executable(example_gemm_xdl_fp16_test2 gemm_xdl_fp16.cpp 0 1 10 7680 8192 8192 8192 8192 8192)

So yeah I agree this is lacking. But I lean more toward that add_example_executable by default will be run by CTest. And we add extra helper function to add extra test params for the example code.

ppanchad-amd commented 2 months ago

@qianfengz Is this ticket still relevant? If not, please close the ticket. Thanks!