Skip to content
Snippets Groups Projects
Commit 94b65d29 authored by Matt Wala's avatar Matt Wala
Browse files

get_usable_inames_for_conditional(): Fix inames finding in the case

that we are outside a subkernel (closes #65).
parent bd12a464
No related branches found
No related tags found
No related merge requests found
...@@ -65,11 +65,20 @@ def get_usable_inames_for_conditional(kernel, sched_index): ...@@ -65,11 +65,20 @@ def get_usable_inames_for_conditional(kernel, sched_index):
# Find our containing subkernel, grab inames for all insns from there. # Find our containing subkernel, grab inames for all insns from there.
subkernel_index = sched_index within_subkernel = False
from loopy.schedule import CallKernel
for prev_sched_index, sched_item in enumerate(kernel.schedule):
while not isinstance(kernel.schedule[subkernel_index], CallKernel): if prev_sched_index == sched_index:
subkernel_index -= 1 if not within_subkernel:
# Outside all subkernels - use only inames available to device.
return frozenset(result)
from loopy.schedule import CallKernel, ReturnFromKernel
if isinstance(sched_item, CallKernel):
within_subkernel = True
subkernel_index = prev_sched_index
elif isinstance(sched_item, ReturnFromKernel):
within_subkernel = False
insn_ids_for_subkernel = get_insn_ids_for_block_at( insn_ids_for_subkernel = get_insn_ids_for_block_at(
kernel.schedule, subkernel_index) kernel.schedule, subkernel_index)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment