| 116 | |
| 117 | template <typename LeftStream, typename RightStream> |
| 118 | void QuantizedGemmImpl(OpKernelContext* tf_context, const quint8* a_data, |
| 119 | const quint8* b_data, qint32* c_data, int m, int n, |
| 120 | int k, int offset_a, int offset_b, int lda, int ldb, |
| 121 | int ldc) { |
| 122 | typedef gemmlowp::meta::GemmParams< |
| 123 | uint8_t, int32_t, LeftStream, RightStream, |
| 124 | gemmlowp::meta::QuantizedStaticPreprocessedAsInt32, |
| 125 | gemmlowp::meta::RowMajor> |
| 126 | Params; |
| 127 | Params params; |
| 128 | |
| 129 | params.m = m; |
| 130 | params.n = n; |
| 131 | params.k = k; |
| 132 | |
| 133 | params.lhs = reinterpret_cast<const uint8_t*>(&(a_data->value)); |
| 134 | params.rhs = reinterpret_cast<const uint8_t*>(&(b_data->value)); |
| 135 | params.result = reinterpret_cast<int32_t*>(&(c_data->value)); |
| 136 | params.scratch = CHECK_NOTNULL(GetScratch(tf_context)); |
| 137 | |
| 138 | params.left_stream.count = k; |
| 139 | params.left_stream.stride = lda; |
| 140 | params.left_stream.multiplicative_sum_offset = offset_b; |
| 141 | params.left_stream.additive_sum_offset = k * offset_a * offset_b; |
| 142 | |
| 143 | params.right_stream.count = k; |
| 144 | params.right_stream.stride = ldb; |
| 145 | params.right_stream.multiplicative_sum_offset = offset_a; |
| 146 | params.right_stream.additive_sum_offset = 0; |
| 147 | |
| 148 | params.fused_kernel.kernel.count = k; |
| 149 | params.fused_kernel.output_stream.stride = ldc * sizeof(int32_t); |
| 150 | |
| 151 | if (g_use_local_context) { |
| 152 | LocalContext local_context(GetWorkersCount(tf_context), GetWorkersPool()); |
| 153 | MultiThreadGemm<LocalContext, Params>(&local_context, params); |
| 154 | } else { |
| 155 | auto& workers = *(tf_context->device()->tensorflow_cpu_worker_threads()); |
| 156 | TensorflowGemmContext context(workers.num_threads, workers.workers); |
| 157 | MultiThreadGemm<TensorflowGemmContext, Params>(&context, params); |
| 158 | } |
| 159 | } |
| 160 | |
| 161 | template <typename Params, int kernel_size> |
| 162 | void MultiThreadTransform1D(OpKernelContext* tf_context, const Params& params) { |
nothing calls this directly
no test coverage detected