From 44526560df8d3f5e5c02dec399c0d221b2844c30 Mon Sep 17 00:00:00 2001
From: markus holzer <markus.holzer@fau.de>
Date: Fri, 26 Feb 2021 08:40:41 +0100
Subject: [PATCH] Remove features which do not belong to this MR

---
 pystencils/backends/cbackend.py      | 25 ++++---------------------
 pystencils/cpu/kernelcreation.py     |  6 ++----
 pystencils/gpucuda/kernelcreation.py |  6 ++----
 pystencils/kernelcreation.py         |  9 +++------
 4 files changed, 11 insertions(+), 35 deletions(-)

diff --git a/pystencils/backends/cbackend.py b/pystencils/backends/cbackend.py
index 1273b7b0..9603d6d2 100644
--- a/pystencils/backends/cbackend.py
+++ b/pystencils/backends/cbackend.py
@@ -628,20 +628,6 @@ class VectorizedCustomSympyPrinter(CustomSympyPrinter):
         return result
 
     def _print_Add(self, expr, order=None):
-        def visit(summands):
-            if len(summands) == 2:
-                sign = summands[0].sign * summands[1].sign
-                func = self.instruction_set['-' + suffix] if sign == -1 else self.instruction_set['+' + suffix]
-                return func.format(summands[0].term, summands[1].term)
-            else:
-                elements = len(summands) // 2
-                if len(summands[:elements]) < 2:
-                    func = self.instruction_set['-' + suffix] \
-                        if summands[0].sign == -1 else self.instruction_set['+' + suffix]
-                    return func.format(summands[0].term, visit(summands[elements:]))
-                else:
-                    func = self.instruction_set['+' + suffix]
-                    return func.format(visit(summands[:elements]), visit(summands[elements:]))
         try:
             result = self._scalarFallback('_print_Add', expr)
         except Exception:
@@ -676,13 +662,10 @@ class VectorizedCustomSympyPrinter(CustomSympyPrinter):
             summands.insert(0, self.SummandInfo(1, "0"))
 
         assert len(summands) >= 2
-        if len(summands) < 10:
-            processed = summands[0].term
-            for summand in summands[1:]:
-                func = self.instruction_set['-' + suffix] if summand.sign == -1 else self.instruction_set['+' + suffix]
-                processed = func.format(processed, summand.term)
-        else:
-            processed = visit(summands)
+        processed = summands[0].term
+        for summand in summands[1:]:
+            func = self.instruction_set['-' + suffix] if summand.sign == -1 else self.instruction_set['+' + suffix]
+            processed = func.format(processed, summand.term)
         return processed
 
     def _print_Pow(self, expr):
diff --git a/pystencils/cpu/kernelcreation.py b/pystencils/cpu/kernelcreation.py
index 6fbd8ff9..81daf49f 100644
--- a/pystencils/cpu/kernelcreation.py
+++ b/pystencils/cpu/kernelcreation.py
@@ -18,7 +18,7 @@ AssignmentOrAstNodeList = List[Union[Assignment, ast.Node]]
 
 def create_kernel(assignments: AssignmentOrAstNodeList, function_name: str = "kernel", type_info='double',
                   split_groups=(), iteration_slice=None, ghost_layers=None,
-                  skip_independence_check=False, base_pointer_spec=None) -> KernelFunction:
+                  skip_independence_check=False) -> KernelFunction:
     """Creates an abstract syntax tree for a kernel function, by taking a list of update rules.
 
     Loops are created according to the field accesses in the equations.
@@ -39,7 +39,6 @@ def create_kernel(assignments: AssignmentOrAstNodeList, function_name: str = "ke
                      all dimensions
         skip_independence_check: don't check that loop iterations are independent. This is needed e.g. for
                                  periodicity kernel, that access the field outside the iteration bounds. Use with care!
-        base_pointer_spec: specifies which field accesses are resolved by pointers see :func:`parse_base_pointer_info`
 
     Returns:
         AST node representing a function, that can be printed as C or CUDA code
@@ -74,8 +73,7 @@ def create_kernel(assignments: AssignmentOrAstNodeList, function_name: str = "ke
         typed_split_groups = [[type_symbol(s) for s in split_group] for split_group in split_groups]
         split_inner_loop(ast_node, typed_split_groups)
 
-    if base_pointer_spec is None:
-        base_pointer_spec = [['spatialInner0'], ['spatialInner1']] if len(loop_order) >= 2 else [['spatialInner0']]
+    base_pointer_spec = [['spatialInner0'], ['spatialInner1']] if len(loop_order) >= 2 else [['spatialInner0']]
     base_pointer_info = {field.name: parse_base_pointer_info(base_pointer_spec, loop_order,
                                                              field.spatial_dimensions, field.index_dimensions)
                          for field in fields_without_buffers}
diff --git a/pystencils/gpucuda/kernelcreation.py b/pystencils/gpucuda/kernelcreation.py
index e59adea9..52a4dc8b 100644
--- a/pystencils/gpucuda/kernelcreation.py
+++ b/pystencils/gpucuda/kernelcreation.py
@@ -15,8 +15,7 @@ def create_cuda_kernel(assignments,
                        iteration_slice=None,
                        ghost_layers=None,
                        skip_independence_check=False,
-                       use_textures_for_interpolation=True,
-                       base_pointer_spec=None):
+                       use_textures_for_interpolation=True):
     assert assignments, "Assignments must not be empty!"
     fields_read, fields_written, assignments = add_types(assignments, type_info, not skip_independence_check)
     all_fields = fields_read.union(fields_written)
@@ -74,8 +73,7 @@ def create_cuda_kernel(assignments,
 
     implement_interpolations(ast, implement_by_texture_accesses=use_textures_for_interpolation)
 
-    if base_pointer_spec is None:
-        base_pointer_spec = [['spatialInner0']]
+    base_pointer_spec = [['spatialInner0']]
     base_pointer_info = {f.name: parse_base_pointer_info(base_pointer_spec, [2, 1, 0],
                                                          f.spatial_dimensions, f.index_dimensions)
                          for f in all_fields}
diff --git a/pystencils/kernelcreation.py b/pystencils/kernelcreation.py
index acefc8ad..b158754c 100644
--- a/pystencils/kernelcreation.py
+++ b/pystencils/kernelcreation.py
@@ -31,8 +31,7 @@ def create_kernel(assignments,
                   cpu_prepend_optimizations=[],
                   use_auto_for_assignments=False,
                   opencl_queue=None,
-                  opencl_ctx=None,
-                  base_pointer_spec=None):
+                  opencl_ctx=None):
     """
     Creates abstract syntax tree (AST) of kernel, using a list of update equations.
 
@@ -58,7 +57,6 @@ def create_kernel(assignments,
         gpu_indexing_params: dict with indexing parameters (constructor parameters of indexing class)
                              e.g. for 'block' one can specify '{'block_size': (20, 20, 10) }'
         cpu_prepend_optimizations: list of extra optimizations to perform first on the AST
-        base_pointer_spec: specifies which field accesses are resolved by pointers see :func:`parse_base_pointer_info`
 
     Returns:
         abstract syntax tree (AST) object, that can either be printed as source code with `show_code` or
@@ -96,7 +94,7 @@ def create_kernel(assignments,
         from pystencils.cpu import add_openmp
         ast = create_kernel(assignments, type_info=data_type, split_groups=split_groups,
                             iteration_slice=iteration_slice, ghost_layers=ghost_layers,
-                            skip_independence_check=skip_independence_check, base_pointer_spec=base_pointer_spec)
+                            skip_independence_check=skip_independence_check)
         for optimization in cpu_prepend_optimizations:
             optimization(ast)
         omp_collapse = None
@@ -121,8 +119,7 @@ def create_kernel(assignments,
                                  indexing_creator=indexing_creator_from_params(gpu_indexing, gpu_indexing_params),
                                  iteration_slice=iteration_slice, ghost_layers=ghost_layers,
                                  skip_independence_check=skip_independence_check,
-                                 use_textures_for_interpolation=use_textures_for_interpolation,
-                                 base_pointer_spec=base_pointer_spec)
+                                 use_textures_for_interpolation=use_textures_for_interpolation)
         if target == 'opencl':
             from pystencils.opencl.opencljit import make_python_function
             ast._backend = 'opencl'
-- 
GitLab