Files
llvm-project/parallel-libs/streamexecutor/lib/HostMemory.cpp
Jason Henline 57ea481945 [SE] RegisteredHostMemory for async device copies
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
2016-09-12 16:09:41 +00:00

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