diff --git a/loopy/transform/instruction.py b/loopy/transform/instruction.py index 8b2fa370ad4214cbe16caec61ff45b684ed0a889..e73e5c33c8703a4cdbb5fc20feca9caabeb077c1 100644 --- a/loopy/transform/instruction.py +++ b/loopy/transform/instruction.py @@ -27,7 +27,7 @@ import six # noqa from loopy.diagnostic import LoopyError -# {{{ instruction processing +# {{{ find_instructions def find_instructions(kernel, insn_match): from loopy.match import parse_match @@ -35,6 +35,11 @@ def find_instructions(kernel, insn_match): return [insn for insn in kernel.instructions if match(kernel, insn)] +# }}} + + +# {{{ map_instructions + def map_instructions(kernel, insn_match, f): from loopy.match import parse_match match = parse_match(insn_match) @@ -49,6 +54,10 @@ def map_instructions(kernel, insn_match, f): return kernel.copy(instructions=new_insns) +# }}} + + +# {{{ set_instruction_priority def set_instruction_priority(kernel, insn_match, priority): """Set the priority of instructions matching *insn_match* to *priority*. @@ -62,6 +71,10 @@ def set_instruction_priority(kernel, insn_match, priority): return map_instructions(kernel, insn_match, set_prio) +# }}} + + +# {{{ add_dependency def add_dependency(kernel, insn_match, dependency): """Add the instruction dependency *dependency* to the instructions matched @@ -87,6 +100,10 @@ def add_dependency(kernel, insn_match, dependency): return map_instructions(kernel, insn_match, add_dep) +# }}} + + +# {{{ remove_instructions def remove_instructions(kernel, insn_ids): """Return a new kernel with instructions in *insn_ids* removed. @@ -124,6 +141,10 @@ def remove_instructions(kernel, insn_ids): return kernel.copy( instructions=new_insns) +# }}} + + +# {{{ replace_instruction_ids def replace_instruction_ids(kernel, replacements): new_insns = []