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 unwrap_vector_expr.h |
22 | * |
23 | * \brief Centralized location for extraction of constraints from a boolean expression. |
24 | */ |
25 | |
26 | #ifndef TVM_ARITH_UNWRAP_VECTOR_EXPR_H_ |
27 | #define TVM_ARITH_UNWRAP_VECTOR_EXPR_H_ |
28 | |
29 | #include <tvm/tir/expr.h> |
30 | |
31 | #include <vector> |
32 | |
33 | namespace tvm { |
34 | namespace arith { |
35 | |
36 | /* \brief Unwraps a component of a vector expression |
37 | * |
38 | * Utility to break up a vector expression into a specific component |
39 | * of the expression. |
40 | * |
41 | * Example: `Ramp(start, stride, n)` => `start + stride*lane` |
42 | * Example: `Broadcast(value, n)` => `value` |
43 | * Example: `2*Ramp(start, stride, n) + Broadcast(value,n)` => `2*(start + stride*lane) + value` |
44 | * |
45 | * \param vector_expr The vectorized expression to examine |
46 | * |
47 | * \param lane Which lane of the vectorized expression to extract. |
48 | * |
49 | * \returns A scalar expression |
50 | */ |
51 | PrimExpr UnwrapVectorExpr(const PrimExpr& vector_expr, const PrimExpr& lane); |
52 | |
53 | } // namespace arith |
54 | } // namespace tvm |
55 | |
56 | #endif // TVM_ARITH_UNWRAP_VECTOR_EXPR_H_ |
57 | |