Skip to content

Commit

Permalink
Handle use-before-assign warnings from pylint
Browse files Browse the repository at this point in the history
  • Loading branch information
inducer committed May 20, 2024
1 parent 635546a commit b2f63c2
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 2 deletions.
2 changes: 2 additions & 0 deletions loopy/codegen/instruction.py
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,8 @@ def generate_assignment_instruction_code(codegen_state, insn):

del lhs_is_vector
del rhs_is_vector
else:
is_vector = False

# }}}

Expand Down
2 changes: 1 addition & 1 deletion loopy/schedule/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
4 changes: 3 additions & 1 deletion loopy/transform/buffer.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down
3 changes: 3 additions & 0 deletions loopy/transform/save.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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)

Expand Down

0 comments on commit b2f63c2

Please sign in to comment.