diff options
author | 2016-09-01 12:43:08 -0800 | |
---|---|---|
committer | 2016-09-01 13:47:58 -0700 | |
commit | 29afea87af467453bb96d243f2875ac8124ccd3e (patch) | |
tree | 5033f5fe12450ad0a5a7197c4e1fce2883777533 /tensorflow/contrib/quantization | |
parent | 676f126339d9f74011ee6f6992974de1386b8692 (diff) |
Add a test to verify overhead of hexagon rpc calls
Change: 131987004
Diffstat (limited to 'tensorflow/contrib/quantization')
-rw-r--r-- | tensorflow/contrib/quantization/kernels/hexagon/quantized_matmul_op_for_hexagon_test.cc | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/tensorflow/contrib/quantization/kernels/hexagon/quantized_matmul_op_for_hexagon_test.cc b/tensorflow/contrib/quantization/kernels/hexagon/quantized_matmul_op_for_hexagon_test.cc index 9c452fe39c..3a36985852 100644 --- a/tensorflow/contrib/quantization/kernels/hexagon/quantized_matmul_op_for_hexagon_test.cc +++ b/tensorflow/contrib/quantization/kernels/hexagon/quantized_matmul_op_for_hexagon_test.cc @@ -31,6 +31,7 @@ limitations under the License. #ifdef USE_HEXAGON_LIBS #include "tensorflow/core/platform/hexagon/gemm_wrapper.h" +#include "tensorflow/core/platform/hexagon/profile_utils/cpu_utils.h" #endif namespace tensorflow { @@ -49,6 +50,30 @@ class QuantizedMatMulOpForHexagonTest : public OpsTestBase { } }; +// Shows some statistics of hexagon dsp using hexagon specific APIs +#ifdef USE_HEXAGON_LIBS +TEST_F(QuantizedMatMulOpForHexagonTest, EvaluateSharedLibOverhead) { + const uint64 overhead_shared_lib_start = + profile_utils::CpuUtils::GetCurrentCycleClock(); + const int wrapper_version = hexagon_gemm_wrapper_GetWrapperVersion(); + const uint64 overhead_shared_lib_end = + profile_utils::CpuUtils::GetCurrentCycleClock(); + const uint64 overhead_hexagon_rpc_start = + profile_utils::CpuUtils::GetCurrentCycleClock(); + const int hexagon_binary_version = + hexagon_gemm_wrapper_GetHexagonBinaryVersion(); + const uint64 overhead_hexagon_rpc_end = + profile_utils::CpuUtils::GetCurrentCycleClock(); + LOG(INFO) << "Shared lib (ver = " << wrapper_version << ") overhead is " + << (overhead_shared_lib_end - overhead_shared_lib_start) + << " cycles"; + LOG(INFO) << "hexagon rpc (ver = " << hexagon_binary_version + << ") overhead is " + << (overhead_hexagon_rpc_end - overhead_hexagon_rpc_start) + << " cycles"; +} +#endif + // Runs two small matrices through the operator, and leaves all the parameters // at their default values. // This test is a sample to execute matmul on hexagon. |