loopy/transform/instruction.py
def remove_instructions(kernel, insn_ids):
    """Return a new kernel with instructions in *insn_ids* removed.

    Dependencies across (one, for now) deleted isntructions are propagated.
    Behavior is undefined for now for chains of dependencies within the
    set of deleted instructions.
    """

    if not insn_ids:
        return kernel

    assert isinstance(insn_ids, set)
    id_to_insn = kernel.id_to_insn

    new_insns = []
    for insn in kernel.instructions:
        if insn.id in insn_ids:
            continue

        # transitively propagate dependencies
        # (only one level for now)
        if insn.depends_on is None:
            depends_on = frozenset()
        else:
            depends_on = insn.depends_on

        new_deps = depends_on - insn_ids

        for dep_id in depends_on & insn_ids:
            new_deps = new_deps | id_to_insn[dep_id].depends_on

        new_insns.append(insn.copy(depends_on=frozenset(new_deps)))

    return kernel.copy(
            instructions=new_insns)
Return a new kernel with instructions in *insn_ids* removed.

    Dependencies across (one, for now) deleted isntructions are propagated.
    Behavior is undefined for now for chains of dependencies within the
    set of deleted instructions.
    
Return a new kernel with instructions in *insn_ids* removed.
Dependencies across (one, for now) deleted isntructions are propagated.
Behavior is undefined for now for chains of dependencies within the
set of deleted instructions.
Return a new kernel with instructions in * insn_ids * removed . Dependencies across ( one for now ) deleted isntructions are propagated . Behavior is undefined for now for chains of dependencies within the set of deleted instructions .
def remove_instructions(kernel, insn_ids):
    if not insn_ids:
        return kernel
    assert isinstance(insn_ids, set)
    id_to_insn = kernel.id_to_insn
    new_insns = []
    for insn in kernel.instructions:
        if insn.id in insn_ids:
            continue
        if insn.depends_on is None:
            depends_on = frozenset()
        else:
            depends_on = insn.depends_on
        new_deps = depends_on - insn_ids
        for dep_id in depends_on & insn_ids:
            new_deps = new_deps | id_to_insn[dep_id].depends_on
        new_insns.append(insn.copy(depends_on=frozenset(new_deps)))
    return kernel.copy(
            instructions=new_insns)
def remove_instructions ( kernel , insn_ids ) : if not insn_ids : return kernel assert isinstance ( insn_ids , set ) id_to_insn = kernel . id_to_insn new_insns = [ ] for insn in kernel . instructions : if insn . id in insn_ids : continue if insn . depends_on is None : depends_on = frozenset ( ) else : depends_on = insn . depends_on new_deps = depends_on - insn_ids for dep_id in depends_on & insn_ids : new_deps = new_deps | id_to_insn [ dep_id ] . depends_on new_insns . append ( insn . copy ( depends_on = frozenset ( new_deps ) ) ) return kernel . copy ( instructions = new_insns )
Return a new kernel with instructions in *insn_ids* removed.
Return a new kernel with instructions in * insn_ids * removed .
"""Return a new kernel with instructions in *insn_ids* removed.

    Dependencies across (one, for now) deleted isntructions are propagated.
    Behavior is undefined for now for chains of dependencies within the
    set of deleted instructions.
    """ # transitively propagate dependencies # (only one level for now)
kernel
insn_ids