mirror of
https://github.com/ROCm/composable_kernel.git
synced 2026-07-19 02:01:01 +00:00
Clean up names and README.md and add comments.
The intention and direction of this work is more clear. No functional changes.
This commit is contained in:
@@ -1,3 +1,3 @@
|
||||
set(CMAKE_CXX_STANDARD 20)
|
||||
|
||||
add_executable(hello_world hello_world.cpp)
|
||||
add_executable(gemm_example gemm_example.cpp)
|
||||
@@ -1,42 +1,17 @@
|
||||
# Experimental Project
|
||||
# Experimental GEMM Example
|
||||
|
||||
This project demonstrates a simple C++ application that outputs "Hello, World!" to the console. It serves as an entry point for understanding basic C++ programming and CMake configuration.
|
||||
This directory contains an experimental project to build a C++20 GEMM builder over CK Tile.
|
||||
|
||||
## Building the Project
|
||||
* **Current state**: Early stages of development.
|
||||
* **Future work**
|
||||
* Fake implemenation as a fascade over CK Tile universal GEMM.
|
||||
* Add a `Describe(gemm)` function.
|
||||
* Build out flexibilty.
|
||||
* Experiment with some more complex build functionality.
|
||||
* Explore design to describe more GEMM details.
|
||||
|
||||
To build the project, follow these steps:
|
||||
## File Overview
|
||||
|
||||
1. Ensure you have CMake installed on your system.
|
||||
2. Open a terminal and navigate to the `experimental` directory.
|
||||
3. Create a build directory:
|
||||
```bash
|
||||
mkdir build
|
||||
cd build
|
||||
```
|
||||
4. Run CMake to configure the project:
|
||||
```bash
|
||||
cmake ..
|
||||
```
|
||||
5. Build the project:
|
||||
```bash
|
||||
make
|
||||
```
|
||||
|
||||
## Running the Executable
|
||||
|
||||
After building the project, you can run the executable with the following command:
|
||||
|
||||
```bash
|
||||
./hello_world
|
||||
```
|
||||
|
||||
You should see the output:
|
||||
|
||||
```
|
||||
Hello, World!
|
||||
```
|
||||
|
||||
## Notes
|
||||
|
||||
- This project is intended for educational purposes and may be expanded with additional features in the future.
|
||||
- Contributions and feedback are welcome.
|
||||
* `gemm_example.cpp` — Main example code, including device memory helpers and GEMM builder usage
|
||||
* `builder.h` — C++20 concepts and builder pattern for GEMM configuration
|
||||
* `CMakeLists.txt` — Build configuration for CMake
|
||||
|
||||
@@ -6,6 +6,7 @@ namespace ck_tile::builder {
|
||||
|
||||
using index_t = std::size_t;
|
||||
|
||||
// Some sample host args to describe a GEMM, with defaults set to zero.
|
||||
struct GemmHostArgs
|
||||
{
|
||||
index_t m = 0;
|
||||
@@ -20,13 +21,25 @@ struct GemmHostArgs
|
||||
void* c = nullptr;
|
||||
};
|
||||
|
||||
// Tag for column major layout.
|
||||
struct ColMajor
|
||||
{
|
||||
};
|
||||
|
||||
// Tag for row major layout.
|
||||
struct RowMajor
|
||||
{
|
||||
};
|
||||
|
||||
// Requirements for struct to define the data types used in the GEMM operation.
|
||||
//
|
||||
// Example that satifies this constraint:
|
||||
// struct GemmTypes {
|
||||
// using ADataType = float;
|
||||
// using BDataType = float;
|
||||
// using CDataType = float;
|
||||
// using AccDataType = float;
|
||||
// };
|
||||
template <typename T>
|
||||
concept DefinesGemmTypes =
|
||||
requires {
|
||||
@@ -38,6 +51,14 @@ concept DefinesGemmTypes =
|
||||
std::is_arithmetic_v<typename T::BDataType> && std::is_arithmetic_v<typename T::CDataType> &&
|
||||
std::is_arithmetic_v<typename T::AccDataType>;
|
||||
|
||||
// Requirements for struct that defines the layout used in the GEMM operation.
|
||||
//
|
||||
// Example that satisfies this constraint:
|
||||
// struct Layouts {
|
||||
// using ALayout = RowMajor;
|
||||
// using BLayout = ColMajor;
|
||||
// using CLayout = RowMajor;
|
||||
// };
|
||||
template <typename T>
|
||||
concept DefinesGemmLayout = requires {
|
||||
typename T::ALayout;
|
||||
@@ -45,6 +66,7 @@ concept DefinesGemmLayout = requires {
|
||||
typename T::CLayout;
|
||||
};
|
||||
|
||||
// A dummy placeholder for a real GEMM.
|
||||
class Gemm
|
||||
{
|
||||
public:
|
||||
@@ -54,6 +76,7 @@ class Gemm
|
||||
}
|
||||
};
|
||||
|
||||
// A minimal GEMM builder, this is where all the work will be.
|
||||
template <DefinesGemmTypes Types, DefinesGemmLayout Layout>
|
||||
class GemmBuilder
|
||||
{
|
||||
@@ -1,8 +1,10 @@
|
||||
|
||||
// gemm_example.cpp (formerly hello_world.cpp)
|
||||
#include <iostream>
|
||||
#include <memory>
|
||||
#include <hip/hip_runtime.h>
|
||||
|
||||
#include "builder.h"
|
||||
#include "gemm_builder.h"
|
||||
|
||||
namespace example {
|
||||
|
||||
Reference in New Issue
Block a user