tvm
tirx_stmt.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  */
23 #ifndef TVM_TIRX_TIRX_STMT_H_
24 #define TVM_TIRX_TIRX_STMT_H_
25 
26 #include <tvm/ir/op.h>
27 #include <tvm/tirx/stmt.h>
28 
29 namespace tvm {
30 namespace tirx {
31 
36  public:
37  // tvm::Op which corresponds to the TIRX operator.
39 
40  // Arguments to the operator.
41  ffi::Array<ffi::Any> args;
42 
43  // Workspace (pre-allocated buffers) for the operator.
44  ffi::Map<ffi::String, Buffer> workspace;
45 
46  // Config for the operator/scheduler.
47  ffi::Map<ffi::String, ffi::Any> config;
48 
49  // Optional dispatch variant name registered via @register_dispatch.
50  ffi::Optional<ffi::String> dispatch{std::nullopt};
51 
52  static void RegisterReflection() {
53  namespace refl = tvm::ffi::reflection;
54  refl::ObjectDef<TilePrimitiveCallNode>()
55  .def_ro("op", &TilePrimitiveCallNode::op)
56  .def_ro("args", &TilePrimitiveCallNode::args)
57  .def_ro("workspace", &TilePrimitiveCallNode::workspace)
58  .def_ro("config", &TilePrimitiveCallNode::config)
59  .def_ro("dispatch", &TilePrimitiveCallNode::dispatch);
60  }
61 
63 };
64 
69 class TilePrimitiveCall : public Stmt {
70  public:
71  TVM_DLL TilePrimitiveCall(tvm::Op op, ffi::Array<ffi::Any> args,
72  ffi::Map<ffi::String, Buffer> workspace = {},
73  ffi::Map<ffi::String, ffi::Any> config = {},
74  ffi::Optional<ffi::String> dispatch = std::nullopt);
75 
76  static bool IsValidOpCallArgType(const ffi::Any& arg);
77 
80 };
81 
82 } // namespace tirx
83 } // namespace tvm
84 
85 #endif // TVM_TIRX_TIRX_STMT_H_
Managed reference class to OpNode.
Definition: op.h:131
Base node of all statements.
Definition: stmt.h:42
Container of all statements.
Definition: stmt.h:67
TIRX TilePrimitiveCall stmt.
Definition: tirx_stmt.h:35
ffi::Optional< ffi::String > dispatch
Definition: tirx_stmt.h:50
TVM_FFI_DECLARE_OBJECT_INFO_FINAL("tirx.TilePrimitiveCall", TilePrimitiveCallNode, StmtNode)
ffi::Map< ffi::String, Buffer > workspace
Definition: tirx_stmt.h:44
ffi::Array< ffi::Any > args
Definition: tirx_stmt.h:41
tvm::Op op
Definition: tirx_stmt.h:38
static void RegisterReflection()
Definition: tirx_stmt.h:52
ffi::Map< ffi::String, ffi::Any > config
Definition: tirx_stmt.h:47
Managed reference to TilePrimitiveCallNode.
Definition: tirx_stmt.h:69
TVM_DEFINE_OBJECT_REF_COW_METHOD(TilePrimitiveCallNode)
TilePrimitiveCall(tvm::Op op, ffi::Array< ffi::Any > args, ffi::Map< ffi::String, Buffer > workspace={}, ffi::Map< ffi::String, ffi::Any > config={}, ffi::Optional< ffi::String > dispatch=std::nullopt)
static bool IsValidOpCallArgType(const ffi::Any &arg)
TVM_FFI_DEFINE_OBJECT_REF_METHODS_NULLABLE(TilePrimitiveCall, Stmt, TilePrimitiveCallNode)
Primitive operators(builtin intrinsics) and registry for them.
An object that builds and maintains block scope and StmtSref mapping for Dependence analysis.
Definition: analyzer.h:37
TIR statements.