Commit 51b9abb9 authored by Andriy Roshchenko's avatar Andriy Roshchenko
Browse files

Verify more tests on floating point data

parent 646b8e5c
...@@ -66,7 +66,8 @@ ...@@ -66,7 +66,8 @@
"cacheVariables": { "cacheVariables": {
"GPU_TARGETS": "gfx90a", "GPU_TARGETS": "gfx90a",
"CMAKE_BUILD_TYPE": "Release", "CMAKE_BUILD_TYPE": "Release",
"CMAKE_CXX_FLAGS": "-O3" "CMAKE_CXX_FLAGS": "-O3",
"CK_USE_FP8_ON_UNSUPPORTED_ARCH":"ON"
} }
}, },
{ {
...@@ -76,7 +77,8 @@ ...@@ -76,7 +77,8 @@
"cacheVariables": { "cacheVariables": {
"GPU_TARGETS": "gfx90a", "GPU_TARGETS": "gfx90a",
"CMAKE_BUILD_TYPE": "Debug", "CMAKE_BUILD_TYPE": "Debug",
"CMAKE_CXX_FLAGS": "-O0 -ggdb" "CMAKE_CXX_FLAGS": "-O0 -ggdb",
"CK_USE_FP8_ON_UNSUPPORTED_ARCH":"ON"
} }
}, },
{ {
......
...@@ -162,12 +162,12 @@ bool run_gemm(const ProblemType& problem_size, const ExecutionConfig& config) ...@@ -162,12 +162,12 @@ bool run_gemm(const ProblemType& problem_size, const ExecutionConfig& config)
b_k_n.GenerateTensorValue(GeneratorTensor_2<BDataType>{-2, 2}); b_k_n.GenerateTensorValue(GeneratorTensor_2<BDataType>{-2, 2});
break; break;
case 2: case 2:
a_m_k.GenerateTensorValue(GeneratorTensor_1<ADataType>{1}); a_m_k.GenerateTensorValue(GeneratorTensor_3<ADataType>{0.0, 1.0});
b_k_n.GenerateTensorValue(GeneratorTensor_2<BDataType>{-2, 2}); b_k_n.GenerateTensorValue(GeneratorTensor_3<BDataType>{-2, 2});
break; break;
case 3: case 3:
a_m_k.GenerateTensorValue(GeneratorTensor_2<ADataType>{-2, 2}); a_m_k.GenerateTensorValue(GeneratorTensor_3<ADataType>{-2, 2});
b_k_n.GenerateTensorValue(GeneratorTensor_1<BDataType>{1}); b_k_n.GenerateTensorValue(GeneratorTensor_3<ADataType>{0.0, 1.0});
break; break;
default: default:
a_m_k.GenerateTensorValue(GeneratorTensor_3<ADataType>{0.0, 1.0}); a_m_k.GenerateTensorValue(GeneratorTensor_3<ADataType>{0.0, 1.0});
......
...@@ -146,19 +146,11 @@ bool run_gemm(const ProblemType& problem_size, const ExecutionConfig& config) ...@@ -146,19 +146,11 @@ bool run_gemm(const ProblemType& problem_size, const ExecutionConfig& config)
b_k_n.GenerateTensorValue(GeneratorTensor_1<BDataType>{1}); b_k_n.GenerateTensorValue(GeneratorTensor_1<BDataType>{1});
break; break;
case 1: case 1:
a_m_k.GenerateTensorValue(GeneratorTensor_2<ADataType>{-2, 2}); a_m_k.GenerateTensorValue(GeneratorTensor_3<ADataType>{-2, 2});
b_k_n.GenerateTensorValue(GeneratorTensor_2<BDataType>{-2, 2}); b_k_n.GenerateTensorValue(GeneratorTensor_3<BDataType>{-3, 3});
break;
case 2:
a_m_k.GenerateTensorValue(GeneratorTensor_1<ADataType>{1});
b_k_n.GenerateTensorValue(GeneratorTensor_2<BDataType>{-2, 2});
break;
case 3:
a_m_k.GenerateTensorValue(GeneratorTensor_2<ADataType>{-2, 2});
b_k_n.GenerateTensorValue(GeneratorTensor_1<BDataType>{1});
break; break;
default: default:
a_m_k.GenerateTensorValue(GeneratorTensor_3<ADataType>{0.0, 1.0}); a_m_k.GenerateTensorValue(GeneratorTensor_3<ADataType>{-1.0, 1.0});
b_k_n.GenerateTensorValue(GeneratorTensor_3<BDataType>{-0.5, 0.5}); b_k_n.GenerateTensorValue(GeneratorTensor_3<BDataType>{-0.5, 0.5});
} }
......
...@@ -75,7 +75,7 @@ struct ProblemSize final ...@@ -75,7 +75,7 @@ struct ProblemSize final
struct ExecutionConfig final struct ExecutionConfig final
{ {
bool do_verification = true; bool do_verification = true;
int init_method = 1; int init_method = 2;
int k_batch = 1; int k_batch = 1;
bool time_kernel = false; bool time_kernel = false;
}; };
......
...@@ -8,7 +8,7 @@ bool run_convnd_fwd_example(int argc, char* argv[]) ...@@ -8,7 +8,7 @@ bool run_convnd_fwd_example(int argc, char* argv[])
print_helper_msg(); print_helper_msg();
bool do_verification = true; bool do_verification = true;
int init_method = 1; int init_method = 2;
bool time_kernel = false; bool time_kernel = false;
ck::utils::conv::ConvParam conv_param{ ck::utils::conv::ConvParam conv_param{
......
...@@ -8,7 +8,7 @@ bool run_convnd_fwd_example(int argc, char* argv[]) ...@@ -8,7 +8,7 @@ bool run_convnd_fwd_example(int argc, char* argv[])
print_helper_msg(); print_helper_msg();
bool do_verification = true; bool do_verification = true;
int init_method = 1; int init_method = 2;
bool time_kernel = false; bool time_kernel = false;
ck::utils::conv::ConvParam conv_param{ ck::utils::conv::ConvParam conv_param{
......
...@@ -8,7 +8,7 @@ bool run_convnd_fwd_example(int argc, char* argv[]) ...@@ -8,7 +8,7 @@ bool run_convnd_fwd_example(int argc, char* argv[])
print_helper_msg(); print_helper_msg();
bool do_verification = true; bool do_verification = true;
int init_method = 1; int init_method = 2;
bool time_kernel = false; bool time_kernel = false;
ck::utils::conv::ConvParam conv_param{ ck::utils::conv::ConvParam conv_param{
......
...@@ -8,7 +8,7 @@ bool run_convnd_fwd_example(int argc, char* argv[]) ...@@ -8,7 +8,7 @@ bool run_convnd_fwd_example(int argc, char* argv[])
print_helper_msg(); print_helper_msg();
bool do_verification = true; bool do_verification = true;
int init_method = 1; int init_method = 2;
bool time_kernel = false; bool time_kernel = false;
ck::utils::conv::ConvParam conv_param{ ck::utils::conv::ConvParam conv_param{
......
...@@ -8,7 +8,7 @@ bool run_convnd_fwd_example(int argc, char* argv[]) ...@@ -8,7 +8,7 @@ bool run_convnd_fwd_example(int argc, char* argv[])
print_helper_msg(); print_helper_msg();
bool do_verification = true; bool do_verification = true;
int init_method = 1; int init_method = 2;
bool time_kernel = false; bool time_kernel = false;
ck::utils::conv::ConvParam conv_param{ ck::utils::conv::ConvParam conv_param{
......
...@@ -86,7 +86,7 @@ using DeviceOpInstance = ck::tensor_operation::device::DeviceGemmMultiD_Xdl_CShu ...@@ -86,7 +86,7 @@ using DeviceOpInstance = ck::tensor_operation::device::DeviceGemmMultiD_Xdl_CShu
int main(int argc, char* argv[]) int main(int argc, char* argv[])
{ {
bool do_verification = true; bool do_verification = true;
int init_method = 1; int init_method = 2;
bool time_kernel = false; bool time_kernel = false;
// GEMM shape // GEMM shape
......
...@@ -78,7 +78,7 @@ using DeviceOpInstance = ck::tensor_operation::device::DeviceGemmMultiD_ABScale_ ...@@ -78,7 +78,7 @@ using DeviceOpInstance = ck::tensor_operation::device::DeviceGemmMultiD_ABScale_
int main(int argc, char* argv[]) int main(int argc, char* argv[])
{ {
bool do_verification = true; bool do_verification = true;
int init_method = 1; int init_method = 5;
bool time_kernel = false; bool time_kernel = false;
// GEMM shape // GEMM shape
...@@ -186,6 +186,20 @@ int main(int argc, char* argv[]) ...@@ -186,6 +186,20 @@ int main(int argc, char* argv[])
b0_k_n.GenerateTensorValue(GeneratorTensor_1<B0DataType>{}); b0_k_n.GenerateTensorValue(GeneratorTensor_1<B0DataType>{});
a1_m_k.GenerateTensorValue(GeneratorTensor_3<A1DataType>{0, 1.0}); a1_m_k.GenerateTensorValue(GeneratorTensor_3<A1DataType>{0, 1.0});
b1_k_n.GenerateTensorValue(GeneratorTensor_3<B1DataType>{0, 1.0}); b1_k_n.GenerateTensorValue(GeneratorTensor_3<B1DataType>{0, 1.0});
break;
case 6:
a0_m_k.GenerateTensorValue(GeneratorTensor_PI<ADataType>{});
b0_k_n.GenerateTensorValue(GeneratorTensor_1<BDataType>{0.5f});
a1_m_k.GenerateTensorValue(GeneratorTensor_1<A1DataType>{0.5});
b1_k_n.GenerateTensorValue(GeneratorTensor_1<B1DataType>{4});
break;
case 7:
a0_m_k.GenerateTensorValue(GeneratorTensor_PI_A<ADataType>{});
b0_k_n.GenerateTensorValue(GeneratorTensor_PI_B<BDataType>{});
a1_m_k.GenerateTensorValue(GeneratorTensor_1<A1DataType>{2});
b1_k_n.GenerateTensorValue(GeneratorTensor_1<B1DataType>{0.5});
break; break;
default: default:
a0_m_k.GenerateTensorValue(GeneratorTensor_3<A0DataType>{-0.5, 0.5}); a0_m_k.GenerateTensorValue(GeneratorTensor_3<A0DataType>{-0.5, 0.5});
...@@ -306,6 +320,32 @@ int main(int argc, char* argv[]) ...@@ -306,6 +320,32 @@ int main(int argc, char* argv[])
e_device_buf.FromDevice(e_m_n_device_result.mData.data()); e_device_buf.FromDevice(e_m_n_device_result.mData.data());
if(init_method == 6 || init_method == 7)
{
std::cout << std::fixed << std::setprecision(16);
float a = ck::type_convert<float>(a0_device_buf(0, 10));
float b = ck::type_convert<float>(b0_device_buf(0, 10));
std::cout << "a(0,10): " << a << std::endl;
std::cout << "b(0,10): " << b << std::endl;
std::cout << "a: " << ck::type_convert<float>(a0_device_buf(0, 0)) << std::endl;
std::cout << "a: " << ck::type_convert<float>(a0_device_buf(0, 1)) << std::endl;
std::cout << "a: " << ck::type_convert<float>(a0_device_buf(0, 2)) << std::endl;
std::cout << "b: " << ck::type_convert<float>(b0_device_buf(0, 0)) << std::endl;
std::cout << "b: " << ck::type_convert<float>(b0_device_buf(1, 0)) << std::endl;
std::cout << "b: " << ck::type_convert<float>(b0_device_buf(2, 0)) << std::endl;
float d = ck::type_convert<float>(e_m_n_device_result(0, 10));
float h = ck::type_convert<float>(e_m_n_host_result(10, 0));
std::cout << "device result: " << d << std::endl;
std::cout << "host result: " << h << std::endl;
std::cout << "expected result: " << M_PI << std::endl;
std::cout << "device - host: " << std::abs(d - h) << std::endl;
std::cout << "device - expected: " << std::abs(d - M_PI) << std::endl;
std::cout << "atol: " << 5e-2 << std::endl;
std::cout << std::endl << std::endl;
}
return ck::utils::check_err( return ck::utils::check_err(
e_m_n_device_result, e_m_n_host_result, "Error: Incorrect results!", 5e-2, 5e-2) e_m_n_device_result, e_m_n_host_result, "Error: Incorrect results!", 5e-2, 5e-2)
? 0 ? 0
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment