tkonolige commented on a change in pull request #8085:
URL: https://github.com/apache/tvm/pull/8085#discussion_r636230174
##########
File path: python/tvm/topi/random/kernel.py
##########
@@ -297,6 +294,12 @@ def gen_ir(gen_ptr, out_gen_ptr, out_array_ptr):
# Compute random values
_threefry(irb, tmp, 0, tmp, 4, out_array, 0, out_len // 4)
+ with irb.if_scope(out_len % 4 != 0):
Review comment:
This should be `if out_len.value % 4 != 0:`
##########
File path: python/tvm/topi/random/kernel.py
##########
@@ -306,7 +309,10 @@ def gen_ir(gen_ptr, out_gen_ptr, out_array_ptr):
out_gen[4] = tmp[4] # path stays the same
out_gen[5] = tmp[5]
out_gen[6] = tir.const(0, dtype=gen.dtype) # unused, leave it as 0
- out_gen[7] = tmp[7] + tir.Cast(gen.dtype, out_len) # increment counter
+ with irb.if_scope(out_len % 4 != 0):
+ out_gen[7] = tmp[7] + tir.Cast(gen.dtype, out_len % 4)
+ with irb.else_scope():
+ out_gen[7] = tmp[7] + tir.Cast(gen.dtype, out_len) # increment
counter
Review comment:
This is incorrect. It should just be `out_gen[7] = tmp[7] +
tir.Cast(gen.dtype, out_len)` because we used `out_len` values from the counter.
--
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.
For queries about this service, please contact Infrastructure at:
[email protected]