Files
composable_kernel/dispatcher/tests/test_minimal.cpp
Vidyasagar Ananthan 9e049a32a1 Adding dispatcher architecture (#3300)
* WIP POC of dispatcher

* Dispatcher python workflow setup.

* Dispatcher cleanup and updates.

Further dispatcher cleanup and updates.

Build fixes

Improvements and python to CK example

Improvements to readme

* Fixes to python paths

* Cleaning up code

* Improving dispatcher support for different arch

Fixing typos

* Fix formatting errors

* Cleaning up examples

* Improving codegeneration

* Improving and fixing C++ examples

* Adding conv functionality (fwd,bwd,bwdw) and examples.

* Fixes based on feedback.

* Further fixes based on feedback.

* Adding stress test for autogeneration and autocorrection, and fixing preshuffle bug.

* Another round of improvements  based on feedback.

* Trimming out unnecessary code.

* Fixing the multi-D implementation.

* Using gpu verification for gemms and fixing convolutions tflops calculation.

* Fix counter usage issue and arch filtering per ops.

* Adding changelog and other fixes.

* Improve examples and resolve critical bugs.

* Reduce build time for python examples.

* Fixing minor bug.

* Fix compilation error.

* Improve installation instructions for dispatcher.

* Add docker based  installation instructions for dispatcher.

* Fixing arch-based filtering to match tile engine.

* Remove dead code and fix arch filtering.

* Minor bugfix.

* Updates after rebase.

* Trimming code.

* Fix copyright headers.

* Consolidate examples, cut down code.

* Minor fixes.

* Improving python examples.

* Update readmes.

* Remove conv functionality.

* Cleanup following conv removable.
2026-01-22 09:34:33 -08:00

58 lines
1.7 KiB
C++

// Copyright (c) Advanced Micro Devices, Inc., or its affiliates.
// SPDX-License-Identifier: MIT
// Minimal test: Verify dispatcher can select and run a kernel
#include <iostream>
#include <memory>
#include "ck_tile/dispatcher/dispatcher.hpp"
#include "ck_tile/dispatcher/registry.hpp"
#include "test_mock_kernel.hpp"
using namespace ck_tile::dispatcher;
using namespace ck_tile::dispatcher::test;
int main()
{
std::cout << "Minimal Dispatcher Test\n";
std::cout << "=======================\n\n";
// Create a mock kernel for testing
KernelKey key = make_test_key(128, 128, 64, "gfx942");
auto kernel = std::make_shared<MockKernelInstance>(key, "test_kernel_128x128x64", true);
// Register kernel
Registry::instance().clear();
Registry::instance().register_kernel(kernel);
std::cout << "OK Registered kernel: " << kernel->get_name() << "\n";
// Create dispatcher and problem
Dispatcher dispatcher;
Problem problem(1024, 1024, 1024);
std::cout << "OK Created problem: M=" << problem.M << " N=" << problem.N << " K=" << problem.K
<< "\n";
// Select kernel
auto selected = dispatcher.select_kernel(problem);
if(!selected)
{
std::cerr << "[FAIL] Failed to select kernel\n";
return 1;
}
std::cout << "OK Selected kernel: " << selected->get_name() << "\n";
// Mock execution (no actual GPU computation in mock kernel)
void* a_ptr = nullptr;
void* b_ptr = nullptr;
void* c_ptr = nullptr;
float time = dispatcher.run(a_ptr, b_ptr, c_ptr, problem);
std::cout << "OK Executed kernel: " << time << " ms\n";
std::cout << "\n[OK] Minimal test passed!\n";
return 0;
}