diff --git a/loopy/check.py b/loopy/check.py index 2673e1bdf9e3557a95b3504aac7f184281403214..5a1c9e83b52e08f0874f61b500d853b925201731 100644 --- a/loopy/check.py +++ b/loopy/check.py @@ -46,11 +46,11 @@ def check_insn_attributes(kernel): % (insn.id, ", ".join( insn.forced_iname_deps - kernel.all_inames()))) - if insn.insn_deps is not None and not insn.insn_deps <= all_insn_ids: + if insn.depends_on is not None and not insn.depends_on <= all_insn_ids: raise LoopyError("insn '%s' has unknown instruction " "dependencies: %s" % (insn.id, ", ".join( - insn.insn_deps - all_insn_ids))) + insn.depends_on - all_insn_ids))) def check_loop_priority_inames_known(kernel): diff --git a/loopy/frontend/fortran/translator.py b/loopy/frontend/fortran/translator.py index 419bb9ae424d5afeacb2ad374f295128ae91bde9..c708fc4a1d2980dbe36cd243678f355d441fbdd7 100644 --- a/loopy/frontend/fortran/translator.py +++ b/loopy/frontend/fortran/translator.py @@ -226,16 +226,16 @@ class F2LoopyTranslator(FTreeWalkerBase): self.insn_id_counter += 1 if self.auto_dependencies and scope.previous_instruction_id: - insn_deps = frozenset([scope.previous_instruction_id]) + depends_on = frozenset([scope.previous_instruction_id]) else: - insn_deps = frozenset() + depends_on = frozenset() from loopy.kernel.data import Assignment insn = Assignment( lhs, rhs, forced_iname_deps=frozenset( scope.active_loopy_inames), - insn_deps=insn_deps, + depends_on=depends_on, id=new_id, predicates=frozenset(self.conditions), tags=tuple(self.instruction_tags)) diff --git a/loopy/kernel/__init__.py b/loopy/kernel/__init__.py index 00380c3363a25cfc0d09decbf56c1122958dea49..4a5bf4d18654c6a70985a855fb8a9f3cd35c854e 100644 --- a/loopy/kernel/__init__.py +++ b/loopy/kernel/__init__.py @@ -708,9 +708,9 @@ class LoopKernel(RecordWithoutPickling): pass insn = self.id_to_insn[insn_id] - insn_result = set(insn.insn_deps) + insn_result = set(insn.depends_on) - for dep in list(insn.insn_deps): + for dep in list(insn.depends_on): insn_result.update(compute_deps(dep)) result[insn_id] = frozenset(insn_result) @@ -1012,7 +1012,7 @@ class LoopKernel(RecordWithoutPickling): return printed_insn_ids.add(insn.id) - for dep_id in sorted(insn.insn_deps): + for dep_id in sorted(insn.depends_on): print_insn(kernel.id_to_insn[dep_id]) if isinstance(insn, lp.Assignment): @@ -1061,8 +1061,8 @@ class LoopKernel(RecordWithoutPickling): dep_lines = [] for insn in kernel.instructions: - if insn.insn_deps: - dep_lines.append("%s : %s" % (insn.id, ",".join(insn.insn_deps))) + if insn.depends_on: + dep_lines.append("%s : %s" % (insn.id, ",".join(insn.depends_on))) if dep_lines: lines.append(sep) lines.append("DEPENDENCIES: " diff --git a/loopy/kernel/creation.py b/loopy/kernel/creation.py index 45d4f68aeb1d1ed0777c6c2d2ef02c392ae7d46e..9762764cac5c8f119c6eed01e39b6ebf127d97c2 100644 --- a/loopy/kernel/creation.py +++ b/loopy/kernel/creation.py @@ -190,8 +190,8 @@ def parse_insn(insn): raise if insn_match is not None: - insn_deps = None - insn_deps_is_final = False + depends_on = None + depends_on_is_final = False insn_groups = None conflicts_with_groups = None insn_id = None @@ -233,10 +233,10 @@ def parse_insn(insn): elif opt_key == "dep": if opt_value.startswith("*"): - insn_deps_is_final = True + depends_on_is_final = True opt_value = (opt_value[1:]).strip() - insn_deps = frozenset( + depends_on = frozenset( intern(dep.strip()) for dep in opt_value.split(":") if dep.strip()) @@ -290,8 +290,8 @@ def parse_insn(insn): intern(insn_id) if isinstance(insn_id, str) else insn_id), - insn_deps=insn_deps, - insn_deps_is_final=insn_deps_is_final, + depends_on=depends_on, + depends_on_is_final=depends_on_is_final, groups=insn_groups, conflicts_with_groups=conflicts_with_groups, forced_iname_deps_is_final=forced_iname_deps_is_final, @@ -333,7 +333,7 @@ def parse_if_necessary(insn, defines): if isinstance(insn, InstructionBase): yield insn.copy( id=intern(insn.id) if isinstance(insn.id, str) else insn.id, - insn_deps=frozenset(intern(dep) for dep in insn.insn_deps), + depends_on=frozenset(intern(dep) for dep in insn.depends_on), groups=frozenset(intern(grp) for grp in insn.groups), conflicts_with_groups=frozenset( intern(grp) for grp in insn.conflicts_with_groups), @@ -980,9 +980,9 @@ def resolve_wildcard_deps(knl): from fnmatch import fnmatchcase for insn in knl.instructions: - if insn.insn_deps is not None: + if insn.depends_on is not None: new_deps = set() - for dep in insn.insn_deps: + for dep in insn.depends_on: match_count = 0 for other_insn in knl.instructions: if fnmatchcase(other_insn.id, dep): @@ -993,7 +993,7 @@ def resolve_wildcard_deps(knl): # Uh, best we can do new_deps.add(dep) - insn = insn.copy(insn_deps=frozenset(new_deps)) + insn = insn.copy(depends_on=frozenset(new_deps)) new_insns.append(insn) diff --git a/loopy/kernel/tools.py b/loopy/kernel/tools.py index 979392e74958e589dd67425ea413cbbe5639818f..da56e53a72d0b8a5aa9535fd0f3d9219e5a8bbae 100644 --- a/loopy/kernel/tools.py +++ b/loopy/kernel/tools.py @@ -440,7 +440,7 @@ def get_dot_dependency_graph(kernel, iname_cluster=True, use_insn_id=False): repr(insn_label)[1:-1], repr(tooltip)[1:-1], )) - for dep in insn.insn_deps: + for dep in insn.depends_on: dep_graph.setdefault(insn.id, set()).add(dep) # {{{ O(n^3) transitive reduction diff --git a/loopy/maxima.py b/loopy/maxima.py index 060ddbc15e7242c93bfc9f874aa724dc25dc7ef0..1a2d0770c78af6506664aaed17f99e90e200875c 100644 --- a/loopy/maxima.py +++ b/loopy/maxima.py @@ -85,7 +85,7 @@ def get_loopy_instructions_as_maxima(kernel, prefix): raise RuntimeError("non-expression instructions not supported " "in maxima export") - for dep in insn.insn_deps: + for dep in insn.depends_on: if dep not in written_insn_ids: write_insn(dep) diff --git a/loopy/preprocess.py b/loopy/preprocess.py index 839cfd28b5a8264547e7018226a11bfe2e1bfa4f..fe88118e018d5829e9ff2104b70940a39cb95ade 100644 --- a/loopy/preprocess.py +++ b/loopy/preprocess.py @@ -345,7 +345,7 @@ def add_default_dependencies(kernel): new_insns = [] for insn in kernel.instructions: - if not insn.insn_deps_is_final: + if not insn.depends_on_is_final: auto_deps = set() # {{{ add automatic dependencies @@ -365,11 +365,11 @@ def add_default_dependencies(kernel): # }}} - insn_deps = insn.insn_deps - if insn_deps is None: - insn_deps = frozenset() + depends_on = insn.depends_on + if depends_on is None: + depends_on = frozenset() - insn = insn.copy(insn_deps=frozenset(auto_deps) | insn_deps) + insn = insn.copy(depends_on=frozenset(auto_deps) | depends_on) new_insns.append(insn) @@ -441,7 +441,7 @@ def realize_reduction(kernel, insn_id_filter=None): id=init_id, assignee=target_var, forced_iname_deps=outer_insn_inames - frozenset(expr.inames), - insn_deps=frozenset(), + depends_on=frozenset(), expression=expr.operation.neutral_element(arg_dtype, expr.inames)) generated_insns.append(init_insn) @@ -455,12 +455,12 @@ def realize_reduction(kernel, insn_id_filter=None): assignee=target_var, expression=expr.operation( arg_dtype, target_var, expr.expr, expr.inames), - insn_deps=frozenset([init_insn.id]) | insn.insn_deps, + depends_on=frozenset([init_insn.id]) | insn.depends_on, forced_iname_deps=temp_kernel.insn_inames(insn) | set(expr.inames)) generated_insns.append(reduction_insn) - new_insn_insn_deps.add(reduction_insn.id) + new_insn_depends_on.add(reduction_insn.id) return target_var @@ -473,7 +473,7 @@ def realize_reduction(kernel, insn_id_filter=None): import loopy as lp while insn_queue: - new_insn_insn_deps = set() + new_insn_depends_on = set() generated_insns = [] insn = insn_queue.pop(0) @@ -492,8 +492,8 @@ def realize_reduction(kernel, insn_id_filter=None): insn = insn.copy( expression=new_expression, - insn_deps=insn.insn_deps - | frozenset(new_insn_insn_deps), + depends_on=insn.depends_on + | frozenset(new_insn_depends_on), forced_iname_deps=temp_kernel.insn_inames(insn)) insn_queue = generated_insns + [insn] + insn_queue @@ -507,7 +507,7 @@ def realize_reduction(kernel, insn_id_filter=None): else: # nothing happened, we're done with insn - assert not new_insn_insn_deps + assert not new_insn_depends_on new_insns.append(insn) @@ -690,7 +690,7 @@ def preprocess_kernel(kernel, device=None): # to be able to determine the types of the reduced expressions. # # - realize_reduction must happen after default dependencies are added - # because it manipulates the insn_deps field, which could prevent + # because it manipulates the depends_on field, which could prevent # defaults from being applied. kernel = realize_reduction(kernel) diff --git a/loopy/schedule.py b/loopy/schedule.py index 79c558822c5ffae2c553373feda59a945133dd90..17c1ab3ce0bad0170f8f7b03e243862de33af21d 100644 --- a/loopy/schedule.py +++ b/loopy/schedule.py @@ -253,7 +253,7 @@ def find_loop_insn_dep_map(kernel, loop_nest_with_map, loop_nest_around_map): iname_dep = result.setdefault(iname, set()) - for dep_insn_id in insn.insn_deps: + for dep_insn_id in insn.depends_on: if dep_insn_id in iname_dep: # already depending, nothing to check continue @@ -544,13 +544,13 @@ def generate_loop_schedules_internal( for insn_id in insn_ids_to_try: insn = kernel.id_to_insn[insn_id] - is_ready = insn.insn_deps <= sched_state.scheduled_insn_ids + is_ready = insn.depends_on <= sched_state.scheduled_insn_ids if not is_ready: if debug_mode: print("instruction '%s' is missing insn depedencies '%s'" % ( insn.id, ",".join( - insn.insn_deps - sched_state.scheduled_insn_ids))) + insn.depends_on - sched_state.scheduled_insn_ids))) continue want = kernel.insn_inames(insn) - sched_state.parallel_inames diff --git a/loopy/transform/buffer.py b/loopy/transform/buffer.py index bcfc98f609e1ce4bc66b7094e0c48a81467f0ea7..3fef325d00c9f63bf639c69e321848051033ae10 100644 --- a/loopy/transform/buffer.py +++ b/loopy/transform/buffer.py @@ -356,8 +356,8 @@ def buffer_array(kernel, var_name, buffer_inames, init_expression=None, assignee=buf_var_init, expression=init_expression, forced_iname_deps=frozenset(within_inames), - insn_deps=frozenset(), - insn_deps_is_final=True, + depends_on=frozenset(), + depends_on_is_final=True, ) # }}} @@ -375,7 +375,7 @@ def buffer_array(kernel, var_name, buffer_inames, init_expression=None, for assignee_name, _ in insn.assignees_and_indices()): did_write = True - # {{{ add init_insn_id to insn_deps + # {{{ add init_insn_id to depends_on new_insns = [] @@ -389,8 +389,8 @@ def buffer_array(kernel, var_name, buffer_inames, init_expression=None, if insn.id in aar.modified_insn_ids: new_insns.append( insn.copy( - insn_deps=( - none_to_empty_set(insn.insn_deps) + depends_on=( + none_to_empty_set(insn.depends_on) | frozenset([init_insn_id])))) else: new_insns.append(insn) @@ -430,7 +430,7 @@ def buffer_array(kernel, var_name, buffer_inames, init_expression=None, from loopy.kernel.data import Assignment store_instruction = Assignment( id=kernel.make_unique_instruction_id(based_on="store_"+var_name), - insn_deps=frozenset(aar.modified_insn_ids), + depends_on=frozenset(aar.modified_insn_ids), assignee=store_target, expression=store_expression, forced_iname_deps=frozenset(within_inames)) diff --git a/loopy/transform/diff.py b/loopy/transform/diff.py index 95411d50bb66a1f446d722423febcc015a7d974f..6e9eb45bb58b7750c075ee7b79fb024e4cf4f24a 100644 --- a/loopy/transform/diff.py +++ b/loopy/transform/diff.py @@ -242,7 +242,7 @@ class DifferentiationContext(object): raise RuntimeError("do not know how to deal with " "instruction of type %s" % type(insn)) - for dep in insn.insn_deps: + for dep in insn.depends_on: self.import_instruction_and_deps(dep) def import_output_var(self, var_name): diff --git a/loopy/transform/instruction.py b/loopy/transform/instruction.py index bc2b68fb1069fcd41ed6b6595430c33f73b5eea1..eefab909f25672860226d402898c442f5fc6e2dd 100644 --- a/loopy/transform/instruction.py +++ b/loopy/transform/instruction.py @@ -76,14 +76,14 @@ def add_dependency(kernel, insn_match, dependency): % dependency) def add_dep(insn): - new_deps = insn.insn_deps + new_deps = insn.depends_on added_deps = frozenset([dependency]) if new_deps is None: new_deps = added_deps else: new_deps = new_deps | added_deps - return insn.copy(insn_deps=new_deps) + return insn.copy(depends_on=new_deps) return map_instructions(kernel, insn_match, add_dep) @@ -109,17 +109,17 @@ def remove_instructions(kernel, insn_ids): # transitively propagate dependencies # (only one level for now) - if insn.insn_deps is None: - insn_deps = frozenset() + if insn.depends_on is None: + depends_on = frozenset() else: - insn_deps = insn.insn_deps + depends_on = insn.depends_on - new_deps = insn_deps - insn_ids + new_deps = depends_on - insn_ids - for dep_id in insn_deps & insn_ids: - new_deps = new_deps | id_to_insn[dep_id].insn_deps + for dep_id in depends_on & insn_ids: + new_deps = new_deps | id_to_insn[dep_id].depends_on - new_insns.append(insn.copy(insn_deps=frozenset(new_deps))) + new_insns.append(insn.copy(depends_on=frozenset(new_deps))) return kernel.copy( instructions=new_insns) diff --git a/loopy/transform/precompute.py b/loopy/transform/precompute.py index 98d1d422238c9e0ef5614b133d7d4d4c9782b522..9ca4806f48e3ffc8ef11a0a8ad6f97bebb9f6507 100644 --- a/loopy/transform/precompute.py +++ b/loopy/transform/precompute.py @@ -226,7 +226,7 @@ class RuleInvocationReplacer(RuleAwareIdentityMapper): if self.replaced_something: insn = insn.copy( - insn_deps=insn.insn_deps | frozenset([self.compute_insn_id])) + depends_on=insn.depends_on | frozenset([self.compute_insn_id])) new_insns.append(insn) diff --git a/loopy/transform/subst.py b/loopy/transform/subst.py index 982abe01a390677c943de7a1655713f3a24cf4a2..6db5d396f4cf5a039c7eaeedba4641e68707486b 100644 --- a/loopy/transform/subst.py +++ b/loopy/transform/subst.py @@ -320,7 +320,7 @@ def assignment_to_subst(kernel, lhs_name, extra_arguments=(), within=None, insn = id_to_insn[usage_insn_id] def_id = set() - for dep_id in insn.insn_deps: + for dep_id in insn.depends_on: dep_insn = id_to_insn[dep_id] if lhs_name in dep_insn.write_dependency_names(): if lhs_name in dep_insn.read_dependency_names():