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/base.h>
28#include <tvm/tirx/function.h>
29
30namespace tvm {
31namespace s_tir {
32
36class TensorIntrinObj : public ffi::Object {
37 public:
38 explicit TensorIntrinObj(ffi::UnsafeInit tag) : desc(tag), impl(tag) {}
39
42
47
48 static void RegisterReflection() {
49 namespace refl = tvm::ffi::reflection;
50 refl::ObjectDef<TensorIntrinObj>()
51 .def_ro("desc", &TensorIntrinObj::desc)
52 .def_ro("impl", &TensorIntrinObj::impl);
53 }
54 TVM_FFI_DECLARE_OBJECT_INFO_FINAL("s_tir.TensorIntrin", TensorIntrinObj, ffi::Object);
55};
56
60class TensorIntrin : public ffi::ObjectRef {
61 public:
67 TVM_DLL explicit TensorIntrin(tirx::Function desc, tirx::Function impl);
68
78 TVM_DLL static void Register(ffi::String name, TensorIntrin intrin, bool override = false);
79
89 TVM_DLL static ffi::Optional<TensorIntrin> Get(ffi::String name, bool allow_missing = false);
90
92};
93
94} // namespace s_tir
95} // namespace tvm
96#endif // TVM_S_TIR_TENSOR_INTRIN_H_
TIR Function.
Tensor intrinsics for tensorization.
Definition tensor_intrin.h:36
tirx::Function desc
The function to describe the computation.
Definition tensor_intrin.h:44
TensorIntrinObj(ffi::UnsafeInit tag)
Definition tensor_intrin.h:38
tirx::Function impl
The function of the implementation for the execution.
Definition tensor_intrin.h:46
TensorIntrinObj(tirx::Function desc, tirx::Function impl)
Definition tensor_intrin.h:40
static void RegisterReflection()
Definition tensor_intrin.h:48
TVM_FFI_DECLARE_OBJECT_INFO_FINAL("s_tir.TensorIntrin", TensorIntrinObj, ffi::Object)
Managed reference to TensorIntrinObj.
Definition tensor_intrin.h:60
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, TensorIntrinObj)
Managed reference to FunctionObj.
Definition function.h:107
Parent compiler symbol visibility.
An object that builds and maintains block scope and StmtSref mapping for Dependence analysis.
Definition analysis.h:41