Skip to content

Commit

Permalink
Optimize array assignment.
Browse files Browse the repository at this point in the history
  • Loading branch information
mkskeller committed Feb 24, 2024
1 parent 45c99fa commit 247a686
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions Compiler/types.py
Original file line number Diff line number Diff line change
Expand Up @@ -5957,14 +5957,18 @@ def assign_all(self, value, n_threads=None, conv=True):
n_threads = None
if n_threads is not None:
self.address = MemValue.if_necessary(self.address)
@library.multithread(n_threads, self.length)
@library.multithread(n_threads, self.length, max_size=program.budget)
def _(base, size):
if use_vector:
self.assign_vector(self.value_type(value, size=size), base)
else:
@library.for_range_opt(size)
def _(i):
self[base + i] = mem_value
v = mem_value.read()
if isinstance(v, sint):
self.assign_vector(v.expand_to_vector(size), base=base)
else:
@library.for_range_opt(size)
def _(i):
self[base + i] = mem_value
return self

def get_vector(self, base=0, size=None):
Expand Down

0 comments on commit 247a686

Please sign in to comment.