junrushao1994 commented on code in PR #11532:
URL: https://github.com/apache/tvm/pull/11532#discussion_r887406995
##########
tests/python/unittest/test_tir_transform_flatten_buffer.py:
##########
@@ -268,6 +268,33 @@ def annotated_loops(a: T.handle) -> None:
A[i] = 0.0
[email protected]_func
+def boolean_handling_before(a: T.Buffer[10, "bool"], b: T.Buffer[10, "bool"])
-> None:
+ for i0 in T.serial(10):
+ with T.block("b"):
+ T.reads(a[i0])
+ T.writes(b[i0])
+ b[i0] = a[i0]
+
+
[email protected]_func
+def boolean_handling_after(a: T.Buffer[10, "int8"], b: T.Buffer[10, "int8"])
-> None:
+ T.preflattened_buffer(a, [10], dtype="bool", data=a.data)
+ T.preflattened_buffer(b, [10], dtype="bool", data=b.data)
+ # body
+ for i0 in T.serial(10):
+ b[i0] = T.cast(T.cast(a[i0], "bool"), "int8")
+
+
[email protected]_func
+def boolean_handle_after(a: T.Buffer[10, "int8"], b: T.Buffer[10, "int8"]) ->
None:
+ T.preflattened_buffer(a, [10], dtype="bool", data=a.data)
+ T.preflattened_buffer(b, [10], dtype="bool", data=b.data)
+ # body
+ for i0 in T.serial(10):
+ b[i0] = T.cast(T.cast(a[i0], "bool"), "int8")
Review Comment:
@Lunderberg The casting here is a bit duplicated. Do you think we should
simplify it with some ad-hoc logic? Perhaps should leave for future
optimization if later we found it a bottleneck?
--
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]