Skip to content
Snippets Groups Projects
Commit a9c8d6a7 authored by Frederik Hennig's avatar Frederik Hennig Committed by Richard Angersbach
Browse files

Apply 4 suggestion(s) to 2 file(s)

parent 0e2a548a
No related branches found
No related tags found
1 merge request!438Reduction Support
Pipeline #78290 passed
......@@ -207,7 +207,7 @@ class KernelCreationContext:
def add_reduction_info(
self,
lhs_name: str,
lhs_dtype: PsType,
lhs_dtype: PsNumericType,
reduction_op: ReductionOp,
):
"""Create ReductionInfo instance and add to its corresponding lookup table for a given symbol name."""
......@@ -215,16 +215,15 @@ class KernelCreationContext:
# make sure that lhs symbol never occurred before ReductionAssignment
if self.find_symbol(lhs_name):
raise KernelConstraintsError(
f"Left-hand side {lhs_name} of ReductionAssignment already exists in symbol table. "
f"Make sure that it is only used once in a kernel's ReductionAssignment."
f"Cannot create reduction with symbol {lhs_name}: "
"Another symbol with the same name already exist."
)
# add symbol for lhs with pointer datatype for write-back mechanism
pointer_symb = self.get_symbol(lhs_name, PsPointerType(lhs_dtype))
# create kernel-local copy of lhs symbol
local_symb = PsSymbol(f"{lhs_name}_local", lhs_dtype)
self.add_symbol(local_symb)
local_symb = self.get_new_symbol(f"{lhs_name}_local", lhs_dtype)
# match for reduction operation and set neutral init_val
init_val: PsExpression
......
......@@ -198,9 +198,8 @@ class FreezeExpressions:
lhs_dtype = lhs_symbol.dtype
lhs_name = lhs_symbol.name
assert isinstance(
lhs_dtype, PsNumericType
), "Reduction assignments require type information of the lhs symbol."
if not isinstance(lhs_dtype, PsNumericType):
raise FreezeError("Reduction symbol must have a numeric data type.")
# get reduction info from context
reduction_info = self._ctx.add_reduction_info(
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment