提交 3da5407b authored 作者: --global's avatar --global

Remove condition that could cause aliasing and fix typo

上级 a3a49a80
...@@ -1228,7 +1228,7 @@ class ScanSaveMem(gof.Optimizer): ...@@ -1228,7 +1228,7 @@ class ScanSaveMem(gof.Optimizer):
if start == 0 or store_steps[i] == 0: if start == 0 or store_steps[i] == 0:
store_steps[i] = 0 store_steps[i] = 0
else: else:
# The "+ 1" is because if the memory pre-allocation # The "+ 1" is because of the memory pre-allocation
# mechanism used to in the Scan op to reduce overhead. # mechanism used to in the Scan op to reduce overhead.
# To prevent aliasing between the inputs and outputs # To prevent aliasing between the inputs and outputs
# of recurrent states, it requires that the buffer be # of recurrent states, it requires that the buffer be
...@@ -1236,18 +1236,12 @@ class ScanSaveMem(gof.Optimizer): ...@@ -1236,18 +1236,12 @@ class ScanSaveMem(gof.Optimizer):
# tap needed don't occupy the sample place in the # tap needed don't occupy the sample place in the
# circular buffer. For now, this only needs to be done # circular buffer. For now, this only needs to be done
# for mitsots and sitsots (because mitmots are not # for mitsots and sitsots (because mitmots are not
# currently supported by the mechanism) and only if # currently supported by the mechanism).
# the inner function has more then one output
# (otherwise, there is no risk of aliasing because
# once the output is computed, the oldest tap can
# safely be overwritten).
first_mitsot_idx = node.op.n_mit_mot first_mitsot_idx = node.op.n_mit_mot
last_sitsot_idx = (node.op.n_mit_mot + last_sitsot_idx = (node.op.n_mit_mot +
node.op.n_mit_sot + node.op.n_mit_sot +
node.op.n_sit_sot - 1) node.op.n_sit_sot - 1)
if (i >= first_mitsot_idx and i <= last_sitsot_idx and if (i >= first_mitsot_idx and i <= last_sitsot_idx):
len(node.op.outputs) > 1):
pval = select_max(nw_steps - start + init_l[i], pval = select_max(nw_steps - start + init_l[i],
init_l[i] + 1) init_l[i] + 1)
else: else:
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论