diff --git a/src/pystencils/nbackend/kernelcreation/iteration_space.py b/src/pystencils/nbackend/kernelcreation/iteration_space.py index ee3e7e55594d1de379a3477bd529291f999885fd..d38cb35347f238c9beaabeefd2bd36c51d57faeb 100644 --- a/src/pystencils/nbackend/kernelcreation/iteration_space.py +++ b/src/pystencils/nbackend/kernelcreation/iteration_space.py @@ -185,6 +185,8 @@ def create_full_iteration_space( # - We have no domain fields, but at least one custom field -> determine common field from custom fields # - We have neither domain nor custom fields -> Error + # TODO: Re-implement as `get_archetype_field`, check not only shape but also layout equality + # The archetype field must encompass all information about the iteration space: shape, extents, and loop order. from ...transformations import get_common_field if len(domain_field_accesses) > 0: diff --git a/src/pystencils/nbackend/kernelcreation/kernelcreation.py b/src/pystencils/nbackend/kernelcreation/kernelcreation.py index fba465727716828c65cc7d68e8841d96c121bcdb..c87ef2fe46118b233f373041bb79412744377858 100644 --- a/src/pystencils/nbackend/kernelcreation/kernelcreation.py +++ b/src/pystencils/nbackend/kernelcreation/kernelcreation.py @@ -1,6 +1,6 @@ from ...simp import AssignmentCollection -from ..ast import PsBlock, PsKernelFunction +from ..ast import PsKernelFunction from ...enums import Target from .context import KernelCreationContext @@ -30,12 +30,11 @@ def create_kernel(assignments: AssignmentCollection, options: KernelCreationOpti ctx.set_iteration_space(ispace) freeze = FreezeExpressions(ctx) - kernel_body: PsBlock = freeze(assignments) + kernel_body = freeze(assignments) typify = Typifier(ctx) kernel_body = typify(kernel_body) - # Up to this point, all was target-agnostic, but now the target becomes relevant. match options.target: case Target.CPU: from .platform import BasicCpu @@ -47,7 +46,6 @@ def create_kernel(assignments: AssignmentCollection, options: KernelCreationOpti # TODO: SYCL platform (?) raise NotImplementedError("Target platform not implemented") - # 6. Add loops or device indexing kernel_ast = platform.apply_iteration_space(kernel_body, ispace) # 7. Apply optimizations @@ -56,7 +54,6 @@ def create_kernel(assignments: AssignmentCollection, options: KernelCreationOpti # - Loop Splitting, Tiling, Blocking kernel_ast = platform.optimize(kernel_ast) - # 8. Create and return kernel function. function = PsKernelFunction(kernel_ast, options.target, name=options.function_name) function.add_constraints(*ctx.constraints)