You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tvm.apache.org by GitBox <gi...@apache.org> on 2022/06/01 17:17:21 UTC

[GitHub] [tvm] Lunderberg opened a new pull request, #11524: [TIR][Arith] Additional Simplifications Inside Conditionals

Lunderberg opened a new pull request, #11524:
URL: https://github.com/apache/tvm/pull/11524

   This adds additional simplifications to `RewriteSimplifier` while inside a conditional statement.  These are simplifications that are expected to be necessary for simplifying conditionals for padding buffer transforms.  The main additions are below:
   
   * Use of `RewriteSimplifier::literal_constraints_` for simplifications of boolean expressions.  Previously, this was only used for simplifications inside a `tir.likely` annotation.
   * Use of `RewriteSimplifier::literal_constraints_` to identify known false constraints.  This allows a constraint of `i!=n` to simplify `i==n` to false.
   * Use of `EqNode` constraints in `ConstIntBoundAnalyzer`.  Previously, inequalities were used as comparisons.  With this change an `i==5` constraint be used to reduce the bounds of `i` to `[5,5]`.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@tvm.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [tvm] vinx13 commented on a diff in pull request #11524: [TIR][Arith] Additional Simplifications Inside Conditionals

Posted by GitBox <gi...@apache.org>.
vinx13 commented on code in PR #11524:
URL: https://github.com/apache/tvm/pull/11524#discussion_r887386219


##########
src/arith/constraint_extract.h:
##########
@@ -0,0 +1,58 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+/*!
+ * \file contraint_extract.h
+ *
+ * \brief Centralized location for extraction of constraints from a boolean expression.
+ */
+
+#ifndef TVM_ARITH_CONSTRAINT_EXTRACT_H_
+#define TVM_ARITH_CONSTRAINT_EXTRACT_H_
+
+#include <tvm/tir/expr.h>
+
+#include <vector>
+
+namespace tvm {
+namespace arith {
+
+/* \brief Returns constraints that are true if the expression is true.
+ *
+ * Utility to break up a boolean expression into independent
+ * constraints.
+ *
+ * Example: `i==5 && j==3` => `[i==5 && j==3, * i==5, j==3]`

Review Comment:
   what does `* i == 5` mean? is '*' a typo?



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@tvm.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [tvm] Lunderberg commented on a diff in pull request #11524: [TIR][Arith] Additional Simplifications Inside Conditionals

Posted by GitBox <gi...@apache.org>.
Lunderberg commented on code in PR #11524:
URL: https://github.com/apache/tvm/pull/11524#discussion_r887442644


##########
src/arith/constraint_extract.h:
##########
@@ -0,0 +1,58 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+/*!
+ * \file contraint_extract.h
+ *
+ * \brief Centralized location for extraction of constraints from a boolean expression.
+ */
+
+#ifndef TVM_ARITH_CONSTRAINT_EXTRACT_H_
+#define TVM_ARITH_CONSTRAINT_EXTRACT_H_
+
+#include <tvm/tir/expr.h>
+
+#include <vector>
+
+namespace tvm {
+namespace arith {
+
+/* \brief Returns constraints that are true if the expression is true.
+ *
+ * Utility to break up a boolean expression into independent
+ * constraints.
+ *
+ * Example: `i==5 && j==3` => `[i==5 && j==3, * i==5, j==3]`

Review Comment:
   Thank you for the catch and yes, the `*` was a typo.  Updated to remove.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@tvm.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [tvm] tqchen commented on pull request #11524: [TIR][Arith] Additional Simplifications Inside Conditionals

Posted by GitBox <gi...@apache.org>.
tqchen commented on PR #11524:
URL: https://github.com/apache/tvm/pull/11524#issuecomment-1144028304

   related  https://github.com/apache/tvm/blob/main/include/tvm/arith/analyzer.h#L317
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@tvm.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [tvm] vinx13 merged pull request #11524: [TIR][Arith] Additional Simplifications Inside Conditionals

Posted by GitBox <gi...@apache.org>.
vinx13 merged PR #11524:
URL: https://github.com/apache/tvm/pull/11524


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@tvm.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org