You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
51 lines
992 B
51 lines
992 B
#pragma once
|
|
|
|
#include <stdint.h>
|
|
#include "include/msm_kgsl.h"
|
|
#include <vector>
|
|
#include <CL/cl.h>
|
|
|
|
class Thneed;
|
|
|
|
class GPUMalloc {
|
|
public:
|
|
GPUMalloc(int size, int fd);
|
|
void *alloc(int size);
|
|
private:
|
|
uint64_t base;
|
|
int remaining;
|
|
};
|
|
|
|
class CachedCommand {
|
|
public:
|
|
CachedCommand(Thneed *lthneed, struct kgsl_gpu_command *cmd);
|
|
void exec(bool wait);
|
|
void disassemble();
|
|
private:
|
|
struct kgsl_gpu_command cache;
|
|
struct kgsl_command_object cmds[2];
|
|
struct kgsl_command_object objs[1];
|
|
Thneed *thneed;
|
|
};
|
|
|
|
class Thneed {
|
|
public:
|
|
Thneed();
|
|
void stop();
|
|
void execute(float **finputs, float *foutput, bool slow=false);
|
|
|
|
std::vector<cl_mem> inputs;
|
|
cl_mem output;
|
|
|
|
cl_command_queue command_queue;
|
|
int context_id;
|
|
|
|
// protected?
|
|
int record;
|
|
int timestamp;
|
|
GPUMalloc *ram;
|
|
std::vector<CachedCommand *> cmds;
|
|
std::vector<std::pair<int, struct kgsl_gpuobj_sync_obj *> > syncobjs;
|
|
int fd;
|
|
};
|
|
|
|
|