| commit | 3a15eafd14b4f5dcf8539423a7a3f57b52421c33 | [log] [tgz] |
|---|---|---|
| author | Eric Lunderberg <Lunderberg@users.noreply.github.com> | Fri May 26 00:01:00 2023 -0500 |
| committer | GitHub <noreply@github.com> | Fri May 26 14:01:00 2023 +0900 |
| tree | 992dd1f39cdf2b8b77e7ae8360123605715b5e6e | |
| parent | 875217c79bd901890348e1c4fb4b39e5dd76f783 [diff] |
[TVMScript] Prevent bool to int conversion in T.Assert condition (#14941) * [Bugfix] Avoid symbol conflicts in MakePackedAPI/MakeUnpackedAPI PRs https://github.com/apache/tvm/pull/14913 and https://github.com/apache/tvm/pull/14914 made analogous changes to `MakePackedAPI` and `MakeUnpackedAPI` to handle subroutine calls. Both PRs introduced the same symbol, `tvm::tir::SubroutineCallRewriter`, a local utility to update internal calls to a modified function. While each PR passed CI individually, and was therefore able to merge, having both changes caused a duplicate symbol. This commit updates `MakePackedAPI` and `MakeUnpackedAPI` to place their local utilities into anonymous namespaces, avoiding the conflict. * [TVMScript] Prevent bool to int conversion in T.Assert condition Previously, while literal `True` and `False` values were converted to `tvm::Bool` instances, constant-foldable expressions (e.g. `0 == 1`) would be evaluated to `True`, but were then passed directly to the FFI. Because the FFI uses the same representation for integer and boolean values, the conversion to `PrimExpr` resulted in a `tvm::Integer` instead of `tvm::Bool`. This commit converts the argument of `T.Assert` to a `tvm::Bool` before calling the FFI, avoiding the ambiguity. In addition, the `AssertStmt` constructor now validates the datatype of the condition, to prevent it from re-occurring. This was first caught in the unit test `test_debug_info.py::test_llvm_ir_debug_info`, which failed on some versions of LLVM due to the use of `i32` as the condition of an assert. * Updated TVMScript printer unit test with boolean condition
Documentation | Contributors | Community | Release Notes
Apache TVM is a compiler stack for deep learning systems. It is designed to close the gap between the productivity-focused deep learning frameworks, and the performance- and efficiency-focused hardware backends. TVM works with deep learning frameworks to provide end to end compilation to different backends.
TVM is licensed under the Apache-2.0 license.
Check out the TVM Documentation site for installation instructions, tutorials, examples, and more. The Getting Started with TVM tutorial is a great place to start.
TVM adopts apache committer model, we aim to create an open source project that is maintained and owned by the community. Check out the Contributor Guide.
We learned a lot from the following projects when building TVM.