tvm
Loading...
Searching...
No Matches
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_S_TIR_TENSOR_INTRIN_H_
25#define TVM_S_TIR_TENSOR_INTRIN_H_
26
27#include <tvm/tirx/function.h>
28
29namespace tvm {
30namespace s_tir {
31
35class TensorIntrinNode : public ffi::Object {
36 public:
37 explicit TensorIntrinNode(ffi::UnsafeInit tag) : desc(tag), impl(tag) {}
38
41
46
47 static void RegisterReflection() {
48 namespace refl = tvm::ffi::reflection;
49 refl::ObjectDef<TensorIntrinNode>()
50 .def_ro("desc", &TensorIntrinNode::desc)
51 .def_ro("impl", &TensorIntrinNode::impl);
52 }
53 TVM_FFI_DECLARE_OBJECT_INFO_FINAL("s_tir.TensorIntrin", TensorIntrinNode, ffi::Object);
54};
55
59class TensorIntrin : public ffi::ObjectRef {
60 public:
66 TVM_DLL explicit TensorIntrin(tirx::Function desc, tirx::Function impl);
67
77 TVM_DLL static void Register(ffi::String name, TensorIntrin intrin, bool override = false);
78
88 TVM_DLL static ffi::Optional<TensorIntrin> Get(ffi::String name, bool allow_missing = false);
89
91};
92
93} // namespace s_tir
94} // namespace tvm
95#endif // TVM_S_TIR_TENSOR_INTRIN_H_
Tensor intrinsics for tensorization.
Definition tensor_intrin.h:35
static void RegisterReflection()
Definition tensor_intrin.h:47
TVM_FFI_DECLARE_OBJECT_INFO_FINAL("s_tir.TensorIntrin", TensorIntrinNode, ffi::Object)
TensorIntrinNode(tirx::Function desc, tirx::Function impl)
Definition tensor_intrin.h:39
tirx::Function desc
The function to describe the computation.
Definition tensor_intrin.h:43
TensorIntrinNode(ffi::UnsafeInit tag)
Definition tensor_intrin.h:37
tirx::Function impl
The function of the implementation for the execution.
Definition tensor_intrin.h:45
Managed reference to TensorIntrinNode.
Definition tensor_intrin.h:59
static void Register(ffi::String name, TensorIntrin intrin, bool override=false)
Create and register a TensorIntrin. After registration, the TensorIntrin can be looked up with its na...
static ffi::Optional< TensorIntrin > Get(ffi::String name, bool allow_missing=false)
Look up TensorIntrin by name. Raises an exception if not found.
TensorIntrin(tirx::Function desc, tirx::Function impl)
Constructor.
TVM_FFI_DEFINE_OBJECT_REF_METHODS_NOTNULLABLE(TensorIntrin, ffi::ObjectRef, TensorIntrinNode)
Managed reference to FunctionNode.
Definition function.h:105
An object that builds and maintains block scope and StmtSref mapping for Dependence analysis.
Definition attr.h:23
TIR Function.