Debian Codegraph @

rts/c/context_prototypes.h

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