diff --git a/paddle/fluid/memory/detail/memory_block.cc b/paddle/fluid/memory/detail/memory_block.cc index 79f65f1eb8beec7fb06811c693fe544a6b2eec29..f34b922b25a0110690671d487f190e1b977a67bb 100644 --- a/paddle/fluid/memory/detail/memory_block.cc +++ b/paddle/fluid/memory/detail/memory_block.cc @@ -27,7 +27,7 @@ void MemoryBlock::init(MetadataCache* cache, Type t, size_t index, size_t size, static_cast(right_buddy))); } -MemoryBlock::Type MemoryBlock::type(MetadataCache& cache) const { +MemoryBlock::Type MemoryBlock::type(const MetadataCache& cache) const { return cache.load(this).type; } diff --git a/paddle/fluid/memory/detail/memory_block.h b/paddle/fluid/memory/detail/memory_block.h index f0a06577a507bb2315c7c26c78dc0a4e437f786c..5cceba659beeec1b3c986dc43229f6725e3e11de 100644 --- a/paddle/fluid/memory/detail/memory_block.h +++ b/paddle/fluid/memory/detail/memory_block.h @@ -13,7 +13,8 @@ See the License for the specific language governing permissions and limitations under the License. */ #pragma once -#include +#include +#include namespace paddle { namespace memory { @@ -37,7 +38,7 @@ struct MemoryBlock { // MemoryBlock::Desc to the beginning of the block; or, if it is a GPU memory // block, the MetadataCache writes the Meatadata to a std::map in // the CPU. - void init(MemoryBlock::DescCache* cache, Type t, size_t index, size_t size, + void init(MetadataCache* cache, Type t, size_t index, size_t size, void* left_buddy, void* right_buddy); // All these accessors returns fields in the MemoryBlock::Desc of the memory