Skip to content
Snippets Groups Projects
Commit af855492 authored by Richard Angersbach's avatar Richard Angersbach
Browse files

Minor adaptation on how symbols are given reduction property

parent b8718cb1
No related branches found
No related tags found
1 merge request!438Reduction Support
......@@ -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
......
......@@ -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))
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment