1 | #pragma once |
2 | #include "taichi/ir/type_utils.h" |
3 | #include "taichi/ir/snode.h" |
4 | #include "taichi/rhi/device.h" |
5 | #include "taichi/program/program.h" |
6 | |
7 | namespace taichi { |
8 | |
9 | namespace ui { |
10 | |
11 | enum class FieldSource : int { |
12 | TaichiNDarray = 0, |
13 | HostMappedPtr = 1, |
14 | }; |
15 | |
16 | #define DEFINE_PROPERTY(Type, name) \ |
17 | Type name; \ |
18 | void set_##name(const Type &new_name) { name = new_name; } \ |
19 | Type get_##name() { return name; } |
20 | |
21 | struct FieldInfo { |
22 | DEFINE_PROPERTY(bool, valid) |
23 | DEFINE_PROPERTY(std::vector<int>, shape); |
24 | DEFINE_PROPERTY(uint64_t, num_elements); |
25 | DEFINE_PROPERTY(FieldSource, field_source); |
26 | DEFINE_PROPERTY(taichi::lang::DataType, dtype); |
27 | DEFINE_PROPERTY(taichi::lang::DeviceAllocation, dev_alloc); |
28 | |
29 | FieldInfo() { |
30 | valid = false; |
31 | } |
32 | }; |
33 | |
34 | taichi::lang::DevicePtr get_device_ptr(taichi::lang::Program *program, |
35 | taichi::lang::SNode *snode); |
36 | |
37 | } // namespace ui |
38 | |
39 | } // namespace taichi |
40 | |