1#ifndef HALIDE_RUNTIME_DEVICE_BUFFER_UTILS_H
2#define HALIDE_RUNTIME_DEVICE_BUFFER_UTILS_H
32#define MAX_COPY_DIMS 16
53 while (d >= 0 && copy.
extent[d] == 1) {
58 const void *from = (
void *)(copy.
src + src_off);
59 void *to = (
void *)(copy.
dst + dst_off);
72 if (copy.
src != copy.
dst) {
75 debug(
user_context) <<
"copy_memory: no copy needed as pointers are the same.\n";
101 src->
type.bytes() != dst->
type.bytes() ||
125 for (insert = 0; insert < i; insert++) {
128 if (dst_stride_bytes < c.
dst_stride_bytes[insert] && dst_stride_bytes != 0) {
132 for (
int j = i; j > insert; j--) {
182 offset *= src->
type.bytes();
190 offset *= src->
type.bytes();
This file declares the routines used by Halide internally in its runtime.
WEAK void copy_memory(const device_copy ©, void *user_context)
WEAK device_copy make_host_to_device_copy(const halide_buffer_t *buf)
WEAK void copy_memory_helper(const device_copy ©, int d, int64_t src_off, int64_t dst_off)
WEAK device_copy make_device_to_host_copy(const halide_buffer_t *buf)
ALWAYS_INLINE int64_t calc_device_slice_byte_offset(const struct halide_buffer_t *src, int slice_dim, int slice_pos)
ALWAYS_INLINE int64_t calc_device_crop_byte_offset(const struct halide_buffer_t *src, struct halide_buffer_t *dst)
WEAK device_copy make_buffer_copy(const halide_buffer_t *src, bool src_host, const halide_buffer_t *dst, bool dst_host)
This file defines the class FunctionDAG, which is our representation of a Halide pipeline,...
@ Internal
Not visible externally, similar to 'static' linkage in C.
unsigned __INT64_TYPE__ uint64_t
signed __INT64_TYPE__ int64_t
void * memcpy(void *s1, const void *s2, size_t n)
uint64_t src_stride_bytes[MAX_COPY_DIMS]
uint64_t extent[MAX_COPY_DIMS]
uint64_t dst_stride_bytes[MAX_COPY_DIMS]
The raw representation of an image passed around by generated Halide code.
int32_t dimensions
The dimensionality of the buffer.
halide_dimension_t * dim
The shape of the buffer.
uint64_t device
A device-handle for e.g.
uint8_t * host
A pointer to the start of the data in main memory.
struct halide_type_t type
The type of each buffer element.