-
Notifications
You must be signed in to change notification settings - Fork 19
Expand file tree
/
Copy pathcodegen.h
More file actions
57 lines (45 loc) · 1.22 KB
/
codegen.h
File metadata and controls
57 lines (45 loc) · 1.22 KB
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
#ifndef THORIN_CODEGEN_H
#define THORIN_CODEGEN_H
#include "thorin/transform/importer.h"
#include "thorin/be/kernel_config.h"
namespace thorin {
class CodeGen {
protected:
CodeGen(Thorin& thorin, bool debug);
public:
virtual ~CodeGen() {}
virtual void emit_stream(std::ostream& stream) = 0;
virtual const char* file_ext() const = 0;
/// @name getters
//@{
Thorin& thorin() const { return thorin_; }
World& world() const { return thorin().world(); }
bool debug() const { return debug_; }
//@}
private:
Thorin& thorin_;
bool debug_;
};
struct LaunchArgs {
enum {
Mem = 0,
Device,
Space,
Config,
Body,
Return,
Num
};
};
struct DeviceBackends {
DeviceBackends(World& world, int opt, bool debug, std::string& hls_flags);
Cont2Config kernel_config;
std::vector<Continuation*> kernels;
enum { CUDA, NVVM, OpenCL, AMDGPU_HSA, AMDGPU_PAL, HLS, Shady, BackendCount };
std::array<std::unique_ptr<CodeGen>, BackendCount> cgs;
private:
std::array<const char*, BackendCount> backend_names = { "CUDA", "NVVM", "OpenCL", "AMDGPU_HSA", "AMDGPU_PAL", "HLS", "Shady" };
std::vector<Thorin> accelerator_code;
};
}
#endif