Skip to content

Commit

Permalink
Refactor to oneliner based on Harsh comments
Browse files Browse the repository at this point in the history
Signed-off-by: Stanley Winata <[email protected]>
  • Loading branch information
raikonenfnu committed Nov 27, 2024
1 parent e7485ad commit 78101ed
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions iree/turbine/kernel/wave/hoisting.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,13 +43,15 @@ def get_hoistable_ops(
continue
# Only handle case where we are not writing to the same memory.
# Counterproof: we may expect different read if we write to same memory.
for memory_user in custom_node.memory.users:
if isinstance(get_custom(memory_user), Write):
continue
if any(
isinstance(get_custom(mem_user), Write)
for mem_user in custom_node.memory.users
):
continue
# Only hoist Read that is loop invariant.
dims_indexing = [ind.start for ind in custom_node.index.values()]
dim_depends_on_ivar = [ind.has(induction_variable) for ind in dims_indexing]
if any(dim_depends_on_ivar):
if any(
ind.start.has(induction_variable) for ind in custom_node.index.values()
):
continue
hoistable_ops.append(custom_node)
else:
Expand Down

0 comments on commit 78101ed

Please sign in to comment.