MCPcopy Create free account
hub / github.com/DeepRec-AI/DeepRec / PrePackForMulInternal

Function PrePackForMulInternal

tensorflow/lite/experimental/ruy/prepack.h:41–72  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

39template <Path CompiledPaths, typename LhsScalar, typename RhsScalar,
40 typename DstScalar, typename Spec>
41void PrePackForMulInternal(const Matrix<LhsScalar>& lhs,
42 const Matrix<RhsScalar>& rhs, const Spec& spec,
43 Context* context, Matrix<DstScalar>* dst,
44 SidePair<PrepackedMatrix*> prepacked,
45 std::function<void*(std::size_t)> alloc_fn) {
46 gemmlowp::ScopedProfilingLabel label("PrePackForMul");
47 Path the_path = context->GetPathToTake<CompiledPaths>();
48 RUY_CHECK(the_path != Path::kReference);
49 constexpr Path TrMulCompiledPaths = CompiledPaths & ~Path::kReference;
50 Matrix<LhsScalar> transposed_lhs(lhs);
51 Transpose(&transposed_lhs);
52 TrMulParams params;
53 CreateTrMulParams<TrMulCompiledPaths>(transposed_lhs, rhs, spec, context, dst,
54 the_path, &params);
55
56 const SidePair<int> origin{0, 0};
57 const SidePair<int> rounded_dims{params.packed[Side::kLhs].layout.cols,
58 params.packed[Side::kRhs].layout.cols};
59
60 Tuning tuning = context->GetMainThreadTuning();
61 for (Side side : {Side::kLhs, Side::kRhs}) {
62 if (prepacked[side]) {
63 prepacked[side]->data_size = DataSize(params.packed[side]);
64 prepacked[side]->sums_size = SumsSize(params.packed[side]);
65 prepacked[side]->data = alloc_fn(prepacked[side]->data_size);
66 prepacked[side]->sums = alloc_fn(prepacked[side]->sums_size);
67 params.packed[side].data = prepacked[side]->data;
68 params.packed[side].sums = prepacked[side]->sums;
69 params.RunPack(side, tuning, origin[side], rounded_dims[side]);
70 }
71 }
72}
73
74template <Path CompiledPaths, typename LhsScalar, typename RhsScalar,
75 typename DstScalar, typename Spec>

Callers

nothing calls this directly

Calls 5

DataSizeFunction · 0.85
SumsSizeFunction · 0.85
GetMainThreadTuningMethod · 0.80
RunPackMethod · 0.80
TransposeFunction · 0.70

Tested by

no test coverage detected