STT-tensorflow/tensorflow/lite/experimental/ruy/trmul.h
Benoit Jacob b1ca116103 Introduce a SidePair concept allowing us to rewrite much internal
ruy code taking advantage of LHS<->RHS code symmetry to remove
some redundancy.

The key motivation was that I want to experiment with some nontrivial
changes to how TrMulTask handles the packing of blocks, and I didn't want
to have to maintain two copies of this nontrivial code. With this change,
this code is now in a EnsurePacked method that's all I'll have to edit.

PiperOrigin-RevId: 259980220
2019-07-25 11:07:47 -07:00

39 lines
1.6 KiB
C++

/* Copyright 2019 Google LLC. All Rights Reserved.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
==============================================================================*/
// As a matrix multiplication library, Ruy offers a Mul entry point, performing
// matrix multiplication. For implementation purposes, it is much nicer to
// be dealing with the transpose-and-multiply operation, doing
// Destination = Transpose(LHS) * RHS
// Indeed, the latter is performing dot-products between the *columns* of LHS
// and the columns of RHS, whereas a plain matrix multiplication is performing
// dot-products between the *rows* of LHS and the columns of RHS.
// That is why TrMul is nicer to implement, allowing for a more symmetric
// treatment of LHS and RHS.
#ifndef TENSORFLOW_LITE_EXPERIMENTAL_RUY_TRMUL_H_
#define TENSORFLOW_LITE_EXPERIMENTAL_RUY_TRMUL_H_
#include "tensorflow/lite/experimental/ruy/context.h"
#include "tensorflow/lite/experimental/ruy/trmul_params.h"
namespace ruy {
void TrMul(TrMulParams* params, Context* context);
} // namespace ruy
#endif // TENSORFLOW_LITE_EXPERIMENTAL_RUY_TRMUL_H_