tvm
Loading...
Searching...
No Matches
op.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
24#ifndef TVM_RELAX_ATTRS_OP_H_
25#define TVM_RELAX_ATTRS_OP_H_
26
27#include <tvm/ir/global_info.h>
28#include <tvm/relax/expr.h>
29
30namespace tvm {
31namespace relax {
32
35 ffi::String te_grad_name;
36 ffi::Map<ffi::String, Any> te_grad_kwargs;
37
38 static void RegisterReflection() {
39 namespace refl = tvm::ffi::reflection;
40 refl::ObjectDef<CallTIRWithGradAttrs>()
41 .def_ro(
43 "The name of the te gradient function associated with this call_tir_with_grad node.")
44 .def_ro("te_grad_kwargs", &CallTIRWithGradAttrs::te_grad_kwargs,
45 "The keyword arguments passed to the te gradient function.");
46 }
47 TVM_FFI_DECLARE_OBJECT_INFO_FINAL("relax.attrs.CallTIRWithGradAttrs", CallTIRWithGradAttrs,
48 AttrsNode);
49}; // struct CallTIRAttrs
50
60 ffi::Array<int64_t> inplace_indices;
61
62 static void RegisterReflection() {
63 namespace refl = tvm::ffi::reflection;
64 refl::ObjectDef<CallTIRInplaceAttrs>().def_ro("inplace_indices",
66 }
67 TVM_FFI_DECLARE_OBJECT_INFO_FINAL("relax.attrs.CallTIRInplaceAttrs", CallTIRInplaceAttrs,
68 AttrsNode);
69}; // struct CallTIRInplaceAttrs
70
80 ffi::Array<int64_t> inplace_indices;
81
82 static void RegisterReflection() {
83 namespace refl = tvm::ffi::reflection;
84 refl::ObjectDef<CallInplacePackedAttrs>().def_ro("inplace_indices",
86 }
87 TVM_FFI_DECLARE_OBJECT_INFO_FINAL("relax.attrs.CallInplacePackedAttrs", CallInplacePackedAttrs,
88 AttrsNode);
89}; // struct CallInplacePackedAttrs
90
92struct ToVDeviceAttrs : public AttrsNode {
94
95 static void RegisterReflection() {
96 namespace refl = tvm::ffi::reflection;
97 refl::ObjectDef<ToVDeviceAttrs>().def_ro("dst_vdevice", &ToVDeviceAttrs::dst_vdevice,
98 "The destination device where the data is copied to.");
99 }
101}; // struct ToVDeviceAttrs
102
108
109 static void RegisterReflection() {
110 namespace refl = tvm::ffi::reflection;
111 refl::ObjectDef<HintOnDeviceAttrs>()
112 .def_ro("device_type", &HintOnDeviceAttrs::device_type,
113 "The device type where the data is supposed to be executed.")
114 .def_ro("index", &HintOnDeviceAttrs::index, "The device id.")
115 .def_ro("memory_scope", &HintOnDeviceAttrs::memory_scope, "The device memory scope.");
116 }
118}; // struct HintOnDeviceAttrs
119
120} // namespace relax
121} // namespace tvm
122
123#endif // TVM_RELAX_ATTRS_OP_H_
Base class of all attribute class.
Definition attrs.h:49
Managed reference to VDeviceNode.
Definition global_info.h:87
RAII wrapper function to enter and exit a context object similar to python's with syntax.
Definition with_context.h:59
GlobalInfo are globally static object that are referred by the IR itself.
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
Attributes used in call_inplace_packed.
Definition op.h:72
ffi::Array< int64_t > inplace_indices
Indices that describe which input corresponds to which output.
Definition op.h:80
static void RegisterReflection()
Definition op.h:82
TVM_FFI_DECLARE_OBJECT_INFO_FINAL("relax.attrs.CallInplacePackedAttrs", CallInplacePackedAttrs, AttrsNode)
Attributes used in call_tir_inplace.
Definition op.h:52
TVM_FFI_DECLARE_OBJECT_INFO_FINAL("relax.attrs.CallTIRInplaceAttrs", CallTIRInplaceAttrs, AttrsNode)
static void RegisterReflection()
Definition op.h:62
ffi::Array< int64_t > inplace_indices
Indices that describe which input corresponds to which output.
Definition op.h:60
Attributes used in call_tir_with_grad.
Definition op.h:34
TVM_FFI_DECLARE_OBJECT_INFO_FINAL("relax.attrs.CallTIRWithGradAttrs", CallTIRWithGradAttrs, AttrsNode)
ffi::String te_grad_name
Definition op.h:35
static void RegisterReflection()
Definition op.h:38
ffi::Map< ffi::String, Any > te_grad_kwargs
Definition op.h:36
Attributes used in hint_on_device.
Definition op.h:104
TVM_FFI_DECLARE_OBJECT_INFO_FINAL("relax.attrs.HintOnDeviceAttrs", HintOnDeviceAttrs, AttrsNode)
int32_t device_type
Definition op.h:105
MemoryScope memory_scope
Definition op.h:107
static void RegisterReflection()
Definition op.h:109
int32_t index
Definition op.h:106
Attributes used in to_vdevice.
Definition op.h:92
static void RegisterReflection()
Definition op.h:95
VDevice dst_vdevice
Definition op.h:93
TVM_FFI_DECLARE_OBJECT_INFO_FINAL("relax.attrs.ToVDeviceAttrs", ToVDeviceAttrs, AttrsNode)