# Copyright (c) Advanced Micro Devices, Inc., or its affiliates.
# SPDX-License-Identifier: MIT

# Currently ck_tile_gemm is only built on gfx94/gfx95
set(EXAMPLE_GEMM_COMPILE_OPTIONS)
if(CK_USE_OCP_FP8)
    list(APPEND EXAMPLE_GEMM_COMPILE_OPTIONS -DCK_TILE_USE_OCP_FP8)
endif()
set(EXAMPLE_GEMM_COMPILE_COMPUTE_V4_OPTIONS)
if(CK_USE_OCP_FP8)
    list(APPEND EXAMPLE_GEMM_COMPILE_COMPUTE_V4_OPTIONS -DCK_TILE_USE_OCP_FP8)
endif()
list(APPEND EXAMPLE_GEMM_COMPILE_COMPUTE_V4_OPTIONS
    -mllvm
    -enable-noalias-to-md-conversion=0
)
set(EXAMPLE_GEMM_COMPILE_COMPUTE_ASYNC_OPTIONS ${EXAMPLE_GEMM_COMPILE_COMPUTE_V4_OPTIONS})

if(GPU_TARGETS MATCHES "gfx94|gfx95|gfx90a|gfx11|gfx12")
    # Collect all test targets for umbrella label
    set(CK_TILE_GEMM_TEST_TARGETS)

    # Host dispatch also instantiates device kernels. Check its CompV3 schedule
    # in both MFMA and WMMA builds without allocating or launching on a GPU.
    add_gtest_executable(test_ck_tile_gemm_compv3_tail_dispatch test_gemm_compv3_tail_dispatch.cpp)
    target_compile_options(test_ck_tile_gemm_compv3_tail_dispatch PRIVATE ${EXAMPLE_GEMM_COMPILE_OPTIONS})
    list(APPEND CK_TILE_GEMM_TEST_TARGETS test_ck_tile_gemm_compv3_tail_dispatch)

    # Host-only: the K sub-tile count rounding of the TDM and async default policies.
    add_gtest_executable(test_ck_tile_gemm_sub_tile_num test_gemm_sub_tile_num.cpp)
    list(APPEND CK_TILE_GEMM_TEST_TARGETS test_ck_tile_gemm_sub_tile_num)

    if(GPU_TARGETS MATCHES "gfx94|gfx95")
        # This synthetic argument-validation fixture models the XDL pipeline
        # interface; keep it out of the gfx11/gfx12 WMMA build.
        add_gtest_executable(test_ck_tile_universal_gemm_argument_validation
            test_universal_gemm_argument_validation.cpp)
        list(APPEND CK_TILE_GEMM_TEST_TARGETS
            test_ck_tile_universal_gemm_argument_validation)

        add_gtest_executable(test_ck_tile_gemm_pipeline_mem test_gemm_pipeline_mem.cpp)
        add_gtest_executable(test_ck_tile_gemm_pipeline_compv3 test_gemm_pipeline_compv3.cpp)
        add_gtest_executable(test_ck_tile_gemm_pipeline_compv4 test_gemm_pipeline_compv4.cpp)
        add_gtest_executable(test_ck_tile_gemm_pipeline_persistent test_gemm_pipeline_persistent.cpp)
        add_gtest_executable(test_ck_tile_gemm_pipeline_compv6 test_gemm_pipeline_compv6.cpp)

        target_compile_options(test_ck_tile_gemm_pipeline_mem PRIVATE ${EXAMPLE_GEMM_COMPILE_OPTIONS})
        target_compile_options(test_ck_tile_gemm_pipeline_compv3 PRIVATE ${EXAMPLE_GEMM_COMPILE_OPTIONS})
        target_compile_options(test_ck_tile_gemm_pipeline_compv4 PRIVATE ${EXAMPLE_GEMM_COMPILE_COMPUTE_V4_OPTIONS})
        target_compile_options(test_ck_tile_gemm_pipeline_persistent PRIVATE ${EXAMPLE_GEMM_COMPILE_OPTIONS})
        target_compile_options(test_ck_tile_gemm_pipeline_compv6 PRIVATE ${EXAMPLE_GEMM_COMPILE_OPTIONS})

        list(APPEND CK_TILE_GEMM_TEST_TARGETS
            test_ck_tile_gemm_pipeline_mem
            test_ck_tile_gemm_pipeline_compv3
            test_ck_tile_gemm_pipeline_compv4
            test_ck_tile_gemm_pipeline_persistent
            test_ck_tile_gemm_pipeline_compv6
        )
    endif()

    if(GPU_TARGETS MATCHES "gfx95")
        add_gtest_executable(test_ck_tile_gemm_pipeline_comp_async test_gemm_pipeline_comp_async.cpp)
        target_compile_options(test_ck_tile_gemm_pipeline_comp_async PRIVATE ${EXAMPLE_GEMM_COMPILE_COMPUTE_ASYNC_OPTIONS})

        add_gtest_executable(test_ck_tile_gemm_pipeline_comp_async_v2 test_gemm_pipeline_comp_async_v2.cpp)
        target_compile_options(test_ck_tile_gemm_pipeline_comp_async_v2 PRIVATE ${EXAMPLE_GEMM_COMPILE_COMPUTE_ASYNC_OPTIONS})

        add_gtest_executable(test_ck_tile_gemm_pipeline_tf32_mem test_gemm_pipeline_tf32_mem.cpp)
        target_compile_options(test_ck_tile_gemm_pipeline_tf32_mem PRIVATE ${EXAMPLE_GEMM_COMPILE_OPTIONS})

        list(APPEND CK_TILE_GEMM_TEST_TARGETS
            test_ck_tile_gemm_pipeline_comp_async
            test_ck_tile_gemm_pipeline_comp_async_v2
            test_ck_tile_gemm_pipeline_tf32_mem
        )

        add_gtest_executable(test_ck_tile_gemm_pipeline_comp_async_eight_waves test_gemm_pipeline_comp_async_eight_waves.cpp)
        target_compile_options(test_ck_tile_gemm_pipeline_comp_async_eight_waves PRIVATE ${EXAMPLE_GEMM_COMPILE_COMPUTE_ASYNC_OPTIONS})

        list(APPEND CK_TILE_GEMM_TEST_TARGETS
            test_ck_tile_gemm_pipeline_comp_async_eight_waves
        )

        add_gtest_executable(test_ck_tile_gemm_pipeline_compv3_async_rrr test_gemm_pipeline_compv3_async_rrr.cpp)
        target_compile_options(test_ck_tile_gemm_pipeline_compv3_async_rrr PRIVATE ${EXAMPLE_GEMM_COMPILE_COMPUTE_ASYNC_OPTIONS})

        list(APPEND CK_TILE_GEMM_TEST_TARGETS
            test_ck_tile_gemm_pipeline_compv3_async_rrr
        )

        add_gtest_executable(test_ck_tile_gemm_pipeline_compv3_async_rcr test_gemm_pipeline_compv3_async_rcr.cpp)
        target_compile_options(test_ck_tile_gemm_pipeline_compv3_async_rcr PRIVATE ${EXAMPLE_GEMM_COMPILE_COMPUTE_ASYNC_OPTIONS})

        list(APPEND CK_TILE_GEMM_TEST_TARGETS
            test_ck_tile_gemm_pipeline_compv3_async_rcr
        )

        add_gtest_executable(test_ck_tile_gemm_pipeline_compv3_async_ccr test_gemm_pipeline_compv3_async_ccr.cpp)
        target_compile_options(test_ck_tile_gemm_pipeline_compv3_async_ccr PRIVATE ${EXAMPLE_GEMM_COMPILE_COMPUTE_ASYNC_OPTIONS})

        list(APPEND CK_TILE_GEMM_TEST_TARGETS
            test_ck_tile_gemm_pipeline_compv3_async_ccr
        )

        add_gtest_executable(test_ck_tile_gemm_pipeline_compv3_async_crr test_gemm_pipeline_compv3_async_crr.cpp)
        target_compile_options(test_ck_tile_gemm_pipeline_compv3_async_crr PRIVATE ${EXAMPLE_GEMM_COMPILE_COMPUTE_ASYNC_OPTIONS})

        list(APPEND CK_TILE_GEMM_TEST_TARGETS
            test_ck_tile_gemm_pipeline_compv3_async_crr
        )

        add_gtest_executable(test_ck_tile_gemm_pipeline_compv3_async_persistent test_gemm_pipeline_compv3_async_persistent.cpp)
        target_compile_options(test_ck_tile_gemm_pipeline_compv3_async_persistent PRIVATE ${EXAMPLE_GEMM_COMPILE_COMPUTE_ASYNC_OPTIONS})

        list(APPEND CK_TILE_GEMM_TEST_TARGETS
            test_ck_tile_gemm_pipeline_compv3_async_persistent
        )
    endif()

    if(GPU_TARGETS MATCHES "gfx11|gfx12")
        # On Radeon devices, build the WMMA version instead
        # Define architecture macros for compile-time detection
        if(GPU_TARGETS MATCHES "gfx12")
            list(APPEND EXAMPLE_GEMM_COMPILE_OPTIONS -DARCH_GFX12)
            list(APPEND EXAMPLE_GEMM_COMPILE_COMPUTE_V4_OPTIONS -DARCH_GFX12)
        elseif(GPU_TARGETS MATCHES "gfx11")
            list(APPEND EXAMPLE_GEMM_COMPILE_OPTIONS -DARCH_GFX11)
            list(APPEND EXAMPLE_GEMM_COMPILE_COMPUTE_V4_OPTIONS -DARCH_GFX11)
        endif()

        add_gtest_executable(test_ck_tile_gemm_pipeline_mem_wmma test_gemm_pipeline_mem_wmma.cpp)
        add_gtest_executable(test_ck_tile_gemm_pipeline_compv3_wmma test_gemm_pipeline_compv3_wmma.cpp)
        add_gtest_executable(test_ck_tile_gemm_pipeline_compv4_wmma test_gemm_pipeline_compv4_wmma.cpp)
        add_gtest_executable(test_ck_tile_gemm_pipeline_persistent_wmma test_gemm_pipeline_persistent_wmma.cpp)
        add_gtest_executable(test_ck_tile_gemm_unaligned_mnk_wmma test_gemm_unaligned_mnk.cpp)
        target_compile_options(test_ck_tile_gemm_pipeline_mem_wmma PRIVATE ${EXAMPLE_GEMM_COMPILE_OPTIONS})
        target_compile_options(test_ck_tile_gemm_pipeline_compv3_wmma PRIVATE ${EXAMPLE_GEMM_COMPILE_OPTIONS})
        target_compile_options(test_ck_tile_gemm_pipeline_compv4_wmma PRIVATE ${EXAMPLE_GEMM_COMPILE_COMPUTE_V4_OPTIONS})
        target_compile_options(test_ck_tile_gemm_pipeline_persistent_wmma PRIVATE ${EXAMPLE_GEMM_COMPILE_OPTIONS})
        target_compile_options(test_ck_tile_gemm_unaligned_mnk_wmma PRIVATE ${EXAMPLE_GEMM_COMPILE_OPTIONS})
        target_include_directories(test_ck_tile_gemm_unaligned_mnk_wmma PRIVATE
            ${PROJECT_SOURCE_DIR}/example/ck_tile
            ${PROJECT_SOURCE_DIR}/example/ck_tile/03_gemm)

        # Test GEMM with K not a multiple of the A/B load vector width
        add_gtest_executable(test_gemm_unaligned_k test_gemm_unaligned_k.cpp)
        target_include_directories(test_gemm_unaligned_k PRIVATE
            ${PROJECT_SOURCE_DIR}/example/ck_tile
            ${CMAKE_SOURCE_DIR}/example/ck_tile/03_gemm)
        target_compile_options(test_gemm_unaligned_k PRIVATE ${EXAMPLE_GEMM_COMPILE_OPTIONS})

        list(APPEND CK_TILE_GEMM_TEST_TARGETS
            test_ck_tile_gemm_pipeline_mem_wmma
            test_ck_tile_gemm_pipeline_compv3_wmma
            test_ck_tile_gemm_pipeline_compv4_wmma
            test_ck_tile_gemm_pipeline_persistent_wmma
            test_ck_tile_gemm_unaligned_mnk_wmma
            test_gemm_unaligned_k
        )

        if(GPU_TARGETS MATCHES "gfx125")
            add_gtest_executable(test_ck_tile_gemm_pipeline_tdm_wmma test_gemm_pipeline_comp_tdm_wmma.cpp)
            target_compile_options(test_ck_tile_gemm_pipeline_tdm_wmma PRIVATE ${EXAMPLE_GEMM_COMPILE_OPTIONS})
            add_gtest_executable(test_ck_tile_gemm_pipeline_tdm_subtile_wmma test_gemm_pipeline_comp_tdm_wmma_subtile.cpp)
            target_compile_options(test_ck_tile_gemm_pipeline_tdm_subtile_wmma PRIVATE ${EXAMPLE_GEMM_COMPILE_OPTIONS})
            ck_tile_restrict_archs(test_ck_tile_gemm_pipeline_tdm_subtile_wmma "^gfx125")
            list(APPEND CK_TILE_GEMM_TEST_TARGETS test_ck_tile_gemm_pipeline_tdm_subtile_wmma)
            add_gtest_executable(test_ck_tile_gemm_pipeline_tdm_atomic_wmma test_gemm_pipeline_comp_tdm_atomic_wmma.cpp)
            target_compile_options(test_ck_tile_gemm_pipeline_tdm_atomic_wmma PRIVATE ${EXAMPLE_GEMM_COMPILE_OPTIONS})
            target_compile_definitions(test_ck_tile_gemm_pipeline_tdm_atomic_wmma PRIVATE BARRIER_ATOMIC_IN_TDM=1) # atomic barrier in TDM pipeline
            get_target_property(_tdm_atomic_archs test_ck_tile_gemm_pipeline_tdm_atomic_wmma HIP_ARCHITECTURES)
            list(FILTER _tdm_atomic_archs INCLUDE REGEX "^gfx125")
            set_property(TARGET test_ck_tile_gemm_pipeline_tdm_atomic_wmma PROPERTY HIP_ARCHITECTURES ${_tdm_atomic_archs})
            list(APPEND CK_TILE_GEMM_TEST_TARGETS test_ck_tile_gemm_pipeline_tdm_atomic_wmma)
            add_gtest_executable(test_ck_tile_gemm_pipeline_tdm_lds_padding_wmma test_gemm_pipeline_comp_tdm_lds_padding_wmma.cpp)
            target_compile_options(test_ck_tile_gemm_pipeline_tdm_lds_padding_wmma PRIVATE ${EXAMPLE_GEMM_COMPILE_OPTIONS})
            get_target_property(_tdm_lds_padding_archs test_ck_tile_gemm_pipeline_tdm_lds_padding_wmma HIP_ARCHITECTURES)
            list(FILTER _tdm_lds_padding_archs INCLUDE REGEX "^gfx125")
            set_property(TARGET test_ck_tile_gemm_pipeline_tdm_lds_padding_wmma PROPERTY HIP_ARCHITECTURES ${_tdm_lds_padding_archs})
            list(APPEND CK_TILE_GEMM_TEST_TARGETS test_ck_tile_gemm_pipeline_tdm_lds_padding_wmma)
            add_gtest_executable(test_ck_tile_gemm_pipeline_tdm_producer_consumer_wmma
                test_gemm_pipeline_comp_tdm_producer_consumer_wmma.cpp)
            target_compile_options(test_ck_tile_gemm_pipeline_tdm_producer_consumer_wmma
                PRIVATE ${EXAMPLE_GEMM_COMPILE_OPTIONS})
            # Same reason as tdm_subtile_wmma above: "_wmma" drops gfx9 only, and off
            # gfx1250 named_barrier is uninstantiable by design (static_assert), so the
            # surviving gfx11/gfx12 archs would fail the device pass.
            get_target_property(_tdm_pc_archs
                test_ck_tile_gemm_pipeline_tdm_producer_consumer_wmma HIP_ARCHITECTURES)
            list(FILTER _tdm_pc_archs INCLUDE REGEX "^gfx125")
            set_property(TARGET test_ck_tile_gemm_pipeline_tdm_producer_consumer_wmma
                PROPERTY HIP_ARCHITECTURES ${_tdm_pc_archs})
            # A broken named barrier handshake hangs rather than failing, so cap the run
            # instead of letting it hold a GPU for the 1500s CTest default.
            set_tests_properties(test_ck_tile_gemm_pipeline_tdm_producer_consumer_wmma
                PROPERTIES TIMEOUT 900)
            list(APPEND CK_TILE_GEMM_TEST_TARGETS test_ck_tile_gemm_pipeline_tdm_producer_consumer_wmma)
            # comp_tdm_v3 (gfx1250 TDM fp8 pipeline). Labelled after the relabel loop below so they
            # keep SMOKE_TEST (short shapes) and REGRESSION_TEST (K = 65536, listed in
            # REGRESSION_TESTS in test/CMakeLists.txt: minutes under the emulator).
            add_gtest_executable(test_ck_tile_gemm_pipeline_comp_tdm_v3_wmma
                test_gemm_pipeline_comp_tdm_v3_wmma.cpp)
            add_gtest_executable(test_ck_tile_gemm_pipeline_comp_tdm_v3_longk_wmma
                test_gemm_pipeline_comp_tdm_v3_longk_wmma.cpp)
            # bf16 instances in every A/B layout: short shapes and unaligned M/N/K (SMOKE_TEST) and
            # 4096^3 (REGRESSION_TEST).
            add_gtest_executable(test_ck_tile_gemm_pipeline_comp_tdm_v3_bf16_wmma
                test_gemm_pipeline_comp_tdm_v3_bf16_wmma.cpp)
            add_gtest_executable(test_ck_tile_gemm_pipeline_comp_tdm_v3_bf16_large_wmma
                test_gemm_pipeline_comp_tdm_v3_bf16_large_wmma.cpp)
            add_gtest_executable(test_ck_tile_gemm_pipeline_comp_tdm_v3_unaligned_mnk_wmma
                test_gemm_pipeline_comp_tdm_v3_unaligned_mnk_wmma.cpp)
            foreach(test_target test_ck_tile_gemm_pipeline_comp_tdm_v3_wmma
                                test_ck_tile_gemm_pipeline_comp_tdm_v3_longk_wmma
                                test_ck_tile_gemm_pipeline_comp_tdm_v3_bf16_wmma
                                test_ck_tile_gemm_pipeline_comp_tdm_v3_bf16_large_wmma
                                test_ck_tile_gemm_pipeline_comp_tdm_v3_unaligned_mnk_wmma)
                target_compile_options(${test_target} PRIVATE ${EXAMPLE_GEMM_COMPILE_OPTIONS})
                # Re-enable, for these targets only, the post-RA machine scheduler that the top-level
                # CMakeLists turns off (-enable-post-misched=0; the later option wins). It issues the
                # split barrier's LDS reads in bursts with progressive waits instead of a full drain
                # before each WMMA.
                target_compile_options(${test_target} PRIVATE "SHELL:-mllvm -enable-post-misched=1")
                ck_tile_restrict_archs(${test_target} "^gfx125")
            endforeach()
            # Fails if a compiler change makes the comp_tdm_v3 kernels use scratch.
            get_filename_component(_llvm_bin_dir "${CMAKE_CXX_COMPILER}" DIRECTORY)
            find_program(CK_LLVM_OBJDUMP llvm-objdump HINTS "${_llvm_bin_dir}" NO_DEFAULT_PATH)
            find_program(CK_LLVM_READELF llvm-readelf HINTS "${_llvm_bin_dir}" NO_DEFAULT_PATH)
            foreach(_v3_suffix "" "_bf16")
                set(_v3_binary test_ck_tile_gemm_pipeline_comp_tdm_v3${_v3_suffix}_wmma)
                set(_v3_check test_ck_tile_gemm_pipeline_comp_tdm_v3${_v3_suffix}_resources)
                if(TARGET ${_v3_binary} AND CK_LLVM_OBJDUMP AND CK_LLVM_READELF)
                    add_test(NAME ${_v3_check}
                        COMMAND ${CMAKE_COMMAND}
                            -DTEST_BINARY=$<TARGET_FILE:${_v3_binary}>
                            -DLLVM_OBJDUMP=${CK_LLVM_OBJDUMP}
                            -DLLVM_READELF=${CK_LLVM_READELF}
                            -DWORK_DIR=${CMAKE_CURRENT_BINARY_DIR}/comp_tdm_v3${_v3_suffix}_resources
                            -P ${CMAKE_CURRENT_SOURCE_DIR}/check_comp_tdm_v3_resources.cmake)
                    set_tests_properties(${_v3_check}
                        PROPERTIES LABELS "SMOKE_TEST;CK_TILE_GEMM_TESTS")
                endif()
            endforeach()
            add_gtest_executable(test_ck_tile_gemm_pipeline_comp_async_wmma test_gemm_pipeline_comp_async_wmma.cpp)
            target_compile_options(test_ck_tile_gemm_pipeline_comp_async_wmma PRIVATE ${EXAMPLE_GEMM_COMPILE_COMPUTE_ASYNC_OPTIONS})
            target_compile_options(test_ck_tile_gemm_pipeline_comp_async_wmma PRIVATE ${EXAMPLE_GEMM_COMPILE_OPTIONS})
            add_gtest_executable(test_ck_tile_gemm_pipeline_comp_async_v2_wmma test_gemm_pipeline_comp_async_v2_wmma.cpp)
            target_compile_options(test_ck_tile_gemm_pipeline_comp_async_v2_wmma PRIVATE ${EXAMPLE_GEMM_COMPILE_COMPUTE_ASYNC_OPTIONS})
            target_compile_options(test_ck_tile_gemm_pipeline_comp_async_v2_wmma PRIVATE ${EXAMPLE_GEMM_COMPILE_OPTIONS})
            set(CK_TILE_GEMM_ASYNC_WMMA_TARGETS
                test_ck_tile_gemm_pipeline_comp_async_wmma
                test_ck_tile_gemm_pipeline_comp_async_v2_wmma
            )
            foreach(test_target ${CK_TILE_GEMM_ASYNC_WMMA_TARGETS})
                # The async global-to-LDS loads only exist on gfx125 among the WMMA targets.
                ck_tile_restrict_archs(${test_target} "^gfx125")
            endforeach()
            list(APPEND CK_TILE_GEMM_TEST_TARGETS ${CK_TILE_GEMM_ASYNC_WMMA_TARGETS})
        endif()
    endif()

    # Label all ck_tile gemm tests with CK_TILE_GEMM_TESTS for selective execution
    foreach(test_target ${CK_TILE_GEMM_TEST_TARGETS})
        set_tests_properties(${test_target} PROPERTIES LABELS "CK_TILE_GEMM_TESTS")
    endforeach()
    # The loop above replaces the SMOKE_TEST label, and the gfx1250 CI stage only runs "ninja smoke".
    # Keep the gfx125 async-LDS tests and the TDM LDS padding test in that set; all of them fit the
    # smoke time budget on the gfx1250 emulator.
    foreach(test_target ${CK_TILE_GEMM_ASYNC_WMMA_TARGETS} test_ck_tile_gemm_pipeline_tdm_lds_padding_wmma)
        if(TEST ${test_target})
            set_property(TEST ${test_target} APPEND PROPERTY LABELS "SMOKE_TEST")
        endif()
    endforeach()
    # comp_tdm_pc is deliberately absent from the tile engine CI config (it is a shared contract
    # with the dispatcher bridge), so this gtest is the only CI coverage of
    # GemmPipelineAgBgCrCompTDMProducerConsumer. It must be joined HERE, after the relabel loop
    # above, and never added to CK_TILE_GEMM_TEST_TARGETS before it: that loop uses
    # set_tests_properties(... PROPERTIES LABELS ...), which REPLACES, so going through it would
    # drop the SMOKE_TEST label add_gtest_executable set -- and gfx1250 CI runs only
    # `ninja smoke` (ctest -L SMOKE_TEST), which would then build this test but never run it.
    # APPEND PROPERTY below adds the label without disturbing SMOKE_TEST.
    if(TEST test_ck_tile_gemm_pipeline_tdm_producer_consumer_wmma)
        set_property(TEST test_ck_tile_gemm_pipeline_tdm_producer_consumer_wmma
            APPEND PROPERTY LABELS "CK_TILE_GEMM_TESTS")
        list(APPEND CK_TILE_GEMM_TEST_TARGETS test_ck_tile_gemm_pipeline_tdm_producer_consumer_wmma)
    endif()
    # comp_tdm_v3: same reason as comp_tdm_pc above (keep the SMOKE_TEST / REGRESSION_TEST label).
    foreach(test_target test_ck_tile_gemm_pipeline_comp_tdm_v3_wmma
                        test_ck_tile_gemm_pipeline_comp_tdm_v3_longk_wmma
                        test_ck_tile_gemm_pipeline_comp_tdm_v3_bf16_wmma
                        test_ck_tile_gemm_pipeline_comp_tdm_v3_bf16_large_wmma
                        test_ck_tile_gemm_pipeline_comp_tdm_v3_unaligned_mnk_wmma)
        if(TEST ${test_target})
            set_property(TEST ${test_target} APPEND PROPERTY LABELS "CK_TILE_GEMM_TESTS")
            list(APPEND CK_TILE_GEMM_TEST_TARGETS ${test_target})
        endif()
    endforeach()

    # Umbrella target to build and run all ck_tile gemm tests
    # Usage: ninja ck_tile_gemm_tests
    add_custom_target(ck_tile_gemm_tests
        COMMAND ${CMAKE_CTEST_COMMAND} --output-on-failure -C ${CMAKE_CFG_INTDIR} -L "CK_TILE_GEMM_TESTS"
        DEPENDS ${CK_TILE_GEMM_TEST_TARGETS}
        USES_TERMINAL
        COMMENT "Running all ck_tile gemm tests..."
    )
else()
    message(DEBUG "Skipping ck_tile_gemm tests for current target test_ck_tile_gemm_pipeline") 
endif()
