CodeQL / Analyze (actions) (push) Canceled after 0s
CodeQL / Analyze (python) (push) Canceled after 0s
pre-commit / pre-commit (push) Canceled after 0s
Multi-Arch CI / setup (push) Canceled after 0s
Publish build_manylinux_x86_64 images / publish_build_manylinux_x86_64 (push) Canceled after 0s
Setup (Multi-Arch) / setup (push) Canceled after 0s
Multi-Arch CI / Linux::${{ fromJSON(needs.setup.outputs.linux_build_config || '{}').build_variant_label || 'skip' }} (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Publish no_rocm_image_ubi10 image / publish_no_rocm_image_ubi10 (push) Canceled after 0s
Multi-Arch CI / Windows::${{ fromJSON(needs.setup.outputs.windows_build_config || '{}').build_variant_label || 'skip' }} (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Multi-Arch CI / Manifest Diff (push) Canceled after 0s
TheRock Manifest Diff Report / Generate Manifest Diff Report (push) Canceled after 0s
Multi-Arch CI / CI Summary (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04 (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04_ocl_rt images / publish_no_rocm_image_ubuntu24_04_ocl_rt (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_rocgdb (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04_rocgdb images / publish_no_rocm_image_ubuntu24_04_rocgdb (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_ocl_rt (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Unit Tests / Unit Tests :: ubuntu-24.04 (push) Canceled after 0s
Unit Tests / Unit Tests :: windows-2022 (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_media (push) Canceled after 0s
Unit Tests / Unit Tests Summary (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_openmpi (push) Canceled after 0s
75 lines
2.4 KiB
C++
75 lines
2.4 KiB
C++
// Copyright (c) Advanced Micro Devices, Inc., or its affiliates.
|
|
// SPDX-License-Identifier: MIT
|
|
|
|
#include "ck/ck.hpp"
|
|
#include "ck/host_utility/device_prop.hpp"
|
|
|
|
#include "prefetch_op_util.hpp"
|
|
|
|
template <typename T, uint32_t NUM_THREADS, uint32_t NUM_SCALARS, bool IS_L1_PREFETCH>
|
|
bool run_test(bool time_kernels)
|
|
{
|
|
bool pass = true;
|
|
|
|
#if defined(__gfx125__)
|
|
const auto coherence =
|
|
IS_L1_PREFETCH ? ck::AmdBufferCoherenceEnum::CU_RT : ck::AmdBufferCoherenceEnum::SE_RT;
|
|
using global_prefetch_op = ck::GlobalPrefetchDataOp<coherence>;
|
|
using flat_prefetch_op = ck::FlatPrefetchDataOp<coherence>;
|
|
#else
|
|
using global_prefetch_op = ck::GlobalPrefetchDataOp<>;
|
|
using flat_prefetch_op = ck::FlatPrefetchDataOp<>;
|
|
#endif
|
|
|
|
const auto global_prefetch_kernel =
|
|
ck::prefetch_op_util::kernel_with_prefetch<T, NUM_THREADS, NUM_SCALARS, global_prefetch_op>;
|
|
const auto flat_prefetch_kernel = ck::prefetch_op_util::
|
|
kernel_with_prefetch_and_shared_mem<T, NUM_THREADS, NUM_SCALARS, flat_prefetch_op>;
|
|
|
|
const auto prefetch_kernel_container =
|
|
std::make_tuple(global_prefetch_kernel, flat_prefetch_kernel);
|
|
|
|
ck::static_for<0, 2, 1>{}([&](auto i) {
|
|
std::string kernel_name = (i == 1 ? "flat_prefetch" : "global_prefetch");
|
|
|
|
auto kernel = std::get<ck::Number<i>{}>(prefetch_kernel_container);
|
|
|
|
pass &=
|
|
ck::prefetch_op_util::test_prefetch_impl<decltype(kernel), T, NUM_THREADS, NUM_SCALARS>(
|
|
time_kernels, kernel, kernel_name);
|
|
});
|
|
|
|
return pass;
|
|
}
|
|
|
|
int main(int argc, char* argv[])
|
|
{
|
|
if(!ck::is_gfx125_supported())
|
|
{
|
|
std::cout << "This feature is not supported by current HW, skipping tests." << std::endl;
|
|
return 0;
|
|
}
|
|
|
|
bool time_kernels = false;
|
|
|
|
if(argc == 2)
|
|
{
|
|
time_kernels = std::stoi(argv[1]);
|
|
}
|
|
|
|
bool pass = true;
|
|
|
|
std::cout << "=== Testing L2 Global Cache Prefetch ===" << std::endl;
|
|
|
|
pass &= run_test<float, 4096, 1024, false>(time_kernels);
|
|
pass &= run_test<double, 4096, 512, false>(time_kernels);
|
|
|
|
std::cout << "=== Testing L1 Global Cache Prefetch ===" << std::endl;
|
|
|
|
pass &= run_test<float, 4096, 1024, true>(time_kernels);
|
|
pass &= run_test<double, 4096, 512, true>(time_kernels);
|
|
|
|
std::cout << "TestGlobalPrefetch ..... " << (pass ? "SUCCESS" : "FAILURE") << std::endl;
|
|
return pass ? 0 : 1;
|
|
}
|