Summary: Improve the error-prone interface that allows users to pass host pointers that haven't been registered to asynchronous copy methods. In CUDA, this is an extremely easy error to make, and instead of failing at runtime, it succeeds and gives the right answers by turning the async copy into a sync copy. So, you silently get a huge performance degradation if you misuse the old interface. This new interface should prevent that. Reviewers: jlebar Subscribers: jprice, beanz, parallel_libs-commits Differential Revision: https://reviews.llvm.org/D24353 llvm-svn: 281225
30 lines
869 B
C++
30 lines
869 B
C++
//===-- HostMemory.cpp - HostMemory 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 HostMemory internals.
|
|
///
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
#include "streamexecutor/HostMemory.h"
|
|
#include "streamexecutor/Device.h"
|
|
|
|
namespace streamexecutor {
|
|
namespace internal {
|
|
|
|
void destroyRegisteredHostMemoryInternals(Device *TheDevice, void *Pointer) {
|
|
// TODO(jhen): How to handle errors here?
|
|
if (Pointer) {
|
|
consumeError(TheDevice->unregisterHostMemory(Pointer));
|
|
}
|
|
}
|
|
|
|
} // namespace internal
|
|
} // namespace streamexecutor
|