tvm
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
tensor_intrin.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_TE_TENSOR_INTRIN_H_
25 #define TVM_TE_TENSOR_INTRIN_H_
26 
27 #include <tvm/te/tensor.h>
28 #include <tvm/tir/buffer.h>
29 
30 #include <string>
31 
32 namespace tvm {
33 namespace te {
34 
36 class TensorIntrinNode : public Object {
37  public:
39  std::string name;
73 
75  v->Visit("name", &name);
76  v->Visit("op", &op);
77  v->Visit("inputs", &inputs);
78  v->Visit("buffers", &buffers);
79  v->Visit("scalar_params", &scalar_params);
80  v->Visit("body", &body);
81  v->Visit("reduce_init", &reduce_init);
82  v->Visit("reduce_update", &reduce_update);
83  }
84 
85  static constexpr const char* _type_key = "TensorIntrin";
87 };
88 
93 class TensorIntrin : public ObjectRef {
94  public:
97 
99 };
100 
101 class TensorIntrinCallNode : public Object {
102  public:
109 
115 
118 
120  v->Visit("intrin", &intrin);
121  v->Visit("tensors", &tensors);
122  v->Visit("regions", &regions);
123  v->Visit("reduce_axis", &reduce_axis);
124  v->Visit("scalar_inputs", &scalar_inputs);
125  }
126 
127  static constexpr const char* _type_key = "TensorIntrinCall";
129 };
130 
135 class TensorIntrinCall : public ObjectRef {
136  public:
137  TVM_DLL TensorIntrinCall(TensorIntrin intrin, Array<Tensor> tensors, Array<Region> regions,
139 
141 };
142 
143 } // namespace te
144 } // namespace tvm
145 #endif // TVM_TE_TENSOR_INTRIN_H_
Array< Region > regions
regions of input tensors
Definition: tensor_intrin.h:108
Operation op
The operation this intrinsics is carrying out.
Definition: tensor_intrin.h:41
Node to represent a Tensor intrinsic operator.
Definition: tensor_intrin.h:36
void VisitAttrs(AttrVisitor *v)
Definition: tensor_intrin.h:74
TensorIntrinNode()
constructor
Definition: tensor_intrin.h:72
Array< IterVar > reduce_axis
IterVar on each reduction axis, if the intrin will use the reduce axis.
Definition: tensor_intrin.h:114
runtime implementation for LibTorch/TorchScript.
Definition: analyzer.h:36
Operation that produces tensors.
Definition: tensor.h:47
Array< Var > scalar_params
List of scalar variables, used in body. These placeholders will be bound to expressions passed in whe...
Definition: tensor_intrin.h:58
Stmt body
The normal statement to execute the intrinsic.
Definition: tensor_intrin.h:60
base class of all object containers.
Definition: object.h:167
Stmt reduce_init
Special statement for reduction op, can be None reset the value of output buffer to identity value...
Definition: tensor_intrin.h:65
Definition: tensor_intrin.h:101
Visitor class to get the attributes of an AST/IR node. The content is going to be called for each fie...
Definition: reflection.h:52
Dataflow tensor object.
Managed reference to TensorIntrinCallNode.
Definition: tensor_intrin.h:135
TVM_DECLARE_FINAL_OBJECT_INFO(TensorIntrinNode, Object)
Managed reference to TensorIntrinNode.
Definition: tensor_intrin.h:93
void VisitAttrs(AttrVisitor *v)
Definition: tensor_intrin.h:119
Array, container representing a contiguous sequence of ObjectRefs.
Definition: array.h:289
Stmt reduce_update
Special statement for reduction op, can be None Reduce: do a reduction of current output buffer with ...
Definition: tensor_intrin.h:70
Array< Buffer > buffers
Symbolic buffers of each output/input tensor buffers[0:len(inputs)] are buffers of the inputs...
Definition: tensor_intrin.h:53
Container of all statements.
Definition: stmt.h:59
#define TVM_DEFINE_OBJECT_REF_METHODS(TypeName, ParentType, ObjectName)
Definition: object.h:713
IterVar reduce_axis(Range dom, std::string name="rv")
Create a new IterVar for reduction operations.
Base class of all object reference.
Definition: object.h:511
std::string name
The name of the intrinsic.
Definition: tensor_intrin.h:39
Symbolic n-dimensional array, to represent a memory buffer.
Array< PrimExpr > scalar_inputs
scalar expression inputs
Definition: tensor_intrin.h:117
Array< Tensor > inputs
List of inputs of operator, placeholder in postdfs order.
Definition: tensor_intrin.h:43
TensorIntrin intrin
the tensor intrinsic
Definition: tensor_intrin.h:104
static constexpr const char * _type_key
Definition: tensor_intrin.h:85
Array< Tensor > tensors
input tensors of the intrinsic
Definition: tensor_intrin.h:106