From 5cb3ecf80bcbb2ec209fc10d48901578235aaf0d Mon Sep 17 00:00:00 2001 From: Vikas Kurapati Date: Wed, 10 Apr 2024 13:50:55 +0200 Subject: [PATCH] Changes required for order 8 to work --- yateto/codegen/factory.py | 5 +++-- yateto/input.py | 2 +- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/yateto/codegen/factory.py b/yateto/codegen/factory.py index 7065dfe..837257e 100644 --- a/yateto/codegen/factory.py +++ b/yateto/codegen/factory.py @@ -30,8 +30,6 @@ def temporary(self, bufname, size, iniZero=False, memory=list()): if self._target == 'cpu': if self._arch.onHeap(size): - if memory: - raise NotImplementedError('Direct temporary initialization is not supported for heap-allocated memory.') if len(self._freeList) == 0: self._cpp('int {};'.format(self.ERROR_NAME)) self._cpp('{}* {};'.format(self._arch.typename, bufname)) @@ -42,6 +40,9 @@ def temporary(self, bufname, size, iniZero=False, memory=list()): size, self._arch.typename)) if iniZero: + if memory: + for i, data in enumerate(memory): + self._cpp(f'{bufname}[{i}] = {data};') self._cpp.memset(bufname, size, self._arch.typename) self._freeList.append(bufname) else: diff --git a/yateto/input.py b/yateto/input.py index 76e0194..47f5035 100644 --- a/yateto/input.py +++ b/yateto/input.py @@ -61,7 +61,7 @@ def __processMatrix(name, shape, entries, clones, transpose, alignStride, namesp 'Please, check your input file and rename') matrices[name] = Tensor(name=name, - shape=shape, + shape=tuple(shape), spp=mtx, alignStride=alignStride(name), namespace=namespace)