mirror of
https://github.com/data61/MP-SPDZ.git
synced 2026-01-09 13:37:58 -05:00
Fix bug in register update.
This commit is contained in:
@@ -314,6 +314,7 @@ class Merger:
|
||||
reg_nodes = {}
|
||||
last_def = defaultdict_by_id(lambda: -1)
|
||||
last_read = defaultdict_by_id(lambda: -1)
|
||||
second_last_read = defaultdict_by_id(lambda: -1)
|
||||
last_mem_write = []
|
||||
last_mem_read = []
|
||||
last_mem_write_of = defaultdict(list)
|
||||
@@ -332,6 +333,8 @@ class Merger:
|
||||
round_type = {}
|
||||
|
||||
def add_edge(i, j):
|
||||
if i in (-1, j):
|
||||
return
|
||||
G.add_edge(i, j)
|
||||
for d in (self.depths, self.real_depths):
|
||||
if d[j] < d[i]:
|
||||
@@ -341,15 +344,13 @@ class Merger:
|
||||
for dup in reg.duplicates:
|
||||
if last_def[dup] not in (-1, n):
|
||||
add_edge(last_def[dup], n)
|
||||
second_last_read[reg] = last_read[reg]
|
||||
last_read[reg] = n
|
||||
|
||||
def write(reg, n):
|
||||
for dup in reg.duplicates:
|
||||
if last_read[dup] not in (-1, n):
|
||||
add_edge(last_read[dup], n)
|
||||
if id(dup) in [id(x) for x in block.instructions[n].get_used()] and \
|
||||
last_read[dup] not in (-1, n):
|
||||
add_edge(last_read[dup], n)
|
||||
add_edge(last_read[dup], n)
|
||||
add_edge(second_last_read[dup], n)
|
||||
last_def[reg] = n
|
||||
|
||||
def handle_mem_access(addr, reg_type, last_access_this_kind,
|
||||
|
||||
@@ -1501,11 +1501,9 @@ class Tape:
|
||||
:param other: any convertible type
|
||||
|
||||
"""
|
||||
if isinstance(other, Tape.Register) and other.block != Program.prog.curr_block:
|
||||
other = type(self)(other)
|
||||
else:
|
||||
other = self.conv(other)
|
||||
if Program.prog.curr_block in [x.block for x in self.duplicates]:
|
||||
diff_block = isinstance(other, Tape.Register) and self.block != other.block
|
||||
other = type(self)(other)
|
||||
if not diff_block:
|
||||
self.program.start_new_basicblock()
|
||||
if self.program != other.program:
|
||||
raise CompilerError(
|
||||
|
||||
Reference in New Issue
Block a user