File: pocl_cache.h

package info (click to toggle)
pocl 6.0-7
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 25,320 kB
  • sloc: lisp: 149,513; ansic: 103,778; cpp: 54,947; python: 1,513; sh: 949; ruby: 255; pascal: 226; tcl: 180; makefile: 175; java: 72; xml: 49
file content (141 lines) | stat: -rw-r--r-- 5,381 bytes parent folder | download | duplicates (2)
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
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
/* pocl_cache.h: global declarations of caching functions used mostly in runtime

   Copyright (c) 2015 pocl developers

   Permission is hereby granted, free of charge, to any person obtaining a copy
   of this software and associated documentation files (the "Software"), to deal
   in the Software without restriction, including without limitation the rights
   to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
   copies of the Software, and to permit persons to whom the Software is
   furnished to do so, subject to the following conditions:

   The above copyright notice and this permission notice shall be included in
   all copies or substantial portions of the Software.

   THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
   IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
   FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
   AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
   LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
   OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
   THE SOFTWARE.
*/

#ifndef POCL_CACHE_H
#define POCL_CACHE_H

#include "pocl_cl.h"

/* The filename in which the work group (parallelizable) kernel LLVM bc is stored in
   the kernel's temp dir. */
#define POCL_PARALLEL_BC_FILENAME   "/parallel.bc"

#ifdef __cplusplus
extern "C" {
#endif

#include <CL/cl.h>

int pocl_cache_init_topdir ();

unsigned pocl_cache_buildhash_is_valid(cl_program program, unsigned device_i);

POCL_EXPORT
int
pocl_cache_create_program_cachedir(cl_program program, unsigned device_i,
                                   const char* preprocessed_source, size_t source_len,
                                   char *program_bc_path);

void pocl_cache_cleanup_cachedir(cl_program program);

POCL_EXPORT
int pocl_cache_tempname (char *path_template, const char *suffix, int *fd);

int pocl_cache_create_tempdir(char* path);

int pocl_cache_write_program_source(char *program_cl_path,
                                    cl_program program);

int pocl_cache_write_kernel_objfile (char *objfile_path,
                                     const char *objfile_content,
                                     uint64_t objfile_size);

int pocl_cache_write_spirv (char *spirv_path,
                            const char *spirv_content,
                            uint64_t file_size);

POCL_EXPORT
int pocl_cache_write_generic_objfile (char *objfile_path,
                                      const char *objfile_content,
                                      uint64_t objfile_size);

int pocl_cache_update_program_last_access(cl_program program,
                                          unsigned device_i);


char* pocl_cache_read_buildlog(cl_program program, unsigned device_i);

int pocl_cache_append_to_buildlog(cl_program  program,
                                  unsigned    device_i,
                                  const char *content,
                                  size_t      size);


int pocl_cache_device_cachedir_exists(cl_program   program,
                                      unsigned device_i);

POCL_EXPORT
int pocl_cache_write_descriptor (_cl_command_node *Command, cl_kernel kernel,
                                 int Specialize, const char *content,
                                 size_t size);

POCL_EXPORT
void pocl_cache_kernel_cachedir_path (char *kernel_cachedir_path,
                                      cl_program program, unsigned program_device_i,
                                      cl_kernel kernel, const char *append_str,
                                      _cl_command_node *command,
                                      int specialize);

int pocl_cache_write_kernel_parallel_bc (void *bc, cl_program program,
                                         int device_i, cl_kernel kernel,
                                         _cl_command_node *command,
                                         int specialize);

// required by pocl_binary.c
POCL_EXPORT
void pocl_cache_program_path (char *path, cl_program program,
                              unsigned device_i);

void pocl_cache_kernel_cachedir (char *kernel_cachedir_path,
                                 cl_program program, unsigned device_i,
                                 const char *kernel_name);

// these two required by llvm API

POCL_EXPORT
void pocl_cache_program_bc_path(char*       program_bc_path,
                               cl_program   program,
                               unsigned     device_i);

POCL_EXPORT
void pocl_cache_program_spv_path (char *program_bc_path, cl_program program,
                                  unsigned device_i);

POCL_EXPORT
void pocl_cache_work_group_function_path (char *parallel_bc_path,
                                          cl_program program,
                                          unsigned device_i, cl_kernel kernel,
                                          _cl_command_node *command,
                                          int specialize);

void pocl_cache_final_binary_path (char *final_binary_path, cl_program program,
                                   unsigned device_i, cl_kernel kernel,
                                   _cl_command_node *command, int specialize);


#ifdef __cplusplus
}
#endif


#endif