diff --git a/loopy/preprocess.py b/loopy/preprocess.py index ced1aaaa13ed8275c1e3a376d1c24895287b3239..ab6865f5f1d5927a7e6ca7c3411ba898d1f35291 100644 --- a/loopy/preprocess.py +++ b/loopy/preprocess.py @@ -162,12 +162,10 @@ def find_temporary_scope(kernel): base_storage_to_aliases = {} - kernel_var_names = kernel.all_variable_names(include_temp_storage=False) - for temp_var in six.itervalues(kernel.temporary_variables): if temp_var.base_storage is not None: # no nesting allowed - if temp_var.base_storage in kernel_var_names: + if temp_var.base_storage in kernel.temporary_variables: raise LoopyError("base_storage for temporary '%s' is '%s', " "which is an existing variable name" % (temp_var.name, temp_var.base_storage)) diff --git a/loopy/target/c/__init__.py b/loopy/target/c/__init__.py index a2ad682505bbdb7ed5977a28e201ebc6655c7784..841602b3120b84b3d0df1966989cfe9c763fa7cf 100644 --- a/loopy/target/c/__init__.py +++ b/loopy/target/c/__init__.py @@ -439,20 +439,21 @@ class CASTBuilder(ASTBuilderBase): assert tv.initializer is None offset = 0 - base_storage_sizes.setdefault(tv.base_storage, []).append( - tv.nbytes) - base_storage_to_scope.setdefault(tv.base_storage, []).append( - tv.scope) + if tv.base_storage not in kernel.arg_dict: + base_storage_sizes.setdefault(tv.base_storage, []).append( + tv.nbytes) + base_storage_to_scope.setdefault(tv.base_storage, []).append( + tv.scope) - align_size = tv.dtype.itemsize + align_size = tv.dtype.itemsize - from loopy.kernel.array import VectorArrayDimTag - for dim_tag, axis_len in zip(tv.dim_tags, tv.shape): - if isinstance(dim_tag, VectorArrayDimTag): - align_size *= axis_len + from loopy.kernel.array import VectorArrayDimTag + for dim_tag, axis_len in zip(tv.dim_tags, tv.shape): + if isinstance(dim_tag, VectorArrayDimTag): + align_size *= axis_len - base_storage_to_align_bytes.setdefault(tv.base_storage, []).append( - align_size) + base_storage_to_align_bytes.setdefault(tv.base_storage, + []).append(align_size) for idi in decl_info: cast_decl = POD(self, idi.dtype, "")