mirror of
https://github.com/zebrajr/pytorch.git
synced 2025-12-07 00:21:07 +01:00
Summary: Pull Request resolved: https://github.com/pytorch/pytorch/pull/15316 This starts cleaning up the files in c10 according to the module structure we decided on. Move to c10/util: - Half.h, Half-inl.h, Half.cpp, bitcasts.h Move to c10/core: - Device.h, Device.cpp - DeviceType.h, DeviceType.cpp i-am-not-moving-c2-to-c10 Reviewed By: dzhulgakov Differential Revision: D13498493 fbshipit-source-id: dfcf1c490474a12ab950c72ca686b8ad86428f63
45 lines
1.2 KiB
C++
45 lines
1.2 KiB
C++
#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__); \
|
|
}
|
|
|
|
/*
|
|
* WARNING: Implementations for this function are currently registered from
|
|
* ATen and caffe2, not yet from c10. Don't use this if not either ATen
|
|
* or caffe2 is present as well.
|
|
* We can't move them yet, because the CUDA implementations aren't unified yet
|
|
* between ATen and caffe2.
|
|
* We're planning to move the implementations into c10/backend/xxx
|
|
* to make c10 self contained again.
|
|
*/
|
|
C10_API void CopyBytes(
|
|
size_t nbytes,
|
|
const void* src,
|
|
Device src_device,
|
|
void* dst,
|
|
Device dst_device,
|
|
bool async);
|
|
} // namespace c10
|