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 | |
20 | /*! |
21 | * \file narrow_predicate_expression.h |
22 | * \brief Utility for extracting and interacting with buffer touch points |
23 | */ |
24 | |
25 | #include <tvm/ir/expr.h> |
26 | #include <tvm/tir/var.h> |
27 | |
28 | #ifndef TVM_ARITH_NARROW_PREDICATE_EXPRESSION_H_ |
29 | #define TVM_ARITH_NARROW_PREDICATE_EXPRESSION_H_ |
30 | |
31 | namespace tvm { |
32 | namespace arith { |
33 | |
34 | /* \brief Narrow a true expression to remove free parameters |
35 | * |
36 | * This function provides two guarantees: |
37 | * |
38 | * 1. If the resulting expression evaluates to True, then the original |
39 | * expression also evaluates to True. |
40 | * |
41 | * 2. The resulting expression does not contain any of the free |
42 | * parameters. |
43 | * |
44 | * 3. The resulting expression does not contain any BufferLoad |
45 | * |
46 | * \param expr The expression to be examined. |
47 | * |
48 | * \param ranges The variables to be removed from the expression |
49 | * |
50 | * \returns An expression that, if true, implies that the original |
51 | * expression is also true. |
52 | */ |
53 | PrimExpr NarrowPredicateExpression(PrimExpr expr, Map<tir::Var, Range> free_parameters); |
54 | |
55 | } // namespace arith |
56 | } // namespace tvm |
57 | #endif // TVM_ARITH_NARROW_PREDICATE_EXPRESSION_H_ |
58 | |