tvm
Loading...
Searching...
No Matches
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 */
22#ifndef TVM_TIRX_STMT_H_
23#define TVM_TIRX_STMT_H_
24
25#include <tvm/ir/stmt.h>
26#include <tvm/tirx/expr.h>
28
29namespace tvm {
30namespace tirx {
31
33inline bool IsNoOp(const Stmt& stmt) {
34 if (!stmt.defined()) return true;
35 if (const auto* op = stmt.as<EvaluateObj>()) return op->value.as<IntImmObj>() != nullptr;
36 if (const auto* op = stmt.as<SeqStmtObj>()) return op->seq.empty();
37 return false;
38}
39
41namespace attr {
42constexpr const char* kPragmaUnroll = "tirx.pragma_unroll";
43
44inline constexpr ffi::reflection::AttrKey<bool> kDisableUnroll{"tirx.disable_unroll"};
45
51inline constexpr ffi::reflection::AttrKey<int64_t> kAutoUnrollMaxStep{"tirx.auto_unroll_max_step"};
57inline constexpr ffi::reflection::AttrKey<bool> kUnrollExplicit{"tirx.unroll_explicit"};
59inline constexpr ffi::reflection::AttrKey<bool> kVolatile{"tirx.volatile"};
60
61} // namespace attr
62
63} // namespace tirx
64} // namespace tvm
65#endif // TVM_TIRX_STMT_H_
Statements shared across IR dialects.
TIRx tensor expressions and construction helpers.
Evaluates an expression. This is mostly used for putting a Call node into Stmt.
Definition stmt.h:366
Constant integer literals in the program.
Definition expr.h:314
The container of seq statement. Represent a sequence of statements.
Definition stmt.h:74
Container of all statements.
Definition stmt.h:61
constexpr ffi::reflection::AttrKey< bool > kVolatile
Annotation key on AllocTensor marking the allocation as volatile.
Definition stmt.h:59
constexpr const char * kPragmaUnroll
Definition stmt.h:42
constexpr ffi::reflection::AttrKey< int64_t > kAutoUnrollMaxStep
For annotation: maximum work for automatic unrolling.
Definition stmt.h:51
constexpr ffi::reflection::AttrKey< bool > kDisableUnroll
Definition stmt.h:44
constexpr ffi::reflection::AttrKey< bool > kUnrollExplicit
For annotation: expand unrolled bodies instead of preserving unrolled loops.
Definition stmt.h:57
bool IsNoOp(const Stmt &stmt)
Whether stmt is undefined, an integer Evaluate, or an empty sequence.
Definition stmt.h:33
An object that builds and maintains block scope and StmtSref mapping for Dependence analysis.
Definition analysis.h:41
Enum identities for backend-defined thread hierarchies.