mcuMemHostRegister: take into account sizeof(float)

cuMemHostRegister expects the size of registered memory in bytes whereas the
memref descriptor in memref_t contains the number of elements.  Get the actual
size in bytes instead.

PiperOrigin-RevId: 257589116
This commit is contained in:
Alex Zinenko 2019-07-11 05:21:34 -07:00 committed by jpienaar
parent 801efec9e6
commit 7ef559e0f2
1 changed files with 3 additions and 2 deletions

View File

@ -89,8 +89,9 @@ struct memref_t {
// Allows to register a pointer with the CUDA runtime. Helpful until
// we have transfer functions implemented.
extern "C" void mcuMemHostRegister(const memref_t arg, int32_t flags) {
reportErrorIfAny(cuMemHostRegister(arg.values, arg.length, flags),
"MemHostRegister");
reportErrorIfAny(
cuMemHostRegister(arg.values, arg.length * sizeof(float), flags),
"MemHostRegister");
}
/// Prints the given float array to stderr.