// Copyright 2015 The Gemmlowp Authors. 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. // block_params.h: Logic to choose L1 and L2 block sizes // to optimize cache-friendliness. #ifndef GEMMLOWP_INTERNAL_BLOCK_PARAMS_H_ #define GEMMLOWP_INTERNAL_BLOCK_PARAMS_H_ #include "common.h" namespace gemmlowp { // A BlockParams instance contains a full description of all the block size // parameters to be used by a Gemm. // There are two nested levels of block subdivisions: first a subdivision // into large blocks that should fit in last-level cache (what we call L2 here) // and then another subdivision into smaller blocks that should fit in // L1 cache. There is then actually a third level of subdivision to fit // in registers, but we are not concerned with that here. struct BlockParams { … }; // A SideBlockParams instance contains only the block params relevant to // one side (LHS or RHS), expressed in terms of 'width' instead of // rows/colums. See the explanation in kernel.h: in the LHS, 'width' means // the number of rows, while in the RHS, 'width' means the number of columns. // That allows us to write generic code that applies to either LHS or RHS. struct SideBlockParams { … }; enum class Side { … }; inline void GetSideBlockParams(Side side, SideBlockParams* side_block_params, const BlockParams& block_params) { … } } // namespace gemmlowp #endif // GEMMLOWP_INTERNAL_BLOCK_PARAMS_H_