Summary: Final step in getting GlobalDeviceMemory to own its handle. * Make GlobalDeviceMemory movable, but no longer copyable. * Make Device::freeDeviceMemory function private and make GlobalDeviceMemoryBase a friend of Device so GlobalDeviceMemoryBase can free its memory in its destructor. * Make GlobalDeviceMemory constructor private and make Device a friend so it can construct GlobalDeviceMemory. * Remove SharedDeviceMemoryBase class because it is never used. * Remove explicit memory freeing from example code. This change just consumes any errors generated during device memory freeing. The real error handling will be added in a future patch. Reviewers: jlebar Subscribers: jprice, parallel_libs-commits Differential Revision: https://reviews.llvm.org/D24195 llvm-svn: 280509
29 lines
804 B
C++
29 lines
804 B
C++
//===-- DeviceMemory.cpp - DeviceMemory implementation --------------------===//
|
|
//
|
|
// The LLVM Compiler Infrastructure
|
|
//
|
|
// This file is distributed under the University of Illinois Open Source
|
|
// License. See LICENSE.TXT for details.
|
|
//
|
|
//===----------------------------------------------------------------------===//
|
|
///
|
|
/// \file
|
|
/// Implementation of DeviceMemory class internals.
|
|
///
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
#include "streamexecutor/DeviceMemory.h"
|
|
|
|
#include "streamexecutor/Device.h"
|
|
|
|
namespace streamexecutor {
|
|
|
|
GlobalDeviceMemoryBase::~GlobalDeviceMemoryBase() {
|
|
if (Handle) {
|
|
// TODO(jhen): How to handle errors here.
|
|
consumeError(TheDevice->freeDeviceMemory(*this));
|
|
}
|
|
}
|
|
|
|
} // namespace streamexecutor
|