1 /* Copyright 2020 Google LLC. All Rights Reserved. 2 3 Licensed under the Apache License, Version 2.0 (the "License"); 4 you may not use this file except in compliance with the License. 5 You may obtain a copy of the License at 6 7 http://www.apache.org/licenses/LICENSE-2.0 8 9 Unless required by applicable law or agreed to in writing, software 10 distributed under the License is distributed on an "AS IS" BASIS, 11 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 See the License for the specific language governing permissions and 13 limitations under the License. 14 ==============================================================================*/ 15 16 #ifndef RUY_RUY_PREPARE_PACKED_MATRICES_H_ 17 #define RUY_RUY_PREPARE_PACKED_MATRICES_H_ 18 19 #include "ruy/ctx.h" 20 #include "ruy/trmul_params.h" 21 22 namespace ruy { 23 24 // Ensures that the packed matrices are ready for TrMul's work. In the generic 25 // case, this is merely allocating their buffers. 26 // 27 // In the non-default case where 28 // a matrix has a cache_policy allowing caching, this is where we implement 29 // this caching feature: determining whether to cache each matrix, performing 30 // the cache lookup, and possibly performing the packing and cache update if 31 // not already cached. 32 // 33 // Assumes that the packed matrices have previously been created, with their 34 // fields already set except for the buffer allocations, as part of 35 // CreateTrMulParams. The reason for separating this preparation from the 36 // creation is that the creation needs to be templatized and this preparation 37 // does not. 38 void PreparePackedMatrices(Ctx* ctx, TrMulParams* params); 39 40 } // namespace ruy 41 42 #endif // RUY_RUY_PREPARE_PACKED_MATRICES_H_ 43