From b2f63c25f18a1c266ec41c90dfe6fdfec5f9394f Mon Sep 17 00:00:00 2001 From: Andreas Kloeckner Date: Mon, 20 May 2024 13:10:14 -0500 Subject: [PATCH] Handle use-before-assign warnings from pylint --- loopy/codegen/instruction.py | 2 ++ loopy/schedule/__init__.py | 2 +- loopy/transform/buffer.py | 4 +++- loopy/transform/save.py | 3 +++ 4 files changed, 9 insertions(+), 2 deletions(-) diff --git a/loopy/codegen/instruction.py b/loopy/codegen/instruction.py index 371979d97..0d13f9c9d 100644 --- a/loopy/codegen/instruction.py +++ b/loopy/codegen/instruction.py @@ -142,6 +142,8 @@ def generate_assignment_instruction_code(codegen_state, insn): del lhs_is_vector del rhs_is_vector + else: + is_vector = False # }}} diff --git a/loopy/schedule/__init__.py b/loopy/schedule/__init__.py index 4cca43827..7dbc8cb68 100644 --- a/loopy/schedule/__init__.py +++ b/loopy/schedule/__init__.py @@ -2252,7 +2252,7 @@ def get_one_linearized_kernel( callables_table) if CACHING_ENABLED and not from_cache: - schedule_cache.store_if_not_present(sched_cache_key, result) + schedule_cache.store_if_not_present(sched_cache_key, result) # pylint: disable=possibly-used-before-assignment # noqa: E501 return result diff --git a/loopy/transform/buffer.py b/loopy/transform/buffer.py index b77c6a5ed..c40eefcfd 100644 --- a/loopy/transform/buffer.py +++ b/loopy/transform/buffer.py @@ -241,7 +241,9 @@ def buffer_array_for_single_kernel(kernel, callables_table, var_name, index = assignee.index_tuple elif isinstance(assignee, LinearSubscript): - if assignee.aggregate.name == var_name: + assignee_name = assignee.aggregate.name + index = () + if assignee_name == var_name: raise LoopyError("buffer_array may not be applied in the " "presence of linear write indexing into '%s'" % var_name) diff --git a/loopy/transform/save.py b/loopy/transform/save.py index 6bf1c1543..c5931e897 100644 --- a/loopy/transform/save.py +++ b/loopy/transform/save.py @@ -393,6 +393,7 @@ def _sortedtags(tags): my_group_tags = [] my_local_tags = [] + group_tags_originating_insn_id = None for iname in insn.within_inames: tags = self.kernel.iname_tags(iname) @@ -543,6 +544,8 @@ def add_subscript_if_subscript_nonempty(agg, subscript=()): elif mode == "reload": depends_on = frozenset() update_deps = accessing_insns_in_subkernel + else: + raise AssertionError() pre_barrier, post_barrier = self.get_enclosing_global_barrier_pair(subkernel)