Prop One Time Use behaves wrong on modified rhs
Blealtan opened this issue · comments
Blealtan commented
import ir
print("without input:")
with ir.VarDef("x", (5, ), "float64", "cache", "cpu") as x:
with ir.VarDef("y", (5, ), "float64", "output", "cpu") as y:
with ir.For("i", 0, 5) as i:
x[i] = 0
with ir.For("i", 0, 5) as i:
x[i] = x[i] - 1
y[i] = x[i]
f = ir.pop_ast()
print(f)
print(ir.prop_one_time_use(f))
print("with input:")
with ir.VarDef("x", (5, ), "float64", "input", "cpu") as x:
with ir.VarDef("y", (5, ), "float64", "output", "cpu") as y:
with ir.For("i", 0, 5) as i:
x[i] = 0
with ir.For("i", 0, 5) as i:
x[i] = x[i] - 1
y[i] = x[i]
f = ir.pop_ast()
print(f)
print(ir.prop_one_time_use(f))
Notice that with x as input the problem does not occur, but with x as cache it occurs.
Shizhi Tang commented
Fixed in d8b4974