-
Notifications
You must be signed in to change notification settings - Fork 0
/
hetker_lib.h
70 lines (54 loc) · 1.27 KB
/
hetker_lib.h
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
#pragma once
#ifndef HETKER_HETKER_H
#define HETKER_HETKER_H
#endif //HETKER_HETKER_H
#include <stdio.h>
#include <stdlib.h>
#include <CL/cl.h>
#include "strings.h"
#include "util.h"
#include "kernels/header.cl"
// TODO Count & check
#define LIB_KERNEL_COUNT 15
#define CL_MAX_DEVICES 100
typedef struct {
//unsigned char dataType; // 0 - list, 1 - matrix, 2 - image
cl_program program;
cl_kernel kernel;
size_t inputMemorySize;
size_t outputMemorySize;
// TODO
} Task;
typedef struct tagTaskSeqNode TaskSeqNode;
struct tagTaskSeqNode {
Task* task;
TaskSeqNode* next;
};
typedef struct {
TaskSeqNode* head;
const Device* device;
int valid;
} TaskSeq;
typedef struct {
String* kernel;
StringArray types;
SizeArray typesSizes;
StringArray includes;
SizeArray taskLengths;
int threshold; // TODO
} TaskDescriptor;
typedef struct {
TaskDescriptor* data;
size_t curLength;
size_t length;
int conserveMemory; // TODO: Unimplemented
} TaskDescriptorSeq;
extern DeviceList deviceList;
extern int loggingEnabled;
cl_device_id getPreferredDevice(int index);
int checkErr(cl_int err, char* errorMsg);
void logger(const char data[]) {
if (loggingEnabled) {
printf("[hetker] %s\n", data);
}
}