|
#pragma once |
|
|
|
#include <c10/core/Device.h> |
|
|
|
namespace c10 { |
|
|
|
using CopyBytesFunction = void (*)( |
|
size_t nbytes, |
|
const void* src, |
|
Device src_device, |
|
void* dst, |
|
Device dst_device); |
|
|
|
struct C10_API _CopyBytesFunctionRegisterer { |
|
_CopyBytesFunctionRegisterer( |
|
DeviceType from, |
|
DeviceType to, |
|
CopyBytesFunction func_sync, |
|
CopyBytesFunction func_async = nullptr); |
|
}; |
|
|
|
#define REGISTER_COPY_BYTES_FUNCTION(from, to, ...) \ |
|
namespace { \ |
|
static _CopyBytesFunctionRegisterer C10_ANONYMOUS_VARIABLE( \ |
|
g_copy_function)(from, to, __VA_ARGS__); \ |
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
C10_API void CopyBytes( |
|
size_t nbytes, |
|
const void* src, |
|
Device src_device, |
|
void* dst, |
|
Device dst_device, |
|
bool async); |
|
} |
|
|