/* 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. ==============================================================================*/ #include "ruy/prepacked_cache.h" #include "ruy/mat.h" #include "ruy/profiler/instrumentation.h" #include "ruy/system_aligned_alloc.h" namespace ruy { namespace { // Allocates the `data` and `sums` buffers, and sets the corresponding // pointer fields, in a PEMat whose other fields, particularly `layout` // and the runtime data types, are already populated. std::ptrdiff_t AllocateBuffers(PEMat* packed_matrix) { … } // Frees the `data` and `sums` buffers held by a PEMat. void FreeBuffers(const PEMat& packed_matrix) { … } } // end anonymous namespace std::size_t PrepackedCache::KeyHash::operator()( const PrepackedCache::Key& key) const { … } PrepackedCache::~PrepackedCache() { … } PrepackedCache::Action PrepackedCache::Get(const void* src_data, PEMat* packed_matrix) { … } void PrepackedCache::EjectUntilRoomFor(std::ptrdiff_t new_bytes) { … } void PrepackedCache::EjectOne() { … } } // namespace ruy