Lunderberg commented on PR #16687: URL: https://github.com/apache/tvm/pull/16687#issuecomment-1999709105
Good points regarding default values. I think I would describe the current state a bit differently, as currently we do not require function purity to be explicitly annotated. At the [C++ level](https://github.com/apache/tvm/blob/main/include/tvm/relax/expr.h#L985), the [Python API](https://github.com/apache/tvm/blob/main/python/tvm/relax/expr.py#L885), the [Relax block builder](https://github.com/apache/tvm/blob/main/python/tvm/relax/block_builder.py#L643), and [in TVMScript](https://github.com/apache/tvm/blob/main/python/tvm/script/parser/relax/parser.py#L184), we provide default arguments stating that a function is pure. This can be overridden in most cases, but in some places such as the relax block builder, there isn't a way to override this default. So, rather than viewing this PR as changing from explicit purity annotations to implicit purity inference, I'd argue that it is only changing the method of purity inference. On `main`, the purity inference always returns true, where this PR improves the purity inference by checking the immediate body of the function. -- 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: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
