tvm
async_structs.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_TIRX_ASYNC_STRUCTS_H_
25 #define TVM_TIRX_ASYNC_STRUCTS_H_
26 
27 #include <tvm/ffi/object.h>
28 #include <tvm/ir/module.h>
29 #include <tvm/tirx/buffer.h>
30 #include <tvm/tirx/exec_scope.h>
31 
32 namespace tvm {
33 namespace tirx {
34 
35 // Pipeline
36 class PipelineNode : public ffi::Object {
37  public:
41  size_t depth;
45  ffi::String name_hint;
46 
48  ffi::Map<ffi::String, tvm::tirx::Buffer> workspace;
50  ffi::Map<ffi::String, ffi::Any> schedule_config;
51 
52  static void RegisterReflection() {
53  namespace refl = tvm::ffi::reflection;
54  refl::ObjectDef<PipelineNode>()
55  .def_ro("thread_scope", &PipelineNode::thread_scope)
56  .def_ro("name_hint", &PipelineNode::name_hint)
57  .def_ro("depth", &PipelineNode::depth)
58  .def_ro("separate_pc", &PipelineNode::separate_pc)
59  .def_ro("workspace", &PipelineNode::workspace)
60  .def_ro("schedule_config", &PipelineNode::schedule_config);
61  }
62 
63  static constexpr TVMFFISEqHashKind _type_s_eq_hash_kind = kTVMFFISEqHashKindTreeNode;
64  TVM_FFI_DECLARE_OBJECT_INFO("tirx.Pipeline", PipelineNode, ffi::Object);
65 };
66 
67 class Pipeline : public ffi::ObjectRef {
68  public:
69  TVM_DLL explicit Pipeline(ExecScope thread_scope, size_t depth = 0, bool separate_pc = false,
70  ffi::String name_hint = "",
71  ffi::Map<ffi::String, tvm::tirx::Buffer> workspace = {},
72  ffi::Map<ffi::String, ffi::Any> schedule_config = {});
73 
75 };
76 
77 // CopyPipeline
79  public:
80  static void RegisterReflection() {
81  namespace refl = tvm::ffi::reflection;
82  refl::ObjectDef<CopyPipelineNode>();
83  }
84 
85  static constexpr TVMFFISEqHashKind _type_s_eq_hash_kind = kTVMFFISEqHashKindTreeNode;
87 };
88 
89 class CopyPipeline : public Pipeline {
90  public:
91  TVM_DLL explicit CopyPipeline(ExecScope thread_scope, size_t depth = 0, bool separate_pc = false,
92  ffi::String name_hint = "",
93  ffi::Map<ffi::String, tvm::tirx::Buffer> workspace = {},
94  ffi::Map<ffi::String, ffi::Any> schedule_config = {});
95 
98 };
99 
100 } // namespace tirx
101 } // namespace tvm
102 
103 #endif // TVM_TIRX_ASYNC_STRUCTS_H_
Symbolic n-dimensional array, to represent a memory buffer.
Definition: async_structs.h:78
static void RegisterReflection()
Definition: async_structs.h:80
static constexpr TVMFFISEqHashKind _type_s_eq_hash_kind
Definition: async_structs.h:85
TVM_FFI_DECLARE_OBJECT_INFO_FINAL("tirx.CopyPipeline", CopyPipelineNode, PipelineNode)
Definition: async_structs.h:89
TVM_DEFINE_OBJECT_REF_COW_METHOD(CopyPipelineNode)
CopyPipeline(ExecScope thread_scope, size_t depth=0, bool separate_pc=false, ffi::String name_hint="", ffi::Map< ffi::String, tvm::tirx::Buffer > workspace={}, ffi::Map< ffi::String, ffi::Any > schedule_config={})
TVM_FFI_DEFINE_OBJECT_REF_METHODS_NULLABLE(CopyPipeline, Pipeline, CopyPipelineNode)
Definition: exec_scope.h:234
Definition: async_structs.h:36
ffi::Map< ffi::String, ffi::Any > schedule_config
The schedule config of the pipeline.
Definition: async_structs.h:50
static void RegisterReflection()
Definition: async_structs.h:52
TVM_FFI_DECLARE_OBJECT_INFO("tirx.Pipeline", PipelineNode, ffi::Object)
ffi::Map< ffi::String, tvm::tirx::Buffer > workspace
The workspace of the pipeline.
Definition: async_structs.h:48
bool separate_pc
Whether to separate producer and consumer threads.
Definition: async_structs.h:43
ffi::String name_hint
The name hint of the pipeline.
Definition: async_structs.h:45
size_t depth
The pipeline depth.
Definition: async_structs.h:41
ExecScope thread_scope
The thread scope of this pipeline.
Definition: async_structs.h:39
static constexpr TVMFFISEqHashKind _type_s_eq_hash_kind
Definition: async_structs.h:63
Definition: async_structs.h:67
TVM_FFI_DEFINE_OBJECT_REF_METHODS_NULLABLE(Pipeline, ffi::ObjectRef, PipelineNode)
Pipeline(ExecScope thread_scope, size_t depth=0, bool separate_pc=false, ffi::String name_hint="", ffi::Map< ffi::String, tvm::tirx::Buffer > workspace={}, ffi::Map< ffi::String, ffi::Any > schedule_config={})
IRModule that holds the functions and type definitions.
An object that builds and maintains block scope and StmtSref mapping for Dependence analysis.
Definition: analyzer.h:37