diff --git a/loopy/transform/instruction.py b/loopy/transform/instruction.py index 410274f907b250bb81583281ebe503e8c8c80373..381a3b7c986193d21509b59df8954cb122fe7d32 100644 --- a/loopy/transform/instruction.py +++ b/loopy/transform/instruction.py @@ -154,7 +154,14 @@ def remove_instructions(kernel, 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))) + # update no_sync_with + + new_no_sync_with = frozenset((insn_id, scope) + for insn_id, scope in insn.no_sync_with + if insn_id not in insn_ids) + + new_insns.append( + insn.copy(depends_on=new_deps, no_sync_with=new_no_sync_with)) return kernel.copy( instructions=new_insns)