gemini-code-assist[bot] commented on code in PR #19740: URL: https://github.com/apache/tvm/pull/19740#discussion_r3399811729
########## tests/python/s_tir/transform/test_s_tir_transform_lower_thread_all_reduce.py: ########## @@ -23,6 +23,18 @@ from tvm.script import tirx as T +def _has_volatile_alloc_buffer(mod): + has_volatile_alloc = False + + def visit(node): + nonlocal has_volatile_alloc + if isinstance(node, tvm.tirx.AllocBuffer) and "tirx.volatile" in node.annotations: + has_volatile_alloc = has_volatile_alloc or node.annotations["tirx.volatile"] is True Review Comment:  Using `is True` to check the value of a TVM annotation can lead to failures. TVM map lookups typically return TVM object wrappers (such as `tvm.tir.IntImm` or `tvm.runtime.Bool`) rather than Python's built-in `True` singleton, so identity comparison (`is`) will evaluate to `False`. Using `bool(...)` is more robust and correctly evaluates the truthiness of the TVM object. ```suggestion has_volatile_alloc = has_volatile_alloc or bool(node.annotations["tirx.volatile"]) ``` -- 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] --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
