From e5861425c5e2e4868e0c696763297768814c02ec Mon Sep 17 00:00:00 2001 From: zy69guqi <richard.angersbach@fau.de> Date: Thu, 16 Jan 2025 12:59:16 +0100 Subject: [PATCH] Minor adaptation on how symbols are given reduction property --- src/pystencils/backend/kernelcreation/context.py | 5 +++-- src/pystencils/backend/kernelcreation/freeze.py | 2 +- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/src/pystencils/backend/kernelcreation/context.py b/src/pystencils/backend/kernelcreation/context.py index 258204f8d..e41f8371c 100644 --- a/src/pystencils/backend/kernelcreation/context.py +++ b/src/pystencils/backend/kernelcreation/context.py @@ -179,13 +179,14 @@ class KernelCreationContext: """ if self.find_symbol(symbol.name) is None: raise PsInternalCompilerError( - "add_reduction_to_symbol: Symbol does not exist in the symbol table" + f"add_reduction_to_symbol: {symbol.name} does not exist in the symbol table" ) if symbol not in self._symbols_with_reduction and not symbol.get_properties(ReductionSymbolProperty): + symbol.add_property(reduction) self._symbols_with_reduction[symbol] = reduction else: - raise PsInternalCompilerError(f"add_reduction_to_symbol: Symbol {symbol.name} already has a reduction property") + raise PsInternalCompilerError(f"add_reduction_to_symbol: {symbol.name} already has a reduction property") def duplicate_symbol( self, symb: PsSymbol, new_dtype: PsType | None = None diff --git a/src/pystencils/backend/kernelcreation/freeze.py b/src/pystencils/backend/kernelcreation/freeze.py index 7316e2f9f..ae728dd49 100644 --- a/src/pystencils/backend/kernelcreation/freeze.py +++ b/src/pystencils/backend/kernelcreation/freeze.py @@ -213,7 +213,7 @@ class FreezeExpressions: case _: raise FreezeError(f"Unsupported reduced assignment: {expr.op}.") - lhs.symbol.add_property(ReductionSymbolProperty(expr.op, init_val)) + self._ctx.add_reduction_to_symbol(lhs.symbol, ReductionSymbolProperty(expr.op, init_val)) return PsAssignment(lhs, op(lhs.clone(), rhs)) -- GitLab