mirror of
https://github.com/ROCm/composable_kernel.git
synced 2026-05-16 19:09:59 +00:00
* start adding navi21 GEMM
* navi_gemm_km_kn_mn_fp32 compiles and passes one test.
* rename variables and functions in gridwise_gemm_dlops_v1r3
* add other 3 layouts; format instance
* adding more tuning parameters
add tuning parameters for other 3 layouts
* add gemm_dlops_f16
* tmp
* add dependence of DeviceGemm::IsSupportedArg() on arch
* minor changes
* minor changes
* minor changes
* minor changes
* minor changes
* minor changes
* minor changes
* push gemm_dlops into profiler
* minor changes
* if using xdl or dlops is moved into profiler_gemm_impl
* minor changes
* minor changes
* remove is_xdl from profile_gemm_impl
* make IsSupportedArg dependent on arch for other device_gemm
* minor changes
* minor changes
* fix a bug in f_generate_tensor_value
* add 64x64x64 for gemm_dlops_int8
* add 64x64x64 for gemm_dlops_int8
* comment out 3 layouts in gemm_dlops_int8; add 32x32x32 for gemm_dlops_int8; init A values to 1
* fix
* start fixing tuning parameters
* monir
* minor changes
* minor changes
* minor changes
* fixing
* adding example
* adding example
* adding example
* add gemm fp32 example
* clean up
* use 128x128x16 as MNK tile in navi21 gemm example
* bug fix
* fix test
* use new block c tile
* clean
* fix build
Co-authored-by: Chao Liu <chao.liu2@amd.com>
Co-authored-by: shaojiewang <wsjmessi@163.com>
[ROCm/composable_kernel commit: 40b59a63cc]
129 lines
4.7 KiB
C++
129 lines
4.7 KiB
C++
#include <algorithm>
|
|
#include <cstdlib>
|
|
#include <half.hpp>
|
|
#include <iostream>
|
|
#include <numeric>
|
|
#include <tuple>
|
|
#include <vector>
|
|
|
|
#include "../gemm/gemm_util.hpp"
|
|
#include "config.hpp"
|
|
#include "print.hpp"
|
|
#include "device.hpp"
|
|
#include "host_tensor.hpp"
|
|
#include "host_tensor_generator.hpp"
|
|
#include "host_gemm.hpp"
|
|
#include "device_tensor.hpp"
|
|
#include "device_gemm_dl.hpp"
|
|
#include "element_wise_operation.hpp"
|
|
#include "reference_gemm.hpp"
|
|
#include "gemm_specialization.hpp"
|
|
|
|
using PassThrough = ck::tensor_operation::element_wise::PassThrough;
|
|
|
|
using DeviceGemmNoOpPtr =
|
|
ck::tensor_operation::device::DeviceGemmPtr<ck::tensor_operation::element_wise::PassThrough,
|
|
ck::tensor_operation::element_wise::PassThrough,
|
|
ck::tensor_operation::element_wise::PassThrough>;
|
|
|
|
namespace ck {
|
|
namespace tensor_operation {
|
|
namespace device {
|
|
namespace device_gemm_instance {
|
|
|
|
void add_device_gemm_dl_f32_f32_f32_km_kn_mn_instances(std::vector<DeviceGemmNoOpPtr>&);
|
|
void add_device_gemm_dl_f32_f32_f32_km_nk_mn_instances(std::vector<DeviceGemmNoOpPtr>&);
|
|
void add_device_gemm_dl_f32_f32_f32_mk_nk_mn_instances(std::vector<DeviceGemmNoOpPtr>&);
|
|
void add_device_gemm_dl_f32_f32_f32_mk_kn_mn_instances(std::vector<DeviceGemmNoOpPtr>&);
|
|
|
|
} // namespace device_gemm_instance
|
|
} // namespace device
|
|
} // namespace tensor_operation
|
|
} // namespace ck
|
|
|
|
int main()
|
|
{
|
|
using ADataType = float;
|
|
using BDataType = float;
|
|
using CDataType = float;
|
|
|
|
using RowMajor = ck::tensor_layout::gemm::RowMajor;
|
|
using ColumnMajor = ck::tensor_layout::gemm::ColumnMajor;
|
|
|
|
bool res = true;
|
|
std::vector<DeviceGemmNoOpPtr> gemmPtrs;
|
|
ck::tensor_operation::device::device_gemm_instance::
|
|
add_device_gemm_dl_f32_f32_f32_km_kn_mn_instances(gemmPtrs);
|
|
|
|
for(auto& gemmPtr : gemmPtrs)
|
|
{
|
|
res &= ck::gemm_util::TestGemm<DeviceGemmNoOpPtr,
|
|
ADataType,
|
|
BDataType,
|
|
CDataType,
|
|
ColumnMajor,
|
|
RowMajor,
|
|
RowMajor,
|
|
PassThrough,
|
|
PassThrough,
|
|
PassThrough>{}(gemmPtr);
|
|
}
|
|
|
|
gemmPtrs.clear();
|
|
ck::tensor_operation::device::device_gemm_instance::
|
|
add_device_gemm_dl_f32_f32_f32_km_nk_mn_instances(gemmPtrs);
|
|
|
|
for(auto& gemmPtr : gemmPtrs)
|
|
{
|
|
res &= ck::gemm_util::TestGemm<DeviceGemmNoOpPtr,
|
|
ADataType,
|
|
BDataType,
|
|
CDataType,
|
|
ColumnMajor,
|
|
ColumnMajor,
|
|
RowMajor,
|
|
PassThrough,
|
|
PassThrough,
|
|
PassThrough>{}(gemmPtr);
|
|
}
|
|
|
|
gemmPtrs.clear();
|
|
ck::tensor_operation::device::device_gemm_instance::
|
|
add_device_gemm_dl_f32_f32_f32_mk_kn_mn_instances(gemmPtrs);
|
|
|
|
for(auto& gemmPtr : gemmPtrs)
|
|
{
|
|
res &= ck::gemm_util::TestGemm<DeviceGemmNoOpPtr,
|
|
ADataType,
|
|
BDataType,
|
|
CDataType,
|
|
RowMajor,
|
|
RowMajor,
|
|
RowMajor,
|
|
PassThrough,
|
|
PassThrough,
|
|
PassThrough>{}(gemmPtr);
|
|
}
|
|
|
|
gemmPtrs.clear();
|
|
ck::tensor_operation::device::device_gemm_instance::
|
|
add_device_gemm_dl_f32_f32_f32_mk_nk_mn_instances(gemmPtrs);
|
|
|
|
for(auto& gemmPtr : gemmPtrs)
|
|
{
|
|
res &= ck::gemm_util::TestGemm<DeviceGemmNoOpPtr,
|
|
ADataType,
|
|
BDataType,
|
|
CDataType,
|
|
RowMajor,
|
|
ColumnMajor,
|
|
RowMajor,
|
|
PassThrough,
|
|
PassThrough,
|
|
PassThrough>{}(gemmPtr);
|
|
}
|
|
|
|
std::cout << "TestGemm ..... " << (res ? "SUCCESS" : "FAILURE") << std::endl;
|
|
return res ? 0 : 1;
|
|
}
|