aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEren Kopuz <eren.kopuz@arm.com>2020-07-17 15:13:39 +0100
committerEren Kopuz <eren.kopuz@arm.com>2020-07-22 15:01:23 +0000
commit15205d9be0c997b900e4cef04ea359e3226d21c5 (patch)
tree466b480cbb118e0a70b740270f0b03e233f188e8
parentaa95ddc2abb7cef0b2edd03f7c4c9d9c6b9d7cf4 (diff)
downloadComputeLibrary-15205d9be0c997b900e4cef04ea359e3226d21c5.tar.gz
COMPMID-3549: GEMM Tuner - Validate input parameters
- Add validate function to kernel and exit if invalid parameters - Also relates to ticket COMPMID-3451 Change-Id: I49df7378a2fe27b8f08c45b373e13ef565a8b5d9 Signed-off-by: Eren Kopuz <eren.kopuz@arm.com> Reviewed-on: https://review.mlplatform.org/c/ml/ComputeLibrary/+/3592 Comments-Addressed: Arm Jenkins <bsgcomp@arm.com> Reviewed-by: SiCong Li <sicong.li@arm.com> Tested-by: Arm Jenkins <bsgcomp@arm.com>
-rwxr-xr-xexamples/gemm_tuner/benchmark_gemm_examples.sh15
-rw-r--r--examples/gemm_tuner/cl_gemm_native.cpp19
-rw-r--r--examples/gemm_tuner/cl_gemm_reshaped.cpp28
-rw-r--r--examples/gemm_tuner/cl_gemm_reshaped_rhs_only.cpp20
4 files changed, 66 insertions, 16 deletions
diff --git a/examples/gemm_tuner/benchmark_gemm_examples.sh b/examples/gemm_tuner/benchmark_gemm_examples.sh
index e8025538ae..159b161c98 100755
--- a/examples/gemm_tuner/benchmark_gemm_examples.sh
+++ b/examples/gemm_tuner/benchmark_gemm_examples.sh
@@ -138,6 +138,7 @@ Gemm config file (Strategy reshaped_rhs_only):
h0 - Number of horizontal blocks of size (k0xn0) stored on the same output row
interleave_rhs - Interleave rhs matrix (1) / Do not interleave rhs matrix (0)
transpose_rhs - Transpose rhs matrix (1) / Do not transpose rhs matrix (0)
+ export_to_cl_image_rhs - Export rhs matrix to cl_image (1) / Do not export rhs matrix to cl_image (0)
Only the following configurations of M0, N0 and K0 are currently supported:
M0 = 1, 2, 3, 4, 5, 6, 7, 8
@@ -146,8 +147,8 @@ Gemm config file (Strategy reshaped_rhs_only):
H0 >= 1
An example gemm config file looks like:
- 4,4,4,1,1,1
- 4,4,4,3,1,0
+ 4,4,4,1,1,1,0
+ 4,4,4,3,1,0,1
...
EOF
@@ -179,6 +180,7 @@ Gemm config file (Strategy reshaped):
interleave_lhs - Interleave lhs matrix (1) / Do not interleave lhs matrix (0)
interleave_rhs - Interleave rhs matrix (1) / Do not interleave rhs matrix (0)
transpose_rhs - Transpose rhs matrix but not lhs matrix (1) / Do not transpose rhs matrix but do transpose lhs matrix (0)
+ export_to_cl_image_rhs - Export rhs matrix to cl_image (1) / Do not export rhs matrix to cl_image (0)
If rhs matrix is transposed only the following configurations are currently supported:
M0 = 2, 3, 4, 5, 6, 7, 8
@@ -195,8 +197,8 @@ Gemm config file (Strategy reshaped):
H0 >= 1
An example gemm config file looks like:
- 4,4,4,1,3,1,1,1
- 4,4,4,3,3,1,1,0
+ 4,4,4,1,3,1,1,1,0
+ 4,4,4,3,3,1,1,0,1
...
EOF
@@ -239,6 +241,11 @@ Options:
-d <data_type>
Data type option with which to run benchmark examples
Default: ${DEFAULT_DATA_TYPE}
+ Supported options:
+ Strategy : Data Types
+ Native : F32
+ Reshaped : F16, F32
+ Reshaped RHS Only : F16, F32
-o <out_dir>
Path to output directory that holds output json files
diff --git a/examples/gemm_tuner/cl_gemm_native.cpp b/examples/gemm_tuner/cl_gemm_native.cpp
index 47abd85450..43035082a4 100644
--- a/examples/gemm_tuner/cl_gemm_native.cpp
+++ b/examples/gemm_tuner/cl_gemm_native.cpp
@@ -166,10 +166,10 @@ public:
}
// Print gemm parameters and configurations
- std::cerr << "Gemm parameters:" << std::endl;
- std::cerr << params << std::endl;
- std::cerr << "Gemm configurations:" << std::endl;
- std::cerr << configs << std::endl;
+ std::cout << "Gemm parameters:" << std::endl;
+ std::cout << params << std::endl;
+ std::cout << "Gemm configurations:" << std::endl;
+ std::cout << configs << std::endl;
CLScheduler::get().default_init(&tuner);
@@ -194,6 +194,17 @@ public:
kernel_info.broadcast_bias = true;
kernel_info.activation_info = act_info;
+ // Validate argments
+ Status status{};
+ status = gemm.validate((&lhs)->info(), (&rhs)->info(), (&bias)->info(), (&dst)->info(), alpha, beta, lhs_info, rhs_info, kernel_info);
+ if(!status)
+ {
+ // Unsupported arguments
+ std::cerr << "Unsupported arguments." << std::endl;
+ std::cerr << "Check documentation for supported/unsupported combinations" << std::endl;
+ return false;
+ }
+
// Configure function
gemm.configure(&lhs, &rhs, &bias, &dst, alpha, beta, lhs_info, rhs_info, kernel_info);
diff --git a/examples/gemm_tuner/cl_gemm_reshaped.cpp b/examples/gemm_tuner/cl_gemm_reshaped.cpp
index 93125dd4a3..9c6568cffb 100644
--- a/examples/gemm_tuner/cl_gemm_reshaped.cpp
+++ b/examples/gemm_tuner/cl_gemm_reshaped.cpp
@@ -218,10 +218,10 @@ public:
}
// Print gemm parameters and configurations
- std::cerr << "Gemm parameters:" << std::endl;
- std::cerr << params << std::endl;
- std::cerr << "Gemm configurations:" << std::endl;
- std::cerr << configs << std::endl;
+ std::cout << "Gemm parameters:" << std::endl;
+ std::cout << params << std::endl;
+ std::cout << "Gemm configurations:" << std::endl;
+ std::cout << configs << std::endl;
CLScheduler::get().default_init(&tuner);
@@ -264,6 +264,26 @@ public:
arm_compute::cl_gemm::update_padding_for_cl_image(rhs_reshaped.info());
}
+ // Validate argments
+ Status status{};
+ status = reshape_lhs.validate((&lhs)->info(), (&lhs_reshaped)->info(), lhs_info, kernel_info.reinterpret_input_as_3d);
+ if(!status)
+ {
+ // Unsupported arguments
+ std::cerr << "Unsupported arguments." << std::endl;
+ std::cerr << "Check documentation for supported/unsupported combinations" << std::endl;
+ return false;
+ }
+
+ status = gemm.validate((&lhs_reshaped)->info(), (&rhs_reshaped)->info(), (&bias)->info(), (&dst)->info(), alpha, beta, lhs_info, rhs_info, kernel_info);
+ if(!status)
+ {
+ // Unsupported arguments
+ std::cerr << "Unsupported arguments." << std::endl;
+ std::cerr << "Check documentation for supported/unsupported combinations" << std::endl;
+ return false;
+ }
+
// Configure reshape lhs function
reshape_lhs.configure(&lhs, &lhs_reshaped, lhs_info);
diff --git a/examples/gemm_tuner/cl_gemm_reshaped_rhs_only.cpp b/examples/gemm_tuner/cl_gemm_reshaped_rhs_only.cpp
index 45a28abca6..f814c541c4 100644
--- a/examples/gemm_tuner/cl_gemm_reshaped_rhs_only.cpp
+++ b/examples/gemm_tuner/cl_gemm_reshaped_rhs_only.cpp
@@ -191,10 +191,10 @@ public:
}
// Print gemm parameters and configurations
- std::cerr << "Gemm parameters:" << std::endl;
- std::cerr << params << std::endl;
- std::cerr << "Gemm configurations:" << std::endl;
- std::cerr << configs << std::endl;
+ std::cout << "Gemm parameters:" << std::endl;
+ std::cout << params << std::endl;
+ std::cout << "Gemm configurations:" << std::endl;
+ std::cout << configs << std::endl;
CLScheduler::get().default_init(&tuner);
@@ -230,6 +230,18 @@ public:
{
arm_compute::cl_gemm::update_padding_for_cl_image(rhs_reshaped.info());
}
+
+ // Validate argments
+ Status status{};
+ status = gemm.validate((&lhs)->info(), (&rhs_reshaped)->info(), (&bias)->info(), (&dst)->info(), alpha, beta, lhs_info, rhs_info, kernel_info);
+ if(!status)
+ {
+ // Unsupported arguments
+ std::cerr << "Unsupported arguments." << std::endl;
+ std::cerr << "Check documentation for supported/unsupported combinations" << std::endl;
+ return false;
+ }
+
// Configure function
gemm.configure(&lhs, &rhs_reshaped, &bias, &dst, alpha, beta, lhs_info, rhs_info, kernel_info);