tvm
Loading...
Searching...
No Matches
buffer_region.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#ifndef TVM_TIRX_BUFFER_REGION_H_
20#define TVM_TIRX_BUFFER_REGION_H_
21
22#include <tvm/ffi/reflection/registry.h>
23#include <tvm/ir/expr.h>
24#include <tvm/tirx/buffer.h>
25
26namespace tvm {
27namespace tirx {
28
31 public:
32 static void RegisterReflection() {
33 namespace refl = tvm::ffi::reflection;
34 refl::ObjectDef<BufferRegionTypeNode>();
35 }
36
38};
39
47
49class BufferRegionNode : public ExprNode {
50 public:
52 ffi::Array<Range> region;
53
54 static void RegisterReflection() {
55 namespace refl = tvm::ffi::reflection;
56 refl::ObjectDef<BufferRegionNode>()
57 .def_ro("buffer", &BufferRegionNode::buffer, refl::AttachFieldFlag::SEqHashDefRecursive())
58 .def_ro("region", &BufferRegionNode::region);
59 }
60
63};
64
66class BufferRegion : public Expr {
67 public:
68 TVM_DLL explicit BufferRegion(BufferVar buffer, ffi::Array<Range> region, Span span = Span());
69
71 TVM_DLL static BufferRegion FromPoint(BufferVar buffer, ffi::Array<PrimExpr> indices);
72
75};
76
77} // namespace tirx
78} // namespace tvm
79
80#endif // TVM_TIRX_BUFFER_REGION_H_
Symbolic n-dimensional array, to represent a memory buffer.
Base type of all the expressions.
Definition base_expr.h:300
Managed reference to ExprNode.
Definition base_expr.h:335
Definition source_map.h:111
Type is the base type of all types.
Definition base_expr.h:52
Managed reference to TypeNode.
Definition base_expr.h:77
RAII wrapper function to enter and exit a context object similar to python's with syntax.
Definition with_context.h:59
Representing a region of multi-dimensional buffer access.
Definition buffer_region.h:49
ffi::Array< Range > region
Definition buffer_region.h:52
TVM_FFI_DECLARE_OBJECT_INFO_FINAL("tirx.BufferRegion", BufferRegionNode, ExprNode)
static void RegisterReflection()
Definition buffer_region.h:54
static constexpr TVMFFISEqHashKind _type_s_eq_hash_kind
Definition buffer_region.h:61
BufferVar buffer
Definition buffer_region.h:51
The type of a multi-dimensional buffer region expression.
Definition buffer_region.h:30
TVM_FFI_DECLARE_OBJECT_INFO_FINAL("tirx.BufferRegionType", BufferRegionTypeNode, TypeNode)
static void RegisterReflection()
Definition buffer_region.h:32
Managed reference to BufferRegionTypeNode.
Definition buffer_region.h:41
TVM_FFI_DEFINE_OBJECT_REF_METHODS_NOTNULLABLE(BufferRegionType, Type, BufferRegionTypeNode)
Managed reference to BufferRegionNode.
Definition buffer_region.h:66
static BufferRegion FullRegion(BufferVar buffer)
TVM_FFI_DEFINE_OBJECT_REF_METHODS_NULLABLE(BufferRegion, Expr, BufferRegionNode)
static BufferRegion FromPoint(BufferVar buffer, ffi::Array< PrimExpr > indices)
BufferRegion(BufferVar buffer, ffi::Array< Range > region, Span span=Span())
TVM_DEFINE_OBJECT_REF_COW_METHOD(BufferRegionNode)
Checked zero-state view over an ordinary VarNode with BufferType.
Definition buffer.h:179
Base expr nodes in TVM.
An object that builds and maintains block scope and StmtSref mapping for Dependence analysis.
Definition analyzer.h:40