1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59
|
// Start of context_prototypes.h
//
// Prototypes for the functions in context.h, or that will be called
// from those functions, that need to be available very early.
struct futhark_context_config;
struct futhark_context;
static void set_error(struct futhark_context* ctx, char *error);
// These are called in context/config new/free functions and contain
// shared setup. They are generated by the compiler itself.
static int init_constants(struct futhark_context*);
static int free_constants(struct futhark_context*);
static void setup_program(struct futhark_context* ctx);
static void teardown_program(struct futhark_context *ctx);
// Allocate host memory. Must be freed with host_free().
static void host_alloc(struct futhark_context* ctx, size_t size, const char* tag, size_t* size_out, void** mem_out);
// Allocate memory allocated with host_alloc().
static void host_free(struct futhark_context* ctx, size_t size, const char* tag, void* mem);
// Log that a copy has occurred. The provenance may be NULL, if we do not know
// where this came from.
static void log_copy(struct futhark_context* ctx,
const char *kind, const char *provenance,
int r,
int64_t dst_offset, int64_t dst_strides[r],
int64_t src_offset, int64_t src_strides[r],
int64_t shape[r]);
static void log_transpose(struct futhark_context* ctx,
int64_t k, int64_t m, int64_t n);
static bool lmad_map_tr(int64_t *num_arrays_out, int64_t *n_out, int64_t *m_out,
int r,
const int64_t dst_strides[r],
const int64_t src_strides[r],
const int64_t shape[r]);
static bool lmad_contiguous(int r, int64_t strides[r], int64_t shape[r]);
static bool lmad_memcpyable(int r,
int64_t dst_strides[r], int64_t src_strides[r], int64_t shape[r]);
static void add_event(struct futhark_context* ctx,
const char* name,
const char* provenance,
struct kvs *kvs,
void* data,
event_report_fn f);
// Functions that must be defined by the backend.
static void backend_context_config_setup(struct futhark_context_config* cfg);
static void backend_context_config_teardown(struct futhark_context_config* cfg);
static int backend_context_setup(struct futhark_context *ctx);
static void backend_context_teardown(struct futhark_context *ctx);
// End of of context_prototypes.h
|