Skip to content
Snippets Groups Projects

[Fix] GPU Buffer with iteration slices

Merged Markus Holzer requested to merge holzer/pystencils:FixBufferGPU into master
1 unresolved thread
2 files
+ 18
14
Compare changes
  • Side-by-side
  • Inline
Files
2
@@ -13,7 +13,7 @@ from pystencils.node_collection import NodeCollection
from pystencils.gpucuda.indexing import indexing_creator_from_params
from pystencils.simp.assignment_collection import AssignmentCollection
from pystencils.transformations import (
get_base_buffer_index, get_common_shape, parse_base_pointer_info,
get_base_buffer_index, get_common_field, parse_base_pointer_info,
resolve_buffer_accesses, resolve_field_accesses, unify_shape_symbols)
@@ -45,8 +45,8 @@ def create_cuda_kernel(assignments: Union[AssignmentCollection, NodeCollection],
num_buffer_accesses += sum(1 for access in eq.atoms(Field.Access) if FieldType.is_buffer(access.field))
# common shape and field to from the iteration space
common_shape = get_common_shape(fields_without_buffers)
common_field = list(sorted(fields_without_buffers, key=lambda e: str(e)))[0]
common_field = get_common_field(fields_without_buffers)
common_shape = common_field.spatial_shape
if iteration_slice is None:
# determine iteration slice from ghost layers
@@ -160,7 +160,7 @@ def created_indexed_cuda_kernel(assignments: Union[AssignmentCollection, NodeCol
iteration_slice=[slice(None, None, None)] * len(idx_field.spatial_shape))
function_body = Block(coordinate_symbol_assignments + assignments)
function_body = indexing.guard(function_body, get_common_shape(index_fields))
function_body = indexing.guard(function_body, get_common_field(index_fields).spatial_shape)
ast = KernelFunction(function_body, Target.GPU, Backend.CUDA, make_python_function,
None, function_name, assignments=assignments)
ast.global_variables.update(indexing.index_variables)
Loading