forked from plaidml/plaidml
-
Notifications
You must be signed in to change notification settings - Fork 0
/
device.h
50 lines (36 loc) · 1.46 KB
/
device.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
// Copyright 2017-2018 Intel Corporation.
#pragma once
#include <memory>
#include <string>
#include <unordered_map>
#include <vector>
#include "base/context/context.h"
#include "tile/base/hal.h"
#include "tile/hal/opencl/device_state.h"
#include "tile/hal/opencl/ocl.h"
#include "tile/hal/opencl/opencl.pb.h"
namespace vertexai {
namespace tile {
namespace hal {
namespace opencl {
// Device implements the hal::Device model as a single OpenCL device.
class Device final : public hal::Device {
public:
Device(const context::Context& ctx, const CLObj<cl_context>& cl_ctx, cl_device_id did, proto::DeviceInfo info);
void Initialize(const hal::proto::HardwareSettings& settings) final;
std::string description() final;
hal::Compiler* compiler() final { return compiler_.get(); }
hal::Loader* loader() final { return nullptr; /* TODO: Support offline compilation */ }
const std::unordered_map<std::string, std::unique_ptr<hal::Loader>>& il_loader_map() final { return il_loader_map_; }
hal::Executor* executor() final { return executor_.get(); }
const std::shared_ptr<DeviceState>& device_state() const { return device_state_; }
private:
const std::shared_ptr<DeviceState> device_state_;
const std::unique_ptr<hal::Compiler> compiler_;
const std::unordered_map<std::string, std::unique_ptr<hal::Loader>> il_loader_map_;
const std::unique_ptr<hal::Executor> executor_;
};
} // namespace opencl
} // namespace hal
} // namespace tile
} // namespace vertexai