MCPcopy Create free account
hub / github.com/DeepRec-AI/DeepRec / SYCLmemcpy

Function SYCLmemcpy

tensorflow/core/common_runtime/sycl/sycl_util.h:33–77  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

31inline void* GetBase(Tensor* dst) { return DMAHelper::base(dst); }
32
33inline void SYCLmemcpy(Eigen::SyclDevice const& device,
34 Tensor const& src_tensor, Tensor* dst_tensor) {
35 const size_t size = src_tensor.TotalBytes();
36 void* dst_ptr = GetBase(dst_tensor);
37 void const* src_ptr = GetBase(&src_tensor);
38
39#define COPY_WITH_TYPE(T) \
40 device.memcpy(dst_ptr, static_cast<T const*>(src_ptr), size);
41 switch (src_tensor.dtype()) {
42 case DT_COMPLEX128:
43 COPY_WITH_TYPE(cl::sycl::cl_ulong2);
44 break;
45 case DT_DOUBLE:
46 case DT_COMPLEX64:
47 case DT_INT64:
48 COPY_WITH_TYPE(cl::sycl::cl_ulong);
49 break;
50 case DT_FLOAT:
51 case DT_INT32:
52 case DT_QINT32:
53 COPY_WITH_TYPE(cl::sycl::cl_uint);
54 break;
55 case DT_INT16:
56 case DT_UINT16:
57 case DT_BFLOAT16:
58 case DT_QINT16:
59 case DT_QUINT16:
60 case DT_HALF:
61 COPY_WITH_TYPE(cl::sycl::cl_ushort);
62 break;
63 case DT_BOOL:
64 COPY_WITH_TYPE(bool);
65 break;
66 case DT_UINT8:
67 case DT_INT8:
68 case DT_QINT8:
69 case DT_QUINT8:
70 COPY_WITH_TYPE(cl::sycl::cl_uchar);
71 break;
72 default:
73 LOG(FATAL) << "Unknown data type " << src_tensor.dtype();
74 break;
75 }
76#undef COPY_WITH_TYPE
77}
78} // namespace tensorflow
79
80#endif // TENSORFLOW_CORE_COMMON_RUNTIME_SYCL_SYCL_UTIL_H_

Callers 1

ComputeMethod · 0.85

Calls 3

GetBaseFunction · 0.70
TotalBytesMethod · 0.45
dtypeMethod · 0.45

Tested by

no test coverage detected