1/* Copyright 2017 The TensorFlow Authors. All Rights Reserved. 2 3Licensed under the Apache License, Version 2.0 (the "License"); 4you may not use this file except in compliance with the License. 5You may obtain a copy of the License at 6 7 http://www.apache.org/licenses/LICENSE-2.0 8 9Unless required by applicable law or agreed to in writing, software 10distributed under the License is distributed on an "AS IS" BASIS, 11WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12See the License for the specific language governing permissions and 13limitations under the License. 14==============================================================================*/ 15 16#ifndef TENSORFLOW_STREAM_EXECUTOR_HOST_BUFFER_H_ 17#define TENSORFLOW_STREAM_EXECUTOR_HOST_BUFFER_H_ 18 19#include "tensorflow/stream_executor/dnn.h" 20 21namespace perftools { 22namespace gputools { 23 24// A HostBuffer is a block of memory in host memory containing the data for a 25// dnn::BatchDescriptor using a device-dependent memory layout. 26// Derived classes provide methods to construct a HostBuffer for a specific 27// device, and to copy data in and out of the buffer. 28class HostBuffer { 29 public: 30 const dnn::BatchDescriptor& descriptor() const { return descriptor_; } 31 32 // Returns a string describing the HostBuffer. 33 virtual string AsString() const = 0; 34 35 protected: 36 // Construct a HostBuffer from the supplied dnn::BatchDescriptor. 37 explicit HostBuffer(const dnn::BatchDescriptor& descriptor) 38 : descriptor_(descriptor) {} 39 virtual ~HostBuffer() {} 40 41 private: 42 const dnn::BatchDescriptor descriptor_; 43}; 44 45} // namespace gputools 46} // namespace perftools 47 48#endif // TENSORFLOW_STREAM_EXECUTOR_HOST_BUFFER_H_ 49