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/11/18 15:10:17 UTC
[GitHub] [tvm] Lunderberg commented on a diff in pull request #13429: [TIR][Schedule] Add condition to check buffer type
Lunderberg commented on code in PR #13429:
URL: https://github.com/apache/tvm/pull/13429#discussion_r1026552127
##########
python/tvm/tir/schedule/schedule.py:
##########
@@ -2751,10 +2751,14 @@ def two_elementwise_transformed_intermediate_buffer(a: T.handle, c: T.handle) ->
# buffer's type. If the default `tvm.runtime.convert`
# behavior is applied, these would be converted to
# int32/float32, which may not match the buffer's type.
- if isinstance(pad_value, int):
+ if "int" in buffer_obj.dtype and isinstance(pad_value, int):
pad_value = IntImm(buffer_obj.dtype, pad_value)
- elif isinstance(pad_value, float):
+ elif "float" in buffer_obj.dtype and isinstance(pad_value, float):
pad_value = FloatImm(buffer_obj.dtype, pad_value)
+ else:
Review Comment:
I like the change overall, to avoid constructing an `IntImm` for type `float64`, but this `else` case should be removed. There's an existing check on the C++ side [here](https://github.com/apache/tvm/blob/main/src/tir/schedule/primitive/layout_transformation.cc#L1073), which validates the resulting type. The python-side type coercion is only necessary to avoid ambiguous conversions.
--
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