mirror of
https://github.com/ROCm/composable_kernel.git
synced 2026-05-14 10:09:41 +00:00
Resolve some data type issues and cmake policy. (#940)
* split the types in gemm_bilinear instances, add condition to cmake policy
* fix syntax
* split the data types in batchnorm examples
* fix the batchnorm_bwd test
* fix types in the batchnorm_bwd test
[ROCm/composable_kernel commit: 2ea75bd6d7]
This commit is contained in:
@@ -1,5 +1,8 @@
|
||||
cmake_minimum_required(VERSION 3.14)
|
||||
cmake_policy(SET CMP0140 NEW)
|
||||
if(POLICY CMP0140)
|
||||
# policies CMP0140 not known to CMake until 3.25
|
||||
cmake_policy(SET CMP0140 NEW)
|
||||
endif()
|
||||
|
||||
# This has to be initialized before the project() command appears
|
||||
# Set the default of CMAKE_BUILD_TYPE to be release, unless user specifies with -D. MSVC_IDE does not use CMAKE_BUILD_TYPE
|
||||
|
||||
@@ -11,12 +11,12 @@
|
||||
#include "ck/tensor_operation/gpu/element/element_wise_operation.hpp"
|
||||
|
||||
#include "ck/library/tensor_operation_instance/device_operation_instance_factory.hpp"
|
||||
#ifdef CK_ENABLE_FP16
|
||||
|
||||
namespace ck {
|
||||
namespace tensor_operation {
|
||||
namespace device {
|
||||
namespace instance {
|
||||
|
||||
#ifdef CK_ENABLE_FP16
|
||||
void add_device_gemm_bilinear_xdl_c_shuffle_f16_f16_f16_f16_km_kn_mn_mn_instances(
|
||||
std::vector<std::unique_ptr<DeviceGemmMultipleD<Col,
|
||||
Row,
|
||||
@@ -68,7 +68,8 @@ void add_device_gemm_bilinear_xdl_c_shuffle_f16_f16_f16_f16_mk_nk_mn_mn_instance
|
||||
PassThrough,
|
||||
PassThrough,
|
||||
Bilinear>>>& instances);
|
||||
|
||||
#endif
|
||||
#ifdef CK_ENABLE_INT8
|
||||
void add_device_gemm_bilinear_wmma_c_shuffle_i8_i8_i8_i8_mk_kn_mn_mn_instances(
|
||||
std::vector<std::unique_ptr<DeviceGemmMultipleD<Row,
|
||||
Row,
|
||||
@@ -120,7 +121,7 @@ void add_device_gemm_bilinear_wmma_c_shuffle_i8_i8_i8_i8_km_nk_mn_mn_instances(
|
||||
PassThrough,
|
||||
PassThrough,
|
||||
Bilinear>>>& instances);
|
||||
|
||||
#endif
|
||||
// GEMM + Bilinear
|
||||
template <typename ALayout,
|
||||
typename BLayout,
|
||||
@@ -158,7 +159,7 @@ struct DeviceOperationInstanceFactory<ck::tensor_operation::device::DeviceGemmMu
|
||||
static auto GetInstances()
|
||||
{
|
||||
std::vector<std::unique_ptr<DeviceOp>> op_ptrs;
|
||||
|
||||
#ifdef CK_ENABLE_FP16
|
||||
if constexpr(is_same_v<ADataType, half_t> && is_same_v<BDataType, half_t> &&
|
||||
is_same_v<DDataType, half_t> && is_same_v<EDataType, half_t>)
|
||||
{
|
||||
@@ -187,8 +188,10 @@ struct DeviceOperationInstanceFactory<ck::tensor_operation::device::DeviceGemmMu
|
||||
op_ptrs);
|
||||
}
|
||||
}
|
||||
else if constexpr(is_same_v<ADataType, std::int8_t> && is_same_v<BDataType, std::int8_t> &&
|
||||
is_same_v<DDataType, std::int8_t> && is_same_v<EDataType, std::int8_t>)
|
||||
#endif
|
||||
#ifdef CK_ENABLE_INT8
|
||||
if constexpr(is_same_v<ADataType, std::int8_t> && is_same_v<BDataType, std::int8_t> &&
|
||||
is_same_v<DDataType, std::int8_t> && is_same_v<EDataType, std::int8_t>)
|
||||
{
|
||||
if constexpr(is_same_v<ALayout, Row> && is_same_v<BLayout, Row> &&
|
||||
is_same_v<DLayout, Row> && is_same_v<ELayout, Row>)
|
||||
@@ -211,7 +214,7 @@ struct DeviceOperationInstanceFactory<ck::tensor_operation::device::DeviceGemmMu
|
||||
add_device_gemm_bilinear_wmma_c_shuffle_i8_i8_i8_i8_km_nk_mn_mn_instances(op_ptrs);
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
return op_ptrs;
|
||||
}
|
||||
};
|
||||
@@ -220,4 +223,3 @@ struct DeviceOperationInstanceFactory<ck::tensor_operation::device::DeviceGemmMu
|
||||
} // namespace device
|
||||
} // namespace tensor_operation
|
||||
} // namespace ck
|
||||
#endif
|
||||
|
||||
@@ -70,10 +70,23 @@ class TestBatchNormBwdRank4 : public ::testing::Test
|
||||
}
|
||||
};
|
||||
|
||||
using KernelTypes = ::testing::Types<std::tuple<F16, F32, F32, F32, F16, F32, F32>,
|
||||
std::tuple<F32, F32, F32, F32, F32, F32, F32>,
|
||||
std::tuple<BF16, F32, F32, F32, BF16, F32, F32>,
|
||||
std::tuple<F64, F64, F64, F64, F64, F64, F64>>;
|
||||
using KernelTypes = ::testing::Types<
|
||||
#ifdef CK_ENABLE_FP16
|
||||
std::tuple<F16, F32, F32, F32, F16, F32, F32>
|
||||
#endif
|
||||
#ifdef CK_ENABLE_FP32
|
||||
,
|
||||
std::tuple<F32, F32, F32, F32, F32, F32, F32>
|
||||
#endif
|
||||
#ifdef CK_ENABLE_BF16
|
||||
,
|
||||
std::tuple<BF16, F32, F32, F32, BF16, F32, F32>
|
||||
#endif
|
||||
#ifdef CK_ENABLE_FP64
|
||||
,
|
||||
std::tuple<F64, F64, F64, F64, F64, F64, F64>
|
||||
#endif
|
||||
>;
|
||||
|
||||
TYPED_TEST_SUITE(TestBatchNormBwdRank4, KernelTypes);
|
||||
|
||||
|
||||
@@ -87,10 +87,23 @@ class TestBatchNormFwdRank4 : public ::testing::Test
|
||||
}
|
||||
};
|
||||
|
||||
using KernelTypes = ::testing::Types<std::tuple<F16, F16, F32, F16, F16, F32>,
|
||||
std::tuple<F32, F32, F32, F32, F32, F32>,
|
||||
std::tuple<BF16, BF16, F32, BF16, BF16, F32>,
|
||||
std::tuple<F64, F64, F64, F64, F64, F64>>;
|
||||
using KernelTypes = ::testing::Types<
|
||||
#ifdef CK_ENABLE_FP16
|
||||
std::tuple<F16, F16, F32, F16, F16, F32>
|
||||
#endif
|
||||
#ifdef CK_ENABLE_FP32
|
||||
,
|
||||
std::tuple<F32, F32, F32, F32, F32, F32>
|
||||
#endif
|
||||
#ifdef CK_ENABLE_BF16
|
||||
,
|
||||
std::tuple<BF16, BF16, F32, BF16, BF16, F32>
|
||||
#endif
|
||||
#ifdef CK_ENABLE_FP64
|
||||
,
|
||||
std::tuple<F64, F64, F64, F64, F64, F64>
|
||||
#endif
|
||||
>;
|
||||
|
||||
TYPED_TEST_SUITE(TestBatchNormFwdRank4, KernelTypes);
|
||||
|
||||
|
||||
@@ -67,10 +67,23 @@ class TestBatchNormInferRank4 : public ::testing::Test
|
||||
}
|
||||
};
|
||||
|
||||
using KernelTypes = ::testing::Types<std::tuple<F16, F16, F32, F16, F16, F32>,
|
||||
std::tuple<F32, F32, F32, F32, F32, F32>,
|
||||
std::tuple<BF16, BF16, F32, BF16, BF16, F32>,
|
||||
std::tuple<F64, F64, F64, F64, F64, F64>>;
|
||||
using KernelTypes = ::testing::Types<
|
||||
#ifdef CK_ENABLE_FP16
|
||||
std::tuple<F16, F16, F32, F16, F16, F32>
|
||||
#endif
|
||||
#ifdef CK_ENABLE_FP32
|
||||
,
|
||||
std::tuple<F32, F32, F32, F32, F32, F32>
|
||||
#endif
|
||||
#ifdef CK_ENABLE_BF16
|
||||
,
|
||||
std::tuple<BF16, BF16, F32, BF16, BF16, F32>
|
||||
#endif
|
||||
#ifdef CK_ENABLE_FP64
|
||||
,
|
||||
std::tuple<F64, F64, F64, F64, F64, F64>
|
||||
#endif
|
||||
>;
|
||||
|
||||
TYPED_TEST_SUITE(TestBatchNormInferRank4, KernelTypes);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user