tvm
Loading...
Searching...
No Matches
global_info.h
Go to the documentation of this file.
1/*
2 * Licensed to the Apache Software Foundation (ASF) under one
3 * or more contributor license agreements. See the NOTICE file
4 * distributed with this work for additional information
5 * regarding copyright ownership. The ASF licenses this file
6 * to you under the Apache License, Version 2.0 (the
7 * "License"); you may not use this file except in compliance
8 * with the License. You may obtain a copy of the License at
9 *
10 * http://www.apache.org/licenses/LICENSE-2.0
11 *
12 * Unless required by applicable law or agreed to in writing,
13 * software distributed under the License is distributed on an
14 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15 * KIND, either express or implied. See the License for the
16 * specific language governing permissions and limitations
17 * under the License.
18 */
19
25#ifndef TVM_IR_GLOBAL_INFO_H_
26#define TVM_IR_GLOBAL_INFO_H_
27
28#include <tvm/ffi/reflection/registry.h>
29#include <tvm/ir/expr.h>
30#include <tvm/target/target.h>
31
32namespace tvm {
33
37using MemoryScope = ffi::String;
38
43class GlobalInfoNode : public ffi::Object {
44 public:
46
47 TVM_FFI_DECLARE_OBJECT_INFO("ir.GlobalInfo", GlobalInfoNode, ffi::Object);
48};
49
54class GlobalInfo : public ffi::ObjectRef {
55 public:
57};
58
63 public:
71
72 static void RegisterReflection() {
73 namespace refl = tvm::ffi::reflection;
74 refl::ObjectDef<VDeviceNode>()
75 .def_ro("target", &VDeviceNode::target)
76 .def_ro("vdevice_id", &VDeviceNode::vdevice_id)
77 .def_ro("memory_scope", &VDeviceNode::memory_scope);
78 }
79
81};
82
92
97 public:
98 static void RegisterReflection() {
99 namespace refl = tvm::ffi::reflection;
100 refl::ObjectDef<DummyGlobalInfoNode>();
101 }
102
104};
105
114
115} // namespace tvm
116
117#endif // TVM_IR_GLOBAL_INFO_H_
A dummy global info sub-class for testing purpose.
Definition global_info.h:96
static void RegisterReflection()
Definition global_info.h:98
TVM_FFI_DECLARE_OBJECT_INFO_FINAL("ir.DummyGlobalInfo", DummyGlobalInfoNode, GlobalInfoNode)
Managed reference to DummyGlobalInfoNode.
Definition global_info.h:110
TVM_FFI_DEFINE_OBJECT_REF_METHODS_NULLABLE(DummyGlobalInfo, GlobalInfo, DummyGlobalInfoNode)
GlobalInfo are globally static object that are referred by the IR itself. Base node for all global in...
Definition global_info.h:43
TVM_FFI_DECLARE_OBJECT_INFO("ir.GlobalInfo", GlobalInfoNode, ffi::Object)
static constexpr TVMFFISEqHashKind _type_s_eq_hash_kind
Definition global_info.h:45
Managed reference to GlobalInfoNode.
Definition global_info.h:54
TVM_FFI_DEFINE_OBJECT_REF_METHODS_NULLABLE(GlobalInfo, ffi::ObjectRef, GlobalInfoNode)
Managed reference class to TargetNode.
Definition target.h:134
A global info subclass for virtual devices.
Definition global_info.h:62
Target target
The Target describing how to compile for the virtual device.
Definition global_info.h:65
int vdevice_id
The device identifier for the virtual device. This enables us to differentiate between distinct devic...
Definition global_info.h:69
TVM_FFI_DECLARE_OBJECT_INFO_FINAL("ir.VDevice", VDeviceNode, GlobalInfoNode)
static void RegisterReflection()
Definition global_info.h:72
MemoryScope memory_scope
Definition global_info.h:70
Managed reference to VDeviceNode.
Definition global_info.h:87
VDevice(Target tgt, int dev_id, MemoryScope mem_scope)
TVM_FFI_DEFINE_OBJECT_REF_METHODS_NULLABLE(VDevice, GlobalInfo, VDeviceNode)
RAII wrapper function to enter and exit a context object similar to python's with syntax.
Definition with_context.h:59
Base expr nodes in TVM.
An object that builds and maintains block scope and StmtSref mapping for Dependence analysis.
Definition analyzer.h:40
ffi::String MemoryScope
Abstract label for an area of memory.
Definition global_info.h:37
Compilation target object.